extjs / mvc

Ruby ExtJS Tools
http://www.extonrails.com
MIT License
118 stars 50 forks source link

extjs_associations does not count with user-defined foreign_key #2

Open durchanek opened 15 years ago

durchanek commented 15 years ago

Something like this will break:

belongs_to :created_by, :class_name => 'User', :foreign_key => :created_by_user_id

I fixed it by changing code on lib/model/active_record.rb:63 to

:foreign_key => assn.options[:foreign_key] || assn.association_foreign_key
durchanek commented 15 years ago

This bug still persists in 0.3.5

christocracy commented 15 years ago

Can you implement a test for this send send me a pull request?

durchanek commented 15 years ago

Never done this before, but I knew I will have to start sometime :-)

christocracy commented 15 years ago

Have a look at test/model_test.rb to get an idea.