Skip to content

Allow :without_protection on parent.child.build(:type => 'MyStiClass') #61

@jebw

Description

@jebw

Currently if a model is using attr_protected (instead of attr_accessible) - its impossible to use the Rails 4.0 inheritance syntax for generating Single Table Inheritance classes.

parent_class.child_association.build({ :type => 'MyStiType' }, :without_protection => true)

The without_protection => true option is honoured by attr_accessible, but the subclass_for_attributes? in inheritance.rb ignores this option, so still does checks against the attr_protected attributes + the defaults of 'id' and 'type'.

This means the type attribute cannot get assigned, removing the ability to create STI models.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions