Intermediate Rails: Understanding Models, Views and Controllers

I’m glad people liked the introduction to Rails; now you scallawags get to avoid my headaches with the model-view-controller (MVC) pattern. This isn’t quite an intro to MVC, it’s a list of gotchas as you plod through MVC the first few times.


This is a companion discussion topic for the original entry at http://betterexplained.com/articles/intermediate-rails-understanding-models-views-and-controllers/

I absolutely LOVED this article. Thank you so much!

Thanks for the kind words, I’m happy you enjoyed it!

Very informative and helpful. Thank you.

Thanks Nick :slight_smile:

Great post on rail. Look forward for your next article. and thanks for the hard work on writing this article. :slight_smile:

Thanks again Kalid…I am working with Code Igniter (a very nice PHP framework) at the moment and much of what you mention here is relevant as CI is similar to Rails framework.
Your articles are always informative but very easy to follow…keep on blogging :slight_smile:

C

Wow, thanks for the kind words – hearing that it helps people helps motivate me to keep blogging :slight_smile:

hi i enjoyed the read

An off-topic question - what tool did you use to make the diagram in the article?

Hi, I made the diagrams using PowerPoint 2007. I created a bunch of boxes and arrows and styled/colored them appropriately.

[…] Rails is built around the model-view-controller pattern. It’s a simple concept: separate the data, logic, and display layers of your program. This lets you split functionality cleanly, just like having separate HTML, CSS and Javascript files prevents your code from mushing together. Here’s the MVC breakdown: […]

[…] This article assumes the reader has knowledge in migrations and MVC. It also assumes the reader has MySQL or any other preferred database. For this article I will be using MySQL. […]

These are real ‘gems’ I say !! Thanks for the article…

Wow! This was extremely helpful, especially regarding the confusing inner workings of models. Thank you so much!

@Sunil & MSM: Thanks, glad you found it useful!

Great tutorial! And thank you for posting “burned me before” tips, i’m sure these would save a lot of my “beginner’s” time. Thanks!

Thanks! Yeah, I find many tutorials repeat the same info – it’s more interesting to say what they left out! :slight_smile:

[…] See Also: http://betterexplained.com/articles/intermediate-rails-understanding-models-views-and-controllers/ See Also: http://api.rubyonrails.org/classes/ActionController/Base.html  […]

[…] As with most languages/frameworks, it’s the “visibility” of variables that is important.  This is especially true with web-based applications.  Ruby is based on MVC (Model/View/Controller) architecture (see http://betterexplained.com/articles/intermediate-rails-understanding-models-views-and-controllers/ for a good MVC overview) […]