How to try examples given in the documentation

When I read through the online documentation, for example, for
“form_tag”, I see a number of examples shown as:



form_tag(’/posts/1’, :method => :put)


form_tag(’/upload’, :multipart => true)

=> <form action="/upload" method=“post”


<% form_tag ‘/posts’ do -%>

<%= submit_tag ‘Save’ %>

<% end -%>

<input type=“submit”

name=“submit” value=“Save” />

Is it possible to try these examples at a command prompt somehow? I
tried starting up script/console and typing in


hoping to get back out something like:

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?