snow4dayz
asked on
Rails 3 if Check View?
This must seem like a stupid question; however... I am new to rails and I am trying to figure out a conditional to check if the page being viewed is new.html.erb.
if page == new.html.erb then insert code.
if page == new.html.erb then insert code.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I realized a failed create will normally redirect to or render new, so you also need to set the variable in the create method.
There might be a blurring of concepts here. Did you perhaps mean, how do you know if the current action is "new"?
The new action by default renders new.html.erb.
A little more clarity about your question would be helpful. Where is this code going to be there to check this condition?
The new action by default renders new.html.erb.
A little more clarity about your question would be helpful. Where is this code going to be there to check this condition?