You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm building a testing tool that gets, sets parameters for active_record resources, and it gets tripped up when working with my models that use active_record-acts_as. I was a little surprised to find that the parent object does not accept nested attributes for acts_as attributes. Example below
class NightReport < ActiveRecord::Base
acts_as :report
# with attribute :night_supervisor
end
class Report < ActiveRecord::Base
actable
# with attribute :date
end
$ NightReport.new( {:night_supervisor => "Nick B", :report_attributes => { :date => Date.today } )
$ ActiveRecord::UnknownAttributeError: unknown attribute: report_attributes
I understand this capability is a little strange ("In which scenario would you want to send attributes with report_attributes => {} ?" ). Tough to explain briefly, but it has to do with the fact that the night_report.attributes list does not include report.attributes.
Are there any adverse effects to adding this capability?
I'd be happy to write up the specs, submit pull request myself.
Thanks for the gem!
-Nick
EDIT: removed section about it appearing to already accept nested attributes
The text was updated successfully, but these errors were encountered:
I'm building a testing tool that gets, sets parameters for active_record resources, and it gets tripped up when working with my models that use active_record-acts_as. I was a little surprised to find that the parent object does not accept nested attributes for acts_as attributes. Example below
I understand this capability is a little strange ("In which scenario would you want to send attributes with report_attributes => {} ?" ). Tough to explain briefly, but it has to do with the fact that the
night_report.attributes
list does not includereport.attributes
.Are there any adverse effects to adding this capability?
I'd be happy to write up the specs, submit pull request myself.
Thanks for the gem!
-Nick
EDIT: removed section about it appearing to already accept nested attributes
The text was updated successfully, but these errors were encountered: