Displaying 2 results from an estimated 2 matches for "the_parent".
2008 Feb 21
7
looping through a list
what is the proper way to loop through a list in a rails view (assuming
that you need to check if it is empty or not)
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2006 Jun 23
0
adding action after a belongs_to assignment
What is the best way to add action after a belongs_to assignment? (Just
like ''after_add'' in has_many assignment).
I see that there is no callbacks for belongs_to.
I have tried overriding parent= :
alias :parent_before_mod= :parent=
def parent=(the_parent)
parent_before_mod = the_parent
if save
# my actions here
end
end
but when I tried to assign parent, parent_id was not changed.
Can someone help?
class Company < ActiveRecord::Base
has_many :children, :class_name => ''Company'', :foreign_key =>
''par...