Note that there are some explanatory texts on larger screens.

plurals
  1. POForm parameters are correct, but SQL misses a value
    primarykey
    data
    text
    <p>I have a form, that looks like this (sorry for Haml and the german parts)</p> <pre><code> = form_for @mentality, :url =&gt; { :controller =&gt; "mentalities", :action =&gt; "create" }, :html =&gt; { :class =&gt; "mentality_create", :method =&gt; :post } do |f| = render 'shared/error_messages_einstellung', :object =&gt; f.object .left %h4 Welche Einstellung möchten Sie hinzufügen? = f.text_field :title, :placeholder =&gt; "Name der Einstellung" %br = f.submit "Eintragen" </code></pre> <p>And a model which looks like this:</p> <pre><code># encoding: utf-8 class Mentality &lt; ActiveRecord::Base attr_accessible :title belongs_to :user validates :user_id, :presence =&gt; true validates :title, :presence =&gt; true default_scope :order =&gt; 'mentalities.created_at DESC' self.per_page = 20 end </code></pre> <p>So, there is only one field, which I want to write in, which is named title. If I process the create action, the log says:</p> <pre><code>Parameters: {"utf8"=&gt;"✓", "authenticity_token"=&gt;"ULjT8cxQ77KTh7+0rX6pzFpMaehBuUxGAA3AGh/Sbg8=", "mentality"=&gt;{"title"=&gt;"Test"}, "commit"=&gt;"Eintragen"} </code></pre> <p>But the SQL Statement it creates, is missing the title:</p> <pre><code>INSERT INTO "mentalities" ("created_at", "title", "updated_at", "user_id") VALUES ('2011-11-13 11:26:48.078652', NULL, '2011-11-13 11:26:48.078652', 1) </code></pre> <p>I have controller and views for a simliar model, which is named 'categories' and works perfectly fine.</p> <p>So, can someybody explain why title isn't inserted into my database? I really don't understand why it's not there.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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