Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Mass assignment with inheritance column #9

Merged
merged 1 commit into from Jan 16, 2013

Conversation

Projects
None yet
2 participants
Contributor

diminish7 commented Jan 7, 2013

Related to rails commit:
rails/rails@89b5b31

which adds STI support to init and building associations, allowing
you to do

  • BaseClass.new(:type => "SubClass")
  • parent.children.build(:type => "SubClass")
  • parent.build_child(:type => "SubClass")

to initialize an STI subclass.

This commit ensures that a protected inheritance column is still
respected during init

Owner

pixeltrix commented Jan 16, 2013

@diminish7 is it possible to add some negative assertions, e.g. specifying a type that isn't a subclass of the model. I know there are some tests for it in the main rails repository I just want to make sure we don't break anything here.

@diminish7 Jason Rush Mass assignment with inheritance column
Related to rails commit:
rails/rails@89b5b31

which adds STI support to init and building associations, allowing
you to do

* BaseClass.new(:type => "SubClass")
* parent.children.build(:type => "SubClass")
* parent.build_child(:type => "SubClass")

to initialize an STI subclass.

This commit ensures that a protected inheritance column is still
respected during init
a1f0f71
Contributor

diminish7 commented Jan 16, 2013

@pixeltrix Sure: Just amended the commit to include those tests. Thanks!

@pixeltrix pixeltrix added a commit that referenced this pull request Jan 16, 2013

@pixeltrix pixeltrix Merge pull request #9 from diminish7/inheritance_column_support
Mass assignment with inheritance column
c8aa047

@pixeltrix pixeltrix merged commit c8aa047 into rails:master Jan 16, 2013

1 check passed

default The Travis build passed
Details
Owner

pixeltrix commented Jan 16, 2013

@diminish7 thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment