Browse the Ruby on Rails Community.

You are here: Forums Ask a Rails expert Is Rails HMVC ?...

Replytotopic

Is Rails HMVC ?

Posted in Forums : Ask a Rails expert

 
Profile

Authority 12
Posting Rating 0
Sign in to rate this post

We know Rails follows MVC design pattern. If we consider independent partials which is rendered from a helper(it may call any model) method then rails will be cosidered HMVC?

Browser – Controller = Model
                  |
                View(Lets say it browser-calling helper method) – Helper(controller) = Model
                                                                           |
                                                                   Independent Partial view

In the Figure above:
With the same request from browser, if Helper(using model again) method is called(from view) which invokes rendering an independent partial file then entire this Rails system may be consider HMVC??

I am not sure.Please suggest me about this

 
Wojciech-kruszewski-133x100

Authority 37
Posting Rating 70
Sign in to rate this post

Rails is an MVC framework i.e. it was designed to make building MVC applications easier.

You can write applications using Ruby on Rails without following this pattern – this would mean your application is not MVC, this wouldn’t change MVC nature of Rails as a framework.

Can pattern you described be called HMVC? Call it whatever you want – you invented it! You just need to convince everybody to use this name (-:

But seriously, helper calls a model and renders a view… is that what you mean? This sounds like “components” (in general, not the deprecated Rails feature). Here’s one implementation: http://cells.rubyforge.org/

Not that I like this idea – I somehow always found a nice way to do things MVC-way. Can you give an example where MVC is not feasible?

 
436907d871deeaa04aa3f0cb4548587e

Authority 50
Posting Rating 55
Sign in to rate this post

From your diagram, it appears that what you call a helper might be an example of the Presenter pattern.

A Presenter acts as an intermediary between the View and the Model. Unlike the conventional Helper in Rails, the Presenter is object oriented in nature and can be used to aggregate several models into a single entity, which can be helpful if you’re displaying several model instances or processing multiple form objects in a single controller action.

The Presenter pattern was never formalized into Rails, but rolling your own is no problem, and I’ve done this in several projects. Jay Fields has an old blog post that describes this pattern in some detail:
http://blog.jayfields.com/2007/03/rails-presenter-pattern.html

 
Profile

Authority 37
Posting Rating 0
Sign in to rate this post

Please check out http://www.rogerwilco.ru/2012/02/how-to-implement-hvmc-in-rails.html

Replytotopic

Other Recent Topics

Ask a Rails expert : nested application ApplicationController get called intead of children::ApplicationController

Ask a Rails expert : Best way to structure a database for a large/static dataset

Ask a Rails expert : Ruby Developer (ROR) - Scottish based (Remote working from within the UK)

Ask a Rails expert : Above Ground Pool Supplies

Ask a Rails expert : How to get url params in observer or model in Rails 3.1

Ask a Rails expert : What can persuade you to hire Junior Ruby devs with significant PHP experience?

Ask a Rails expert : What industry value does the Ruby or Rails Certification currently have?

Ask a Rails expert : Louis Vuitton Damier Azur Canvas specially sale ( www.salecheaplouisvuitton.com )

Ask a Rails expert : ·How to check errors/puts statements from ruby files which are under cronob

Ask a Rails expert : Louis Vuitton cheap Soft Sided Luggagespecial offer( www.salecheaplouisvuitton.com )

Formatting Help
  • *bold*       _italics_      
    bq. (quotes)
  • "DSC":http://www.dsc.net
  • * or # (lists)
or cancel