vendredi 7 avril 2017

Rails how to controller redirect if boolean is true?

i'm trying to create a object and turn the boolean to true and redirect after that in any case the log show error.

someone know how?

class BrandsController < ApplicationController

  def new
    @brand = current_user.build_brand(params[:brand])
  end

  def create
    @brand = current_user.build_brand(params[:brand])


    if @brand.save

      redirect_to "#{new_user_path}?branded=#{@current_user.branded[1]}"

flash[:success] = "thank's".html_safe
    end

  end
end

Aucun commentaire:

Enregistrer un commentaire