title: Ruby: Problems using Mechanize to access my form!
body: <p>Just for fun, I wrote a very small rails blog (just a hello world).
  Now I want to create a post using mechanize.
  So I created a Ruby Prog and started coding.</p>
  
  <p>Here is my problem:
  Rails creates my form element including all inputs.
  In HTML my inputs look like this:</p>
  
  <pre><code>&lt;input type="text" size="30" name="post[title]" id="post_title"&gt;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>&lt;textarea rows="20" name="post[description]" id="post_description" cols="40"&gt;&lt;/textarea&gt;
  </code></pre>
  
  <p>Well...
  Here is my Ruby Prog using Mechanize:</p>
  
  <pre><code>require 'rubygems'
  require 'mechanize'
  
  agent = WWW::Mechanize.new
  
  page = agent.get('http://localhost:3000/posts/new')
  target_form = page.form_with(:class =&gt; 'new_post')
  target_form.post[title] = "test"
  target_form.post[description] = "test"
  page = agent.submit(target_form)
  puts "end"
  </code></pre>
  
  <p>I know where my error is but I don't know how to fix it.
  At target_form.post[title] = "test" it crashes, cause of </p>
  
  <pre><code>undefined method `name' for nil:NilClass (NoMethodError)
  </code></pre>
  
  <p>I think (please correct me), it's because of the input name, cause it is post[title] instead of only post right?
  How can I fix it?</p>