connect Model not to Controller named as pluarize of model but to another Controller

6 views
Skip to first unread message

sukury47

unread,
Nov 18, 2010, 6:20:06 PM11/18/10
to Ruby on Rails: Talk
before ask you a my question,
i'm not good at english,
my description could be awakward;;

i'am practicing rails3.0 these days.
i've desinged RESTful app
but there is some question.

i'v e made "USER" model and "Login" controller.
login controller has 'add_user' and 'login' actions

and set route.rb up as below
resources:users controller =>'login'

but it's not working as i want to do
it doesn't match localhost:3000/login/user with login/login
and match that with user/login

what should I do?

ps. As i've practiced rails, i thought that
Controller not named as pluarize of model is bad structure of app
is it real? do you think so two?

Ar Chron

unread,
Nov 18, 2010, 9:16:00 PM11/18/10
to rubyonra...@googlegroups.com
sukury47 wrote in post #962465:

>
> ps. As i've practiced rails, i thought that
> Controller not named as pluarize of model is bad structure of app
> is it real? do you think so two?

Yes, it annoys me that there are so many examples for Rails like that.

In Rails, part of the beauty is the idea of convention over
configuration. Conform to the 90% case and life (and coding) is easy.

Yet so many "introductory" tutorials begin with a non-conforming case.

It wasn't until I really looked at ALL the code generated by a simple

rails generate scaffold person first_name:string last_name:string

that it all started to make real sense.

--
Posted via http://www.ruby-forum.com/.

Bala Paranj

unread,
Nov 19, 2010, 3:09:20 AM11/19/10
to rubyonra...@googlegroups.com
Controller is plural if you want all the RESTful actions including index. It is singular when you don't need index. Because when a resource is singular there is no need to list them.


--
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.




--
Cheers,
Bala
RoR Developer Now Available for Hire

Reply all
Reply to author
Forward
0 new messages