I don't know if it's bundler or some oddity that has to do with how Rails does things, but actually... it appears I was wrong. Running Sequel::Model.plugin :active_model doesn't appear to do anything inside Rails 3. In fact, unless I'm totally botching the way plugins work, it doesn't appear to work in Ramaze either or just running from IRB.
None of the class or instance methods become available to my models or to Sequel::Model itself. Am I just missing something obvious or what? For what it's worth, Sequel::Model.plugin :active_model returns nil. (Incidentally, auto loading works fine, but the Rails console handles the loading when items are initially called which is different than what I've been used to.) On Mar 22, 6:21 pm, cult hero <[email protected]> wrote: > Just in case someone comes combing through here, it looks like Rails 3 > does things a bit differently and does suggest using the > environment.rb as much. > > I created the file "config/initializers/sequel.rb" and it contains: > > DB = Sequel.connect(YAML.load(File.read('config/database.yml')) > [Rails.env]) > Sequel::Model.plugin :active_model > > And... that's it really. Now I just need to figure out how to handle > getting my models to autoload... > > On Mar 17, 6:50 pm, cult hero <[email protected]> wrote: > > > > > Excellent! Time to dig in. I haven't touched Rails in a couple years. > > > Thanks for all the help. > > > On Mar 17, 6:19 pm, Jeremy Evans <[email protected]> wrote: > > > > On Mar 17, 2:02 pm, cult hero <[email protected]> wrote: > > > > > 1. Does "Sequel::Model.plugin :active_model" load the plugin? (I > > > > haven't actually used any plugins yet!) > > > > Yes. > > > > > 2. Do I need to include that code somewhere in the Rails bootstrap > > > > process? (I don't want to have to do it explicitly for all my models.) > > > > Yes, I do so in environment.rb. > > > > > 3. When using sequel with Rails, how do I connect to the DB? Doesn't > > > > the databases.yml file only work for AR (or require a special plugin)? > > > > I do so in each environment file (development.rb, test.rb, > > > production.rb). You can use the database.yml if you want, but you > > > will have to parse the database.yml file yourself. > > > > Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en.
