Or you could add something like

<body class="<%= yield(:body_class) %>">
  … your stuff
</body>

and set a conditional css class which can handle the padding. Set the
class with content_for()

On Oct 9, 10:32 am, "Robert Pankowecki (rupert)"
<[email protected]> wrote:
> In my opinion you should have 2 layouts.
> * application,
> * padding.
>
> The `padding' layout should be nested inside application and
> (according to its name) add some padding :-). Look here about how to
> do it in rails 2 and 
> 3:https://rails.lighthouseapp.com/projects/8994/tickets/5305-rails3-rc-...
>
> With that you could setup layout per every action.
>
> layout :application
> layout :padding, :only => [:new].
>
> The second way of doing this:
>
> Add one more stylesheet in every view that needs padding:
>
> #application.html.erb layout
>
> <head>
>   <%= yield :head %>
> </head>
>
> #new.html.erb
> content_for(:head) do
>   stylesheet_link_tag 'padding'
> end
>
> You could abstract it into helper method and use as simple as:
> #new.html.erb
> <%= padding() %>
>
> Third way is to create helper that would be used this way:
>
> <%= padding do %>
>   create your content here
> <% end %>
>
> I wouldn't bother controller with such a minor change in view layer so
> I prefere keeping padding in views instead changing layout on the
> controller side.
>
> Robert Pankowecki

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to