Hi Simone,

In your "activate" and "block" actions can't you just use the common
"update" action, just passing the necessary parameters?

It would be as simple as receiving an "user[ativated] = false" from
the request and you could probably reuse the already implemented
"update" action in your controller. I've killed many unecessary named
routes by using the already implemented actions and parameters.

-
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)



On Fri, Jan 23, 2009 at 5:10 PM, Simone Guerra
<[email protected]> wrote:
>
> Hi,
>
> I recently started using rest for building some new rails apps. I find
> it great and clean, but when I started a big project some days ago some
> doubts come to my mind.
>
> First of all, after implementing the user management and authentication
> system (which in my case is quite complex) I noticed my routes.rb file
> was already fairly big. It seemed to be reasonable to me since I have to
> perform lot of operations on the users of my app, especially form the
> admin namespace, but the fact that I just started the project and I
> already have this huge routing files scares me.
>
> Moreover, I'm used to have a lot of helper actions to handle calls to
> link_to_remote (used for example to dynamically change form fields based
> on user input). Some of these calls can be handled by the classic REST
> actions with respond_to, but for others it just makes sense to have a
> custom action, and this forces me to insert a custom route every time in
> my routes.rb file.
> The same applies to small actions like "activate" or "block" for users.
> I know that in the REST way of doing things this could be done by
> creating separate controllers, but this seems stupid to me (especially
> in my case, I'll be force to create one such controller for each user
> type, with subsequent route definition).
>
> I hope someone can help me clarify those doubts.
>
> Thank you in advance (and sorry for the english, it's not my native
> language)
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>

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

Reply via email to