Guest

Untitled

By: a guest on Jan 28th, 2012  |  syntax: None  |  size: 0.62 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1. def update
  2.     params[:option_type][:option_value_attributes] ||= {}
  3.     @option_type = OptionType.find(params[:id])
  4.     @option_type.save
  5.     respond_to do |format|
  6.         format.html {
  7.           redirect_to admin_option_types_url}
  8.     end
  9.   end
  10.  
  11. # should be
  12.  
  13.   def update
  14.     params[:option_type][:option_value_attributes] ||= {}
  15.     @option_type = OptionType.find(params[:id])
  16.     respond_to do |format|
  17.       if @option_type.update_attributes(params[:option_type])
  18.         format.html {redirect_to admin_option_types_url}
  19.       else
  20.         format.html { render :action => "edit" }
  21.       end
  22.     end
  23.   end