Note that there are some explanatory texts on larger screens.

plurals
  1. PORails form_tag form writing - with non-active record model
    text
    copied!<p>I'm somewhat of a Rails newbie. I'm writing a couchrest-rails app, so am not using activerecord for this model. I just figured out that that means that </p> <pre><code>form_for(@model) </code></pre> <p>won't work. I'm trying to work out how to use form_tag -- but most of the examples don't involve new &amp; create actions.</p> <p>This is wrong:</p> <pre><code>&lt;h1&gt;New article&lt;/h1&gt; &lt;% form_tag new_article_url(@article), :method =&gt; :post do |f| %&gt; &lt;%= f.error_messages %&gt; &lt;p&gt; &lt;%= f.label :title %&gt;&lt;br /&gt; &lt;%= f.text_field :title %&gt; &lt;/p&gt; &lt;p&gt; &lt;%= f.submit 'Create' %&gt; &lt;/p&gt; &lt;% end %&gt; &lt;%= link_to 'Back', articles_path %&gt; </code></pre> <p>Because when I run my Cucumber scenario, I get this:</p> <pre><code>Scenario: Create Valid Article # features/article.feature:16 Given I have no articles # features/step_definitions /article_steps.rb:8 And I am on the list of articles # features/step_definitions/webrat_steps.rb:6 /home/deploy/www/www.trackingplace.com/app/ccc/app/views/articles/new.html.erb:3: warning: multiple values for a block parameter (0 for 1) from /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_view/helpers/capture_helper.rb:36 When I follow "New Article" # features/step_definitions/webrat_steps.rb:18 You have a nil object when you didn't expect it! The error occurred while evaluating nil.error_messages (ActionView::TemplateError) features/article.feature:19:in `When I follow "New Article"' </code></pre> <p>But I don't understand the error, or how to fix it.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload