# How to try examples given in the documentation

**URL:** <https://www.ruby-forum.com/t/how-to-try-examples-given-in-the-documentation/132386>\
**Category:** Rails\
**Created:** [March 19, 2008, 4:55pm UTC](https://www.ruby-forum.com/t/how-to-try-examples-given-in-the-documentation/132386 "2008-03-19T16:55:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![oldbug](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/c0e974/32.png) [@oldbug](https://www.ruby-forum.com/u/oldbug)\
**Post date:** [March 19, 2008, 4:55pm UTC](https://www.ruby-forum.com/t/how-to-try-examples-given-in-the-documentation/132386/1 "2008-03-19T16:55:00Z")

</div>

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

form\_tag(’/posts’)

# =\>

form\_tag(’/posts/1’, :method =\> :put)

# =\>

form\_tag(’/upload’, :multipart =\> true)

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

enctype=“multipart/form-data”\>

\<% 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

> > form\_tag(’/posts’)

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?

Thanks…

–wpd
