-
-
Save kamal/948343 to your computer and use it in GitHub Desktop.
Extending a model in a Rails 3 (pre-3.1) engine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module BabyTalk | |
class Engine < Rails::Engine | |
config.to_prepare do | |
User.class_eval do | |
has_many :participations, :foreign_key => "participant_id" | |
has_many :rooms, :through => :participations | |
end | |
end | |
end | |
end |
I see that you mention that this is for pre-3.1... how would this code change in rails 3.2.2 for example?
I don't know. I haven't had the chance to build stuff with engines in
3.2.2. Try it out and let me know!
On Mon, Mar 19, 2012 at 11:27 PM, julesce ***@***.*** wrote:
I see that you mention that this is for pre-3.1... how would this code change in rails 3.2.2 for example?
---
Reply to this email directly or view it on GitHub:
https://gist.github.com/948343
##
Kamal Fariz
http://bitfluent.com
Mobile: +60123099143
Twitter: kamal
Ah don't worry, I figured out that the issue I had was unrelated to this. Thanks though :-)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this Kamal. Very uncanny ~ i was thinking about doing the same thing