When I read through the online documentation, for example, for "form_tag", I see a number of examples shown as:
form_tag('/posts') # => <form action="/posts" method="post">
form_tag('/posts/1', :method => :put) # => <form action="/posts/1" method="put">
form_tag('/upload', :multipart => true) # => <form action="/upload" method="post" enctype="multipart/form-data">
<% form_tag '/posts' do -%> <div><%= submit_tag 'Save' %></div> <% end -%> # => <form action="/posts" method="post"><div><input type="submit" name="submit" value="Save" /></div></form>
Is it possible to try these examples at a command prompt somehow? I tried starting up script/console and typing in
form_tag('/posts')
hoping to get back out something like: <form action="/posts" method="post">
But I got the very unintuitive error message:
NoMethodError: undefined method `form_tag' for #<Object:0x27bf9ec> from (irb):1
It was especially unintuitive when I tracked down "form_tag_helper.rb" and saw in it ...
module ActionView module Helpers module FormTagHelper def form_tag(url_for_options = {}, options = {}, *parameters_for_url, &block) ...
So I tried ActionView::Helpers::FormTagHelper::form_tag(...) and got the same error message. I am thinking that this has to do with Ruby's notion of "sending a message via method" clashing with my notion of "invoking a procedure".
Can anybody point me in the direction of how to poke and prod at the various capabilities provided by Rails from a command prompt?
Thanks...
--wpd