Controllers without Models

Hi,

Newbie here…Is it possible to create a controller without a model?

Example: a CRM app has a “calendar” type of page. I’m thinking the URL
would be /calendar/action. There is no dedicated “calendar” table in
the d/b but rather a collection of calls, tasks, meetings, etc. Is it
as simple as creating a calendar controller? I’ve tried but keep
getting “recognition failed…”.

I’m guessing a SQL view can be created and the model gen’d off of that
but am curious about other possibilities.

Thanks!

Shawn

Of course, controllers are not “hard linked” with models, 1 controller
can have 0-N models and 1 model can have 0-N controllers, they are
completely independant.

shware1 wrote:

Hi,

Newbie here…Is it possible to create a controller without a model?

Example: a CRM app has a “calendar” type of page. I’m thinking the URL
would be /calendar/action. There is no dedicated “calendar” table in
the d/b but rather a collection of calls, tasks, meetings, etc. Is it
as simple as creating a calendar controller? I’ve tried but keep
getting “recognition failed…”.

I’m guessing a SQL view can be created and the model gen’d off of that
but am curious about other possibilities.

Thanks!

Shawn

Example: a CRM app has a “calendar” type of page. I’m thinking the URL
would be /calendar/action. There is no dedicated “calendar” table in
the d/b but rather a collection of calls, tasks, meetings, etc. Is it
as simple as creating a calendar controller? I’ve tried but keep

…if all you care about is creating the URL /calendar/action, then you
don’t need to even create a new controller … you just need to set it
in
calander-rails-app/config/routes.rb
to something like this:

map.connect “/calendar/:action/:id”, :controller =>
‘the-one-u-are-using’, :action => ‘action’, :id => ‘id’

or however else you want to configgg it. this will use the controller
the-one-u-are-using.rb

hih,

s

Hi –

On Mon, 15 Jan 2007, shware1 wrote:

Hi,

Newbie here…Is it possible to create a controller without a model?

Example: a CRM app has a “calendar” type of page. I’m thinking the URL
would be /calendar/action. There is no dedicated “calendar” table in
the d/b but rather a collection of calls, tasks, meetings, etc. Is it
as simple as creating a calendar controller? I’ve tried but keep
getting “recognition failed…”.

That’s got to be some other problem. You can definitely create
controllers that aren’t named the same as models. Can you give more
details about the error you’re getting?

David


Q. What is THE Ruby book for Rails developers?
A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black)
(See what readers are saying! http://www.rubypal.com/r4rrevs.pdf)
Q. Where can I get Ruby/Rails on-site training, consulting, coaching?
A. Ruby Power and Light, LLC (http://www.rubypal.com)

Thanks for the responses.

I was trying to createa a test controller and finally realized that it
was a file naming issue (testcontroller.rb vs tests_controller.rb).

More noob questions to follow in separate threads :slight_smile:

Thanks again!

Shawn