I have spent half the day working, which is trying to track it down in AR. Looking at the model setup such as:
class publication & lt; ActiveRecord :: Base has has_many: unsubscribed class membership & lt; ActiveRecord :: Base is_to: publication belong_to: user end
In the administrator,
@new_subscription = publication.subscriptions.create (user: @ct_user) { | R | ...}
Works perfectly in development mode, it is implemented after the server is started for the first time. For the second time though, it throws an error from
~ / .rvm / gems / ruby-1.9.1-p378 / gems / activerecord-2.3.8 / lib / active_record / base.rb : 2906: In the 'Block of Assign_Editables': ActiveRecord :: UnknownAttributeError: Unknown Attribute: User
Settings
config.cache_classes = true
The problem disappears inconfig / environment / development.cfg
in
.
Association attr_accessor
a related_to
association, and why will it work for the first time, but will not be applicable for the second time? It looks like the accuser is not being defined when the class is loading and loads between requests? More information: publication
and membership
are using STI, and organizations are defined on the base classes, if they do not make any difference. This is Ruby 1.9.1 and Rail / AR 2.3.8
Thank you for any clue.
Try experimenting.
Comments
Post a Comment