Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

when I do a redirect, there is an error undefined method `empty?' for 15:Fixnum

when I do a redirect, there is an error undefined method `empty?' for 15:Fixnum

I updated rails with 4.0.0 before 4.0.3 version. Now tormented by this bug.

What could it be?

projects_controller.rb

def create
    @project = Project.new(permited_params)

  if @project.save
    current_user.set_role :owner, @project
    redirect_to project_memberships_url(@project)
  else
    render :new
  end
end

redirect_to project_memberships_url(@project) the error here.

stacktrace Gist

like image 364
user3311412 Avatar asked Oct 14 '25 13:10

user3311412


1 Answers

Update to_param in the Project model as below:

def to_param
  id.to_s
end

to_param should return a String and not a Fixnum.

like image 76
Kirti Thorat Avatar answered Oct 17 '25 01:10

Kirti Thorat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!