I''m reading a book "Beginning Ruby on Rails" I made an table, and tried to make an Model class. But it doesn''t work. I made the table as below. mysql> show columns from books ; +-------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------+--------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | name | varchar(80) | NO | | NULL | | | description | text | NO | | NULL | | | price | decimal(8,0) | NO | | NULL | | +-------------+--------------+------+-----+---------+----------------+ 4 rows in set (0.07 sec) I typed to make an model class as below. G:\web_apps\library>ruby script/generate scaffold Book Manage exists app/models/ exists app/controllers/ exists app/helpers/ exists app/views/books exists app/views/layouts/ exists test/functional/ exists test/unit/ exists test/unit/helpers/ exists public/stylesheets/ wrong number of arguments (1 for 2) -- 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.
Colin Law
2010-Feb-16 13:51 UTC
Re: wrong number of arguments (Wrox Beginning Ruby On Rails)
On 16 February 2010 11:54, seafront <seafront-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m reading a book "Beginning Ruby on Rails" > I made an table, and tried to make an Model class. But it doesn''t > work. > > I made the table as below. > > mysql> show columns from books ; > +-------------+--------------+------+-----+---------+----------------+ > | Field | Type | Null | Key | Default | Extra | > +-------------+--------------+------+-----+---------+----------------+ > | id | int(11) | NO | PRI | NULL | auto_increment | > | name | varchar(80) | NO | | NULL | | > | description | text | NO | | NULL | | > | price | decimal(8,0) | NO | | NULL | | > +-------------+--------------+------+-----+---------+----------------+ > 4 rows in set (0.07 sec) > > > I typed to make an model class as below. > > G:\web_apps\library>ruby script/generate scaffold Book ManageWhat is ''Manage'' supposed to do? You might be using an out of date tutorial, I suggest having a look at the rails guide on Getting Started at http://guides.rubyonrails.org/. This includes the use of scaffolding. Also work through the guides on ActiveRecord Associations and Debugging, and most of the rest in fact. Colin Colin> exists app/models/ > exists app/controllers/ > exists app/helpers/ > exists app/views/books > exists app/views/layouts/ > exists test/functional/ > exists test/unit/ > exists test/unit/helpers/ > exists public/stylesheets/ > wrong number of arguments (1 for 2) > > -- > 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@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Pardee, Roy
2010-Feb-19 16:57 UTC
RE: wrong number of arguments (Wrox Beginning Ruby On Rails)
The scaffold generator takes a model name, followed by an optional space-delimited list of field name:type specs. So you might say: script/generate scaffold Book name:string description:text price:decimal Or you can leave off the list of field names (in which case you don''t get much in your views or the migration). But the generator doesn''t know what to do with that trailing "Manage". Note that since you already have a table created, you''ll likely want to delete the migration that the scaffold generator creates for you. Also--bonus unsolicited advice: you''re best off using the exact version of rails that your author specifies. HTH, -Roy -----Original Message----- From: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org [mailto:rubyonrails-talk@googlegroups.com] On Behalf Of seafront Sent: Tuesday, February 16, 2010 3:55 AM To: Ruby on Rails: Talk Subject: [Rails] wrong number of arguments (Wrox Beginning Ruby On Rails) I''m reading a book "Beginning Ruby on Rails" I made an table, and tried to make an Model class. But it doesn''t work. I made the table as below. mysql> show columns from books ; +-------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------+--------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | name | varchar(80) | NO | | NULL | | | description | text | NO | | NULL | | | price | decimal(8,0) | NO | | NULL | | +-------------+--------------+------+-----+---------+----------------+ 4 rows in set (0.07 sec) I typed to make an model class as below. G:\web_apps\library>ruby script/generate scaffold Book Manage exists app/models/ exists app/controllers/ exists app/helpers/ exists app/views/books exists app/views/layouts/ exists test/functional/ exists test/unit/ exists test/unit/helpers/ exists public/stylesheets/ wrong number of arguments (1 for 2) -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. GHC Confidentiality Statement This message and any attached files might contain confidential information protected by federal and state law. The information is intended only for the use of the individual(s) or entities originally named as addressees. The improper disclosure of such information may be subject to civil or criminal penalties. If this message reached you in error, please contact the sender and destroy this message. Disclosing, copying, forwarding, or distributing the information by unauthorized individuals or entities is strictly prohibited by law. -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.