I’m having some trouble working out where/when I can define template
I have a standard.rhtml layout template which is used across the
application as the main xhtml wrapper.
Inside there is some code like this:
<div id="<%= @layout_style %>"> <%= @content_for_layout %> </div>
Now content_for_layout always works fine, but @layout_style seems to
only work if I set it either within a method in a specific controller
@layout_style = 'content'
or when I define it at the top of the appropriate @content_for_layout
<% @layout_style = 'index' %>
I was hoping that I would be able to set variables such as this globally
within the application.rb controller.
Or, am I just going about this in completely the wrong way ?
I am also having trouble writing (what I think are called) overload
methods within the model. I have a TIME column named running_time in my
Film model and I only ever want it to look like this e.g.: ‘5:32’ rather
than the fully rendered datetime that is returned by default. So I
define a method in the model to override the default:
def running_time # strftime code here end
but whenever I try and reference the value of running_time from withing
the method I get a stack overload.
What would be the best way to do what I initially though should be done
It’s taking me a while to get the idioms and the heuristics for RoR…
Thanks in advance for any help available!
I do things for love or money
+44 (0)7941 219 501
aim:oulalipo | yahoo:tachekent