Re: Rails 3, HowTo - Pass a Setting to the Application.html.erb

Luke Cowell
Sat, 09 Oct 2010 01:39:08 -0000

Try doing this in your controller:
@padding = false

Then in your view you can test it like this:
<% if @padding %>
//do stuff here
<% end %>

I found it pretty helpful to work through this:
http://guides.rubyonrails.org/getting_started.html

Luke

On 2010-10-08, at 4:48 PM, nobosh wrote:

> Most of my views will required a wrapper of padding 10px,,, but a few
> will not...
>
> I was thinking of doing something like this in the view controller:
>
>
>     respond_to do |format|
>       format.html { render :layout => true, :padding =>
''false'' }
>
> And then in the application.html.erb have an IF to not add a padding
> class if :padding is false... But the above idea doesn''t work, the
> variable padding is not being passed.
>
> Any ideas? Or cleaner/smart solutions? thxs
>
> --
> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
>