ruby - If action_name Rails -
i'm using if action_name define layout, example
layout :layout_by_action_name def layout_by_action_name if action_name == 'new' "layout_file" else "application" end end
how can add action name new
, such edit
. tried:
layout :layout_by_action_name def layout_by_action_name if action_name == 'new' && 'edit' "layout_file" else "application" end end
but it's not working. ideas?
try:
if action_name == "new" or action_name == "edit"
or:
if ["new", "edit"].include? action_name
Comments
Post a Comment