How to make auto_link work in script/console

I wanted to take auto_link method for a ride but in script/console I get the message that “undefined method ‘tag_options’”.

What do I need to include in order to run auto_link(“ruby on rails”) on ruby script/console?

I wanted to take auto_link method for a ride but in script/console I get the
message that "undefined method 'tag_options'".

What do I need to include in order to run auto_link("ruby on rails") on ruby
script/console?

include ActionView::Helpers::TagHelper

or, use the little "helper" thingy, and you don't have to worry about
including stuff:

helper.auto_link("ruby on rails")

=> "ruby on rails"

I wanted to take auto_link method for a ride but in script/console I get the
message that "undefined method 'tag_options'".

What do I need to include in order to run auto_link("ruby on rails") on ruby
script/console?

include ActionView::Helpers::TagHelper

or, use the little "helper" thingy, and you don't have to worry about
including stuff:

helper.auto_link("ruby on rails")

=> "ruby on rails"

Loading production environment.
>> helper.auto_link("please visit http://agileconsultingllc.com for more information")
=> "please visit <a href=\"http://agileconsultingllc.com\">http://agileconsultingllc.com</a> for more information"

Hey thanks! That's a fantastic tip!

-Rob

Rob Biedenharn http://agileconsultingllc.com
Rob@AgileConsultingLLC.com

Question is if I do just

pluralize(2,“person”) in script/console without using helper or including anything , it works by default. While auto_link("www.rubyonrails.org
") chokes with error. Why this discrepancy. Why pluralize method is automatically loaded.

I wanted to take auto_link method for a ride but in script/console
I get the
message that “undefined method ‘tag_options’”.

What do I need to include in order to run auto_link(“ruby on
rails”) on ruby
script/console?

include ActionView::Helpers::TagHelper

or, use the little “helper” thingy, and you don’t have to worry about
including stuff:

helper.auto_link(“ruby on rails”)
=> “ruby on rails”

Loading production environment.

helper.auto_link(“please visit http://agileconsultingllc.com for
more information”)
=> “please visit <a href=”[http://agileconsultingllc.com\ ](http://agileconsultingllc.com)">http://
agileconsultingllc.com for more information"

Hey thanks! That’s a fantastic tip!

-Rob

Rob Biedenharn http://agileconsultingllc.com
Rob@AgileConsultingLLC.com

Question is if I do just

pluralize(2,“person”) in script/console without using helper or including anything , it works by default. While auto_link("www.rubyonrails.org ") chokes with error. Why this discrepancy. Why pluralize method is automatically loaded.

-=-

Are you sure? It doesn’t work for me.

Loading development environment.

pluralize(2,‘person’)

NoMethodError: undefined method `pluralize’ for #Object:0x349f4

from (irb):1

helper.pluralize(2,‘person’)

=> “2 people”

pluralize(2,‘person’)

NoMethodError: undefined method `pluralize’ for #Object:0x349f4

from (irb):3

-Rob

Rob Biedenharn http://agileconsultingllc.com

Rob@AgileConsultingLLC.com

then it must be windows issue. I killed my script/console then started another one and it still works.

exit

D:\dev\eii4>ruby script/console
Loading development environment.

pluralize(2,“person”)

=> “2 people”