Can I use scenic without rails? #352
-
I have an older app that I've stuffed a half dozen views into (using raw #exec's in old migrations). I realize now that my schema.rb is missing these views. I want to rectify that, and that's what has led me to discover scenic. I thought that just adding "require 'scenic'" to my Rakefile and then running rake db:schema:dump would find the views that already exist in my database and include them in the newly generated schema.rb. But that doesn't appear to be happening. The new schema.rb is still the same as the old. Do I need to include some sort of initialization hook in my Rakefile? I am not using rails, just ActiveRecord and the standalone_migrations gem (plus foreigner too). Am I going to run into issues with scenic because I am not also using rails? Thanks in advance. -John |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You will also need to call Lines 16 to 24 in be70905 It's possible there are other dependencies on Rails that have inadvertently snuck in, so if you find any let us know here. |
Beta Was this translation helpful? Give feedback.
-
That did the trick. I included Thanks! |
Beta Was this translation helpful? Give feedback.
You will also need to call
Scenic.load
somewhere in order to load our ActiveRecord monkey patches (the only way something like Scenic can work, unfortunately). This is done automatically in Rails by virtue of the Railties code. You can see what that method does here:scenic/lib/scenic.rb
Lines 16 to 24 in be70905