Skip to content

Commit

Permalink
Fixed association= method work with relations.
Browse files Browse the repository at this point in the history
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
bnmrrs authored and ErwinM committed Feb 9, 2012
1 parent 6b67fcf commit 993fc35
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/acts_as_tenant/model_extensions.rb
Expand Up @@ -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! [ActsAsTenant]"
end
Expand Down

0 comments on commit 993fc35

Please sign in to comment.