App design help for a newbie (trying again)


#1

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 J.
removed_email_address@domain.invalid


#2

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


#3

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 J.
removed_email_address@domain.invalid


#4

Check out
http://scottstuff.net/blog/articles/2005/09/28/rails-caching-presentation,
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-(trying-again)-t1286510.html#a3427645
Sent from the RubyOnRails Users forum at Nabble.com.