model view controller - ruby on rails forces show after submit -


i'm editing record , receive constraint related error after hitting "save". correct form field involved , click "save". ruby on rails forces me show action whilst i'd rather stay on edit form. design or i'm (hopefully) missing here ?

controller

  def update       @profile_field = safe_find profilefield, params[:id], "profile field"       if @profile_field.update_attributes(input_params)         logger.tagged("#{self.class} #{__method__}") {logger.info @profile_field.inspect }         flash[:success] = "profile field updated"         redirect_to(request.referrer || root_path)       else         render 'edit'       end   end 

view

= form_for @profile_field |f|   = render 'shared/error_messages', object: f.object     .field     = f.label :name_en     = f.text_field :name_en     = f.label :name_et     = f.text_field :name_et     = f.label :name_ru     = f.text_field :name_ru     = f.label :field_type     = f.select :field_type, options_for_select(profilefield.field_types,      :selected => f.object.field_type), :default => f.object.field_type     = button_tag(type: 'submit', class: 'btn btn-primary btn-block')       %span.glyphicon.glyphicon-floppy-disk       save     = link_to profile_fields_path, class: "btn btn-default btn-block"       %span.glyphicon.glyphicon-arrow-left       


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -