Forum: Ruby on Rails App design help for a newbie (trying again)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E4e7d8a7b40e4c791c9263e42b8cc9a3?d=identicon&s=25 Michael Jurewitz (Guest)
on 2006-03-15 19:51
(Received via mailing list)
Hi there,

I'm working on a new student portal system using Rails for a large
university.  As part of this application, I plan on students being able
to customize their own calendar, collection of commonly used links,
aggregation of newsfeeds (from the university, student groups, etc), and
to see a listing of major announcements they should be aware of.

It seems to me, to make the most sense to have each of these components
handle their own logic. Optimally, one master controller would receive a
user's request for their particular page and would delegate to other
methods to render user-specific content.  To me, it seems like the
master controller should be delegating this task to other controllers so
that they can do a render partial of their portion of the page.  It
seems like it would be a bit messy and un-'rails-like' to force all of
this display logic into a single template and a single controller (but
maybe this is wrong?).

So a few questions:  Is this what you would recommend from a design
perspective?  Is it normal to have controllers in a Rails application
(if we were to go with the above) that are not meant to receive URL
requests?

Also, for the above which are user-specific, I'd like to do my best to
cache the result to improve performance.  Would the most effective way
to accomplish user-by-user caching for components specific to them be
through action-caching?

Many many thanks in advance for helping out a newcomer like myself.  I'm
very excited by Rails and look forward to getting off the ground with
it!


Michael Jurewitz
sinjin5@mac.com
E0c987f680cd640c14912ebfbf0f0f07?d=identicon&s=25 unknown (Guest)
on 2006-03-15 23:57
(Received via mailing list)
> So a few questions:  Is this what you would recommend from a design
> perspective?  Is it normal to have controllers in a Rails application
> (if we were to go with the above) that are not meant to receive URL
> requests?

I haven't had a chance to use it yet, but it sounds like what you're
describing is 'rails-like':
    http://wiki.rubyonrails.com/rails/pages/Components
    http://manuals.rubyonrails.com/read/chapter/71
E4e7d8a7b40e4c791c9263e42b8cc9a3?d=identicon&s=25 Michael Jurewitz (Guest)
on 2006-03-16 01:14
(Received via mailing list)
Many thanks!

Any opinions from anyone on my second question?

> Also, for the above actions which are user-specific, I'd like to do
> my best to
> cache the result to improve performance.  Would the most effective way
> to accomplish user-by-user caching for components specific to them be
> through action-caching?

To add to this, I suppose what I'm trying to figure out is if action-
caching caches the results of an action from a particular set of
parameters (if I change the input to the function, will it still
run?).  And if so, how do expire just a specific cache that
corresponds to one set of parameters?

So, show_calendar(user), for example.  If I do show_calendar(1) and
show_calendar(2), will they be uniquely cached from each other and if
so, how could I invalidate the cache for user id 2?


Michael Jurewitz
sinjin5@mac.com
Ef0db53920b243d6758c2f6b1306df0d?d=identicon&s=25 Steve Ross (cwd)
on 2006-03-16 01:32
(Received via mailing list)
Check out
http://scottstuff.net/blog/articles/2005/09/28/rai...,
which introduces caches_action_with_params. This seems like what you're
after.
--
View this message in context:
http://www.nabble.com/App-design-help-for-a-newbie...
Sent from the RubyOnRails Users forum at Nabble.com.
This topic is locked and can not be replied to.