stevec
stevec

Reputation: 52658

Use url_for in rails console?

When I try to use url_for in the rails console, I see:

url_for(User.first.images.first)
NoMethodError: undefined method `url_for' for main:Object

How can I use that method in the rails console?

Upvotes: 7

Views: 3198

Answers (1)

raviture
raviture

Reputation: 1059

you can use the following to check route helper methods in the console.

app.url_for(User.first.images.first)

the app would give you a view context. But beware if you are using it in the application.

Upvotes: 15

Related Questions