make_resourceful icon indicating copy to clipboard operation
make_resourceful copied to clipboard

After create unable to redirect user to index path

Open ITDevMohsin opened this issue 9 years ago • 0 comments
trafficstars

Hi,

I am using your gem in my project, the problem is that upon entering data into the database, it does not look for respond_for block and redirect my page to show method.

The controller code I am working with is:

make_resourceful do
    actions :all

    response_for :create do |format|
      format.html {
        set_default_flash :notice, I18n.t('make_resourceful.create.success', :default => "Create successful!")
        redirect_to admin_apps_path
      }
    end
  end

  def index
    render template: 'admin/shared/index'
  end

  def show
  end

  def new
    @current_object = current_model.new()
    render template: 'admin/shared/new'
  end

  def create
    @current_object = Wine.new(apps_params)
    save_succeeded! if @current_object.save
  end

It does not enter into the:

format.html {
        set_default_flash :notice, I18n.t('make_resourceful.create.success', :default => "Create successful!")
        redirect_to admin_apps_path
      }

Could you please see.

The reference to question is: http://stackoverflow.com/questions/39238691/unable-to-redirect-to-index-path-after-create

Thanks

ITDevMohsin avatar Aug 31 '16 00:08 ITDevMohsin