title: Rails Simple_Form Saving Values as NULL in Database
body: <p>So I'm new to Rails and I've been playing around with it by trying to create a very simple to do list based on current user. So far I have authentication handled with Devise and forms are rendered with simple_form gem. Everything works fine up until I try to add a new task to the database. For some reason when I submit the form, it inputs NULL into the db columns (except of course the id column which increments)...it's like the values are getting lost in transmission or something weird. Anyway, here's what I have:</p>
  
  <p>Controller:</p>
  
  <pre><code>class TodoController &lt; ApplicationController
    before_filter :authenticate_user!
  
    def index
      @todo_list = Todo.where("user_id = ?", current_user.id).all
      @task = Todo.new
    end
  
    def create
      @todo_list = Todo.all
      @task = Todo.new(params[:task])
      if @task.save
        flash[:notice] = "Task Added"
        redirect_to todos_path
      else
        render :action =&gt; 'index'
      end
    end
  
    def destroy
      @todo_list = Todo.find(params[:id])
      @task.destroy
      flash[:notice] = "Task Deleted"
      redirect_to todos_path
    end
  end
  </code></pre>
  
  <p>Model:</p>
  
  <pre><code>class Todo &lt; ActiveRecord::Base
    belongs_to :users
    attr_accessible :user_id, :task_name, :task_description
  end
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>&lt;h2&gt;To Do List&lt;/h2&gt;
  &lt;%= render :partial =&gt; 'form' %&gt;
  
  &lt;div class="span11"&gt;
  &lt;table class="table table-condensed table-striped"&gt;
        &lt;thead&gt;
        &lt;tr&gt;
            &lt;th&gt;Task&lt;/th&gt;
            &lt;th&gt;Description&lt;/th&gt;           
        &lt;/tr&gt;
    &lt;/thead&gt;   
    &lt;tbody&gt;
    &lt;% @todo_list.each do |todo| %&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;%= todo.task_name %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%= todo.task_description %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%= link_to("Delete", todos_path, :confirm =&gt; 'Delete task?', :method =&gt; :delete, :class =&gt; 'btn btn-mini') %&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;% end %&gt;
  &lt;/table&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>_form.html.erb:</p>
  
  <pre><code>&lt;%= simple_form_for @task, :url =&gt; todos_path, :method =&gt; :post do |f| %&gt;
      &lt;%= f.error_notification %&gt;
      &lt;%= f.input :task_name, :as =&gt; :string %&gt;
      &lt;%= f.input :task_description, :as =&gt; :string  %&gt; 
      &lt;%= f.button :submit, :class =&gt; 'btn btn-success' %&gt;
  &lt;% end %
  </code></pre>
  
  <p>It's probably something really simple, I just can't seem to spot it. Any help would be appreciated.</p>