A newbie question here :
I don t get how to create a new object without using the magical
line : @your_object = Object.new(param[:object])
I have a grid with a size, I would like to create the case associate
to the grid at the creatin on the grid, I have try the following in
the grid controller:
def create
@grid= Grid.new(params[:grid])
((@grid.taille)-1).times do |i| //don t pay
attention to the loop, and the attribution of corrdinate, it s not a
square grid
((@grid.taille)-1).times do |j|
@case = Case.new(params[:case])
@case.x = i
@case.y = -j
@case.grid_id = @grid.id
if @case.save
flash[:notice] = ''Case'' + i +''
''+ j + '' was successfully
created.''
end
end
..
end
But it return an error : "wrong number of arguments (0 for 1)"
Hope you can help me.
Thx
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---