Organization Question

Hey guys,

I’ve been playing w/ ruby for a few years now, and I finally have a
project that gives me an excuse to try out rails. I’ve been liking it a
lot, but it’s hard for me to grasp some of the concepts… specifically,
when do I need to make a new controller? I understand that different
tables need their own controller, but what about other things that are
not related to my database at all? I have created a ‘Settings’ page,
which controls various things for the view (how many entries per page,
sort order, etc.). Right now I’ve just been sticking all that code in
my ‘members’ controller… Is that right? Or should I make a seperate
Settings controller? Maybe stick it in the application controller?

Cameron M.

On 7/26/06, Cameron M. [email protected] wrote:

sort order, etc.). Right now I’ve just been sticking all that code in
[email protected]

Controllers themselves aren’t directly related to tables. That’s a

Baisically a controller should look after some logical section of your
It can interact with whatever models you need to achieve that. If there
another logical section of your app, make a new controller. Logical
sections may or may not map directly to your models.

As for your settings page (action) if it makes sense to put that in your
members controller, then keep it in there. It’s probably overkill to
make a
seperate controller for one action.

Application controller is where you would put code that you want in
controller. Most controllers inherit ApplicationController.

Also Agile Web Dev with Rails is a good book for getting to know Rails.
It’s well worth the read, especially since you already know Ruby.

Hope this helps


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs