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 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 I. 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 I. 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 B. wrote:
<% if controller.action_name == ‘edit’ -%>
Thanks Ray!
Another way I managed to find myself is:
<% if params[:action] == ‘edit’ -%>
Ray
John
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs