Accessing Helpers in rails console
While stumbling i found ErrtheBlog called the helper methods directly in the rails console by just using the helper object.
By calling the helper methods in rails console,it helps us to see the output of helper methods quickly rather than constantly clicking refresh in your browser then viewing the page source can be tiresome.
Go to the root directory of your application, then type the following
$ ruby script/console
Loading development environment (Rails 2.2.2)
>>
To use helper methods, you need to prefix them with helper
>> helper.link_to "this","that"
=> "<a href=\"that\">this</a>"
Its really good to check the output instantly
No comments :
Post a Comment