freddiefujiwara
freddiefujiwara

Reputation: 59039

How to execute ActionView, ERB::Util from ./script/console in Rails 2.0.5

I develop it in Ruby on Rails 2.0.5 now.

Can I execute link_to method and the url_escape method use in /script/console?

Upvotes: 0

Views: 623

Answers (1)

Yehuda Katz
Yehuda Katz

Reputation: 28703

It's quite easy to use url_encode (I assume that's what you mean):

>> ERB::Util.erb_encode("hello world")
=> "hello%20world"

For helpers in ActionView, you can do:

>> helper.link_to "you", "some_url"
=> "<a href=\"some_url\">you</a>"

Upvotes: 2

Related Questions