Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Rails Console Error

Posted on 2011-02-14
1
Medium Priority
?
749 Views
Last Modified: 2012-05-11
Why does this happen? Its a new project and I am new to ruby.
irb(main):018:0> ActionController::Routing::Routes.draw 
NoMethodError: undefined method `arity' for nil:NilClass
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/activesupport-3.0.4/lib/active_support/whiny_nil.rb:48:in `method_missing'
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-3.0.4/lib/action_dispatch/routing/route_set.rb:230:in `draw'
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/activesupport-3.0.4/lib/active_support/deprecation/proxy_wrappers.rb:24:in `method_missing'
	from (irb):18
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/railties-3.0.4/lib/rails/commands/console.rb:44:in `start'
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/railties-3.0.4/lib/rails/commands/console.rb:8:in `start'
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/railties-3.0.4/lib/rails/commands.rb:23:in `<top (required)>'
	from script/rails:6:in `require'
	from script/rails:6:in `<main>'
irb(main):019:0>

Open in new window


I am trying to do:
puts ActionController::Routing::Routes.draw do |map|
	map.resources :users
end.map(&:to_s).sort

Open in new window


But I keep getting the above error. I am using Rails 3 on OSX.
0
Comment
Question by:LinuxInAtlanta
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 4

Accepted Solution

by:
kristinalim earned 2000 total points
ID: 34991840
If you're trying to print out method names for an isolated set of routes, this should get you started:

route_set = ActionDispatch::Routing::RouteSet.new
route_set.draw { |map| map.resources :users }

# Unique names, without the _url nor _path
puts route_set.routes.map(&:name).uniq.compact.sort

Open in new window

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently rediscovered rails when I needed a holiday project and decided to build a management dashboard for the company where I work.  With it being a project done in my free time, I could focus my time on learning the basics rather than trying to…
Recently I spent hours debugging an issue in a Rails project where ActiveRecord was causing MySQL errors trying to create a User object of a class at the top level of a Single Table Inheritance model structure.  It turns out `.create` behaves differ…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question