css - Admin changes themes -
i making web-app admin can change themes. have 2 css files, style.css , style2.css. in application_helper have
def set_themes(themes) @themes = themes end in application_controller have
helper_method :themes and put on application.html.erb
<%= stylesheet_link_tag set_themes %> and in admin index.html write select_tag, :
choose themes: <%= select_tag(:themes, options_for_select({"black" => "compiled/styles", "green" => "compiled/styles2"}), :onchange => 'set_themes(this.options[this.selectedindex].value)') %> and got argumenterror. know problem how used onchange, because when change manually application_helper, works. have no idea how call methode application_helper clicking select_tag.
can me? thank youu :-)
your definition of set_themes method requires helper method passed 1 argument, in line:
<%= stylesheet_link_tag set_themes %> you appear invoking without arguments (i.e., equivalent calling set_themes()). should change call set_themes in line above else has proper arguments, or direct instance variable, etc.
Comments
Post a Comment