How to use all view and helper methods inside of Rails console for Rails 2.x and 3.x? [duplicate]

helper.method_name worked in some version of Rails... are there ways that work in both Rails 2.2.2, 2.3.5, and 3.0.1? (to use all view and helper methods)


Solution 1:

You can also try :

YourController.helpers.my_helper

for example :

> ApplicationController.helpers.content_tag(:div, "test")
=> "<div>test</div>" 

This works with Rails 2, 3 and 4.1

Solution 2:

please try to this

rails console
helper.any_method_of_helper(pass_argument)

example

helper.number_to_currency('123.45')