Hello,
In rails, is it possible to pass arguments in when making a new object, and set some values accordingly?
For example, if I have a screen with a list of items, and a link to make a new item at the top. If I were to put a drop-down list of "item types" beside the "new" link, how would I pass that value to the new function on the items controller and have it set @item.item_type?
Edit after the reply from JC below
If in the controller I have the following:
@entry = Entry.new
if (params[:type])
@entry.entry_type = params[:type]
end
And the link to make a new object is
<%= link_to "Make new article", {:controller => '/dashboard/entries', :action => :new}, :type => 1 %>
then shouldn't the entry_type field in the new.html.erb form get set to 1?