rubyonrailsin

A Ruby and Rails talk

Wednesday, March 10, 2010


Re: [Rails] How to make an array available to all views.

by rubyonrailsin 0 comments



Share this post:
Design Float
StumbleUpon
Reddit

On 10 March 2010 12:10, Andy Jeffries <andyjeffries@gmail.com> wrote:
>> If it is literally something as simple as MyArray.all I believe there
>> is nothing wrong with calling the model direct from the view.
>
> It's dirty, horrible, bad form, breaks the separation of layers...

I don't know what you mean by dirty, it saves several lines of code
and when looking at the view code it is easier to see what is
happening than to see a variable that has to be hunted for in a filter
somewhere to find out what it is.

It does not break the separation of layers any more than calling an
instance method of a model does when using something like
<%= @person.name %>

> Don't call the model from the view!

@person.name is a model call from the view

Colin

--
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

Subscribe feeds via e-mail

Blog Archive