Hi all, How do I know the name of the action currently invoked inside RHTML template? I need to make a text_field readonly when the action is ''edit'' and readwrite when the action is ''new''. Tq, John
Hi John, John Indra wrote:> How do I know the name of the action currently invoked inside RHTML > template? I need to make a text_field readonly when the action is ''edit'' > and readwrite when the action is ''new''.I may be completely misunderstanding your question, but... In Rails, you will have a seperate view (RHTML template) for each controller action. So you''ll have a ''new.rhtml'' and an ''edit.rhtml'' and you''ll just include a contentEditable=false attribute on the field in your ''edit.rhtml''. hth, Bill
John Indra wrote:> How do I know the name of the action currently invoked inside RHTML > template? > I need to make a text_field readonly when the action is ''edit'' and > readwrite when the action is ''new''.<% if controller.action_name == ''edit'' -%> etc. -- Ray
Ray Baxter wrote:> <% if controller.action_name == ''edit'' -%>Thanks Ray! Another way I managed to find myself is: <% if params[:action] == ''edit'' -%>> RayJohn -- Posted via ruby-forum.com.