title: Rails -- ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column:
body: <p>Having major Rails issues currently. I'm creating a School-Dashboard app that takes an xref table called Enrollments that relates Courses and Students. </p>
  
  <p>Any time I try to update a grade for an Enrollment, I constantly get this line</p>
  
  <pre><code>ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column: UPDATE
  "enrollments" SET "grade" = ?, "updated_at" = ? WHERE "enrollments"."" IS NULL
  </code></pre>
  
  <p>This line does not appear when I update attributes for Courses or Students. Only for the <code>:grade</code> attribute in Enrollment.
  For some reason, it isn't being read properly, even though it is a legitimate attribute in my db for Enrollment (check out my schema). </p>
  
  <p>I do all of my preliminary work in the rails sandbox. 
  <strong>Using ruby 2.1.1, Rails 4.1.0.rc1</strong></p>
  
  <p>I'd really love some help here. </p>
  
  <p>Here are my corresponding models</p>
  
  <pre><code>class Student &lt; ActiveRecord::Base
     has_many :enrollments
     has_many :courses, through: :enrollments
  end
  
  class Course &lt; ActiveRecord::Base
     has_many :enrollments
     has_many :students, through: :enrollments
  end
  
  class Enrollment &lt; ActiveRecord::Base
      belongs_to :student
      belongs_to :course
  end
  </code></pre>
  
  <p>The controllers:</p>
  
  <p>Students</p>
  
  <pre><code>class StudentsController &lt; ApplicationController
     def index
        @students = Student.all
     end
  
     def new
        @student = Student.new
     end
  
     def show
     end
  
     def update
        @student.update_attributes(student_params) ? redirect_to @student : render 'edit'
     end
  
     def create
        @student = Student.new(student_params)
        @student.save ? redirect_to @student : render 'new' 
     end
  
     def destroy
     end
  
     def edit
     end
  
     private
     def student_params
        params.require(:student).permit(:first_name, :last_name, :student_number, :email)
    end
   end
  </code></pre>
  
  <p>Courses</p>
  
  <pre><code>class CoursesController &lt; ApplicationController
     def index
       @courses = Course.all
     end
  
     def new
       @course = Course.new
     end
  
     def show
     end
  
     def update
       @course.update_attributes(course_params) ? redirect_to @course : render 'edit'
     end
  
     def create
       @course = Course.new(course_params)
       @course.save ? redirect_to @course : render 'new'
     end
  
     def destroy
     end
  
     def edit
       # code here
     end
  
     private
     def course_params
       params.require(:course).permit(:course_name, :course_number)
     end
   end
  </code></pre>
  
  <p>Enrollments</p>
  
  <pre><code>class EnrollmentsController &lt; ApplicationController
     attr_accessor :course_id, :student_id, :grade
     def index
       @enrollments = Enrollment.all
     end
  
     def new
       @enrollment = Enrollment.new
     end
  
     def create
       @enrollment = Enrollment.new(enrollment_params)
       @enrollment.save ? redirect_to @enrollment : render 'new'
     end
  
     def update
       @enrollment.update_attributes(enrollment_params) ? redirect_to @enrollment : render  'edit'
     end
  
     def show
     end
  
     def destroy
       @enrollment.destroy
     end
  
     def edit
       # code here
     end
  
     private
     def enrollment_params
       params.require(:enrollment).permit(:course_id, :student_id, :grade)
     end
   end
  </code></pre>
  
  <p>And finally my schema.rb</p>
  
  <pre><code> ActiveRecord::Schema.define(version: 20140417152720) do
  
     create_table "courses", force: true do |t|
       t.string   "course_name"
       t.integer  "course_number"
       t.datetime "created_at"
       t.datetime "updated_at"
     end
  
     create_table "enrollments", id: false, force: true do |t|
       t.integer  "course_id",                          null: false
       t.integer  "student_id",                         null: false
       t.decimal  "grade",      precision: 5, scale: 2
       t.datetime "created_at"
       t.datetime "updated_at"
     end
  
     # noinspection RailsParamDefResolve
     add_index "enrollments", ["course_id", "student_id"], name: "index_enrollments_on_course_id_and_student_id"
     # noinspection RailsParamDefResolve
     add_index "enrollments", ["student_id", "course_id"], name: "index_enrollments_on_student_id_and_course_id"
  
     create_table "students", force: true do |t|
       t.string   "first_name"
       t.string   "last_name"
       t.string   "email"
       t.integer  "student_number"
       t.datetime "created_at"
       t.datetime "updated_at"
     end
   end
  </code></pre>