Skip to content

[Feature Request] Adding accepts_nested_attributes_for actable model #73

@brunzino

Description

@brunzino

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions