wrong number of arguments (1 for 0) Ruby on Rails -



wrong number of arguments (1 for 0) Ruby on Rails -

hi have posted code first , question below

def create new_tag = tag.new(name: params[:create_new][:name], description: "test string", #todo user: @current_user,) if new_tag.save create_assignment_tag_association_from_tag_id(params[:assignment_id], new_tag.id) flash[:success] = i18n.t('tag created successfully') redirect_to :back else flash[:error] = i18n.t('error creating tag') redirect_to :back end end def create_assignment_tag_association_from_tag_id(assignment_id, tag_id) puts "assignment_id: #{assignment_id}" puts "tag_id: #{tag_id}" tag = tag.find(tag_id) create_assignment_tag_association_from_tag(assignment_id, tag) end def create_assignment_tag_association_from_tag(assignment_id, t) if !t.assignment.exists(assignment_id) assign = assignment.find(assignment_id) t.assignments << (assign) end end

wrong number of arguments (1 0) rails.root: /markus

application trace | framework trace | total trace

app/controllers/tags_controller.rb:84:in `create_assignment_tag_association_from_tag' app/controllers/tags_controller.rb:80:in `create_assignment_tag_association_from_tag_id' app/controllers/tags_controller.rb:18:in `create'

i'm confused why ruby thinks create_assignment_tag_association_from_tag takes 0 arguments , why thinks getting 1?

note: i'm calling create_assignment_tag_association_from_tag_id show that method takes 2 arguments , ronr recognizes takes 2 , getting passed two. because phone call works, i'm confused why sec fn phone call not working.

the issue isn't create_assignment_tag_association_from_tag, issue inside function. exists wrong. you're after exists?.

ruby-on-rails ruby

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -