Michael Jurewitz
2006-Mar-15 18:48 UTC
[Rails] App design help for a newbie (trying again)
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 -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2413 bytes Desc: not available Url : http://wrath.rubyonrails.org/pipermail/rails/attachments/20060315/a992c6b4/smime-0001.bin
brabuhr@gmail.com
2006-Mar-15 22:56 UTC
[Rails] App design help for a newbie (trying again)
> 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?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
Michael Jurewitz
2006-Mar-16 00:13 UTC
[Rails] App design help for a newbie (trying again)
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 On Mar 15, 2006, at 2:55 PM, brabuhr@gmail.com wrote:> > 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 > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2413 bytes Desc: not available Url : http://wrath.rubyonrails.org/pipermail/rails/attachments/20060316/36aa50ae/smime.bin
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-%28trying-again%29-t1286510.html#a3427645 Sent from the RubyOnRails Users forum at Nabble.com.