I am trying to pass a model attribute to a view, after successfully setting it to a new value from within the action in my controller. But this variable is always zero when it falls into the view, so I can not use it to conditionally display material. I must add that this attribute is not a field in the database. What am I missing / doing wrong?
Here is the code in my model:
attr_accessor :mode
def mode
@mode
end
def mode=(val)
@mode = val
end
... in the controller:
@report.mode = "t"
redirect_to edit_report_path(@report)
... and in my opinion:
<%= build_report(@report.mode) %>
... but this helper method never gets the variable that I just set in the controller. This is zero. What gives? Clearly, I missed something basic, because it looks like it should be simple. Any insight would be greatly appreciated. Thanks.