Reputation: 2751
I'm learning rails using RailsTutorial.org and have run into an issue in section 7.3.4
It wants me to run get signup_path
but I get this error when I try:
NameError: undefined local variable or method `signup_path' for main:Object
from (irb):2
from /Users/reubenpressman/.rvm/gems/ruby-2.0.0-p451/gems/railties-4.0.8/lib/rails/commands/console.rb:90:in `start'
from /Users/reubenpressman/.rvm/gems/ruby-2.0.0-p451/gems/railties-4.0.8/lib/rails/commands/console.rb:9:in `start'
from /Users/reubenpressman/.rvm/gems/ruby-2.0.0-p451/gems/railties-4.0.8/lib/rails/commands.rb:62:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
This is what my routes.rb file looks like
get "users/new"
root 'static_pages#home'
match '/signup', to:'users#new', via:'get'
match '/help', to:'static_pages#help', via:'get'
match '/about', to:'static_pages#about', via:'get'
match '/contact', to:'static_pages#contact', via:'get'
resources :users
Any help would be great, thanks!
Upvotes: 0
Views: 1100
Reputation: 158
Are you just running this in irb? If you so this needs to be in your RSpec test not just run from the console. The "get" method here is part of RSpec: https://www.relishapp.com/rspec/rspec-rails/docs/request-specs/request-spec
Upvotes: 2