Displaying 2 results from an estimated 2 matches for "new_child".
Did you mean:
netchild
2007 Jul 12
1
acts as list -- adding or moving new item to new location
right now i''m adding an item to my ''list'' but i''m unsure how to move
it to a certain spot in the list. specifically i want to put it at the
bottom of the list. i assumed that if i did something like
parent.children << new_child
then the ''position'' field in the child table would be given some
sensible default by rails but instead it''s set to NULL.
of course there''s a bunch of ugly ways i can make this work but i''m
wondering what would be the best/cleanest way...?
thanks in ad...
2012 Jul 20
8
sti_object.becomes(Parent) unexpectedly mutating the receiver
...r so I''m using the new
object returned by becomes as opposed to the mutated object.
Here''s an example of the undocumented behavior I was seeing:
class Parent < ActiveRecord::Base
end
class Child < Parent
end
child = Child.new
child.type # => ''Child''
new_child = child.becomes(Parent)
child.type # => ''Parent''
new_child.type # => ''Parent''
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To view this discussion on the web visit https://groups.googl...