Ruby on Rails Friday, July 30, 2010

[Please quote when replying. It makes the discussion easier to follow.]

winter heat wrote:
> let's assume class1, 2, and 3, etc all have their functions, so we need
> all of them.

But do you need them nested, or can they be on the same element?

>
> the 3rd code piece is what we want: class 3 should be nested inside of
> class2, which is what this question is all about.
>
> why is using "request.xhr?" inside of a view not a good idea?

Because the view shouldn't know anything about the nature of the
request. The view should only know what the controller tells it.

> if so,
> you should only use it in controller and why?

Because according to Rails MVC design principles, views should be as
dumb as possible. The request object is really none of the view's
business -- all the view should do is display the data the controller
passes it.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org
--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment