I have the following code in "Rails Root"/lib/tasks/example.rake
:
task :example_task => :environment do
e = Example.new
e.example_method
end
class Example
def example_method
select_tag 'Example'
end
end
When I call e.example_method
in the rake task, I get the error "undefined method 'select_tag' for #<Example:0x39f58b0>"
.
select_tag
is a Rails method: http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#method-i-select_tag
How do I make the select_tag
call work?