Permalink
Browse files

Fixed association= method work with relations.

write_attribute(attribute, model) does not work when the model is an ActiveRecord model and not an id.  Updated to use super instead.  Allows something like this: User.create(:account => Account.first)
  • Loading branch information...
1 parent 1842fb6 commit f504afe86fdc2191df70604181c19ae94a0913de @bnmrrs committed Feb 7, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/acts_as_tenant/model_extensions.rb
View
2 lib/acts_as_tenant/model_extensions.rb
@@ -59,7 +59,7 @@ def self.is_scoped_by_tenant?
define_method "#{association}=" do |model|
if new_record?
- write_attribute(association, model)
+ super(model)
else
raise "#{association} is immutable!"
end

0 comments on commit f504afe

Please sign in to comment.