problem with submit button in rails 3

32 views
Skip to first unread message

Pab

unread,
Sep 21, 2011, 10:49:21 AM9/21/11
to Ruby on Rails: Talk
hi,

i am using <%= s.submit 'Product save' %>
when i click it, following error appears

" Routing Error

uninitialized constant ProductsController"


could any one provide me solution ?


thanks,
-pab

Tim Shaffer

unread,
Sep 21, 2011, 10:57:59 AM9/21/11
to rubyonra...@googlegroups.com
Do you have a controller named ProductsController?

Pab

unread,
Sep 21, 2011, 11:29:22 AM9/21/11
to Ruby on Rails: Talk

hi
well i am have having contoller named ProductController
but its asking for ProductsController
i don't know how to over come this problem?


thanks,
-pab

Tim Shaffer

unread,
Sep 21, 2011, 11:35:55 AM9/21/11
to rubyonra...@googlegroups.com
It's Rails convention that controllers should use the plural name of the model, like ProductsController

You could probably make it work by using the singular name of the model, but it would go against convention and wouldn't be very easy to maintain.

Everaldo Gomes

unread,
Sep 21, 2011, 11:35:17 AM9/21/11
to rubyonra...@googlegroups.com
Hi,

rename your controller from ProductController to ProductsController. In Rails, the convention is the plural in controller's name.

Best Regards,
Everaldo
 

thanks,
-pab

--
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 rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.


Colin Law

unread,
Sep 21, 2011, 11:50:48 AM9/21/11
to rubyonra...@googlegroups.com
On 21 September 2011 16:35, Everaldo Gomes <everald...@gmail.com> wrote:
>
>
> On Wed, Sep 21, 2011 at 12:29 PM, Pab <prabu...@gmail.com> wrote:
>>
>> hi
>>   well i am have having contoller named ProductController
>> but its asking for ProductsController
>> i don't know how to over come this problem?
>>
> Hi,
> rename your controller from ProductController to ProductsController. In
> Rails, the convention is the plural in controller's name.

and of course the file should be products_controller.rb and the model
should be Product in products.rb and the table name products.

Colin
--
gplus.to/clanlaw

Reply all
Reply to author
Forward
0 new messages