Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Designing Web Sites with Ruby on Rails

I'm just learning Ruby on Rails. I've read a few books, I've watched lots of Railscasts, I've looked at some examples.

However, when working on my first serious project with Rails, I've gotten hung up on how to properly implement some very basic web site features that most tutorials I've seen lack.

For instance: Navigation menus. Lots of tutorials on how to make a static one, but what about dynamic? If I want to make a navigation bar that's different across pages, how would I go about doing that?

I think that the best way to learn things like this is by seeing example code. Are there any good open sourced sites in RoR? Any example code that I can check out?

I guess my question really results to using MVC. The basic idea is really basic, and I understand that. But it seems that most applications have each part completely separate from each other... what if I want to, say, combine data from two models to display on the same page? To take the example I posed, if I have a NavModel and a PageModel, can my PageController access both models? I guess I'd assumed that a PageController can only access a PageModel, and none other. All examples I've seen seem to operate this way...is that a faulty assumption?

Or am I totally missing the point, and is that 'doing it wrong?'

like image 952
Steve Klabnik Avatar asked Oct 06 '08 17:10

Steve Klabnik


3 Answers

Open Source Rails is a repository of sites implemented in rails.

like image 75
Ken Avatar answered Oct 17 '22 21:10

Ken


Which books have you read? I think a better understanding of MVC and Rails would help you more in the long run than sample code, which you may be tempted to copy without understanding.

The problem you're describing isn't really different from finding and displaying any kind of data, which I'm sure you've seen covered in snippets on blogs, etc. (using partials and/or layouts is maybe the only difference).

If you haven't read them already, you should try Agile Web Development with Rails and The Rails Way.

There are also several books that take you through building a sample application that include commentary to make sure you understand what you're doing.

like image 3
palmsey Avatar answered Oct 17 '22 22:10

palmsey


This might help: Dynamic navigation menu using Menuitem model

like image 2
pookleblinky Avatar answered Oct 17 '22 22:10

pookleblinky