Patrick J. Kattau
2007-Nov-04 21:55 UTC
[Masterview-users] Using multiple models with masterview
Hi, I''m fairly new to rails and masterview. I''m sure this answer was probably staring me in the face already but all screencasts of masterview that I have seen to date only deal with one table and one model. What about using multiple tables and models? I was trying to add another link under ''tasks'' that pointed to a different controller and action but it didn''t seem to work. Any guidance would be appreciated. Regards, Patrick -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/masterview-users/attachments/20071104/5099798b/attachment.html
Jeff Barczewski
2007-Nov-05 20:12 UTC
[Masterview-users] Using multiple models with masterview
On Nov 4, 2007 3:55 PM, Patrick J. Kattau <pkattau at gmail.com> wrote:> Hi, I''m fairly new to rails and masterview. I''m sure this answer was > probably staring me in the face already but all screencasts of masterview > that I have seen to date only deal with one table and one model. What about > using multiple tables and models? I was trying to add another link under > ''tasks'' that pointed to a different controller and action but it didn''t seem > to work. Any guidance would be appreciated. >Patrick, In general most anything that you can do with Rails or ERB/rhtml we should be able to do with MasterView since we ultimately output ERB anyway. So the answer is yes, you can work with multiple tables, models, and controllers with MasterView. In the example of using multiple controllers with your links, you simply add the controller property into the directive just like you would do if using the Rails link_to helper. For example: <a mv:link_to=":controller => ''admin'', :action => ''new''">New product</a> This allows you to access a different controller than the current one. In general think about how you would do it in ERB or with native Rails helpers and that is what you typically want to do with MasterView. Blessings, Jeff -- Jeff Barczewski, MasterView core team Inspired Horizons Ruby on Rails Training and Consultancy http://inspiredhorizons.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/masterview-users/attachments/20071105/680316ad/attachment.html