Hi,
Is it possible to test helper/view methods from script/console. I want to test the output of methods like distance_of_time_in_words. But it won't let me from the console. What am I missing?
TIA Luke
Hi,
Is it possible to test helper/view methods from script/console. I want to test the output of methods like distance_of_time_in_words. But it won't let me from the console. What am I missing?
TIA Luke
Hi,
Is it possible to test helper/view methods from script/console. I want to test the output of methods like distance_of_time_in_words. But it won't let me from the console. What am I missing?
TIA Luke
User the helper object:
>> helper.distance_of_time_in_words 92.minutes => "about 2 hours"
-Rob
Rob Biedenharn http://agileconsultingllc.com Rob@AgileConsultingLLC.com
Hi,
Is it possible to test helper/view methods from script/console. I want to test the output of methods like distance_of_time_in_words. But it won't let me from the console. What am I missing?
you need to include the appropriate module eg:
Fs-ElephantBook:fred fred$ ruby script/console Loading development environment (Rails 2.0.2) >> require 'action_view/helpers/date_helper' => >> include ActionView::Helpers::DateHelper => Object >> distance_of_time_in_words_to_now Time.mktime(2008,2,3,4) => "about 20 hours"
Hi,
Is it possible to test helper/view methods from script/console. I
want to test the output of methods like distance_of_time_in_words. But it won't let me from the console. What am I missing?TIA Luke
User the helper object:
helper.distance_of_time_in_words 92.minutes
=> "about 2 hours"
Neato! I've somehow managed to miss that one!
Fred
Awesome. Exactly what I was looking for. Thanks!