hello,
I am just beginning to understand how ruby on rails works. I have the
following problem:
In the controller I would like to create an array of model objects:
@arr_journeys = Array.new(3, Journey.new)
In the view I would like to do the following:
<% for i in 1..4 %>
<%= text_field(@arr_journeys[i], :quantity, :size => 6 %)>
<% end>
Is there any chance to do it like this? Do I have to write my own
helpers?
Greets & thanks
Sven
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
you almost got it @arr_journeys = ... <% @arr_journeys.each do |journey| -%> ... <% end -%> On 7/18/07, sven <sven.bohnstedt-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> > hello, > > I am just beginning to understand how ruby on rails works. I have the > following problem: > > In the controller I would like to create an array of model objects: > > @arr_journeys = Array.new(3, Journey.new) > > In the view I would like to do the following: > > <% for i in 1..4 %> > <%= text_field(@arr_journeys[i], :quantity, :size => 6 %)> > <% end> > > Is there any chance to do it like this? Do I have to write my own > helpers? > > Greets & thanks > > Sven > > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Maybe Matching Threads
- Renaming Journey and avoiding libraries with common noun names
- form questions
- Rails 3 Errno::EAFNOSUPPORT: Address family not supported by protocol - socket(2)
- Rails 3 Errno::EAFNOSUPPORT: Address family not supported by protocol - socket(2)
- Problem with length of array while calling C from R