Forum: Ruby on Rails Creating new object

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
8e9784d64e195904153512fd08ebe73f?d=identicon&s=25 Chewbie (Guest)
on 2007-01-27 15:28
(Received via mailing list)
A newbie question here :
I don t get how to create a new object without using the magical
line : @your_object =[: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.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])
          @case.x = i
          @case.y = -j
          @case.grid_id =
            flash[:notice] = 'Case' + i +' '+ j + ' was successfully

But it return an error : "wrong number of arguments (0 for 1)"
Hope you can help me.
39876f4e9c86360d4d253b11cfd136f3?d=identicon&s=25 Alex Pivtorak (1nfected)
on 2007-01-27 15:44
>           @case.y = -j

Probably here should be number with '+'. Try to take this '-' before 'j'
This topic is locked and can not be replied to.