“new” actions in nested rails resources

def new
@my_model = MyModel.new
end

# vs.

def new
@my_model = @my_parent_model.my_models.build
# gives you access to parent properties
# (useful e.g. in views)
end


Leave a Reply

Formatting: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>