okay, so ive got a view page of ''columns'', each comprised of a
name and
code.
ive got a button to ''add columns'' and i want it to pass it an
integer
parameter so i can set up the default number of boxes for adding
so in my view ive got
= link_to "Add columns", new_column_path, :number => 5
and in my controller:
def new
@columns = []
params[:number].to_i.times { @columns << Column.new }
end
so basically i just want to read number passed from the link. there will
be links from other places that have different values passed (not 5)
what am i doing wrong? or is there a better way of approaching it?
--
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
On 6 January 2012 01:39, miek test <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> okay, so ive got a view page of ''columns'', each comprised of a name and > code. > ive got a button to ''add columns'' and i want it to pass it an integer > parameter so i can set up the default number of boxes for adding > > so in my view ive got > > = link_to "Add columns", new_column_path, :number => 5Try link_to "Add columns", new_column_path( :number => 5 ) Colin -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.