Link to home
Start Free TrialLog in
Avatar of snow4dayz
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.
ASKER CERTIFIED SOLUTION
Avatar of johanntagle
johanntagle
Flag of Philippines image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I realized a failed create will normally redirect to or render new, so you also need to set the variable in the create method.
Avatar of nikhilmenon
nikhilmenon

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?