Forum: Ruby on Rails wrong number of arguments (2 for 1)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
John Q. (Guest)
on 2006-04-17 07:45
The code below gives me the following error:
wrong number of arguments (2 for 1)

It goes though this code twice. The first everything works and it
prints:
Q*** Action name is index
Q*** Controller name is welcome
protect? welcome / index

The second time, I get this error and it prints:
Q*** Action name is signup
Q*** Controller name is user

It seems like it should work.

Any ideas?

module UserSystem
...

  def protect?(controller, action)
    puts "protect? #{controller} / #{action}"
    if ['welcome', 'user'].include?(controller)
      return false
    else
      return true
    end
  end

  def login_required
    puts "Q*** Action name is #{action_name}"
    puts "Q*** Controller name is #{controller_name}"
    if not protect?(controller_name, action_name)
      return true
    end

    if user? and authorize?(@session['user'])
      return true
    end
This topic is locked and can not be replied to.