Quick Start with Sequel 3 in Rails 3
This guide is using Rails 3.2.6 and Sequel 3.37.0. If you're using a different version, these instructions may not quite apply.
Edit: realized this morning the title was ambiguous, so I updated it to reflect the Sequel focus.
Here's the easiest way to get going with Sequel in Rails:
- Add
sequel
andtalentbox-sequel-rails
to your Gemfile. - Replace
require "rails/all"
in yourapplication.rb
file with the expanded form, as given here. - Comment out or remove any configuration lines in
application.rb
andenvironments/*.rb
that start withconfig.active_record
, or you'll get errors when your server starts up. - That's it! You can run
rails generate model foo
just like you can with ActiveRecord, and it'll generate a migration and a model file for you.
Using BCrypt
Honestly, the directions at the official bcrypt-ruby site are pretty good and don't require much explanation. You don't need to require "bcrypt"
in your model file(s), as it implies, but just uncomment the line mentioning bcrypt-ruby
that you probably already have in your Gemfile, unless you deleted it or have an older version of Rails. You'll also want to add , :require => 'bcrypt'
to the line to cause it to get loaded correctly. For reference, this looks like gem 'bcrypt-ruby', '~> 3.0.0', :require => 'bcrypt'
on my machine.
Hope this helps someone. It's not that complicated, but having a step-by-step guide is always a Good Thing. Would have helped me anyway!