ruby on rails - Why ActiveRecord::StatementInvalid: SQLite3::SQLException: near ")": syntax error: INSERT INTO "user_friendships" () VALUES () -


why why activerecord::statementinvalid: sqlite3::sqlexception: near ")": syntax error: insert "user_friendships" () values ()

when trying test:

$ ruby -i test test/unit/user_friendships_test.rb

require 'test_helper'  class userfriendshipstest < activesupport::testcase should belong_to (:user) should belong_to (:friend)  test "that creating frinedship works without raising exception"      assert_nothing_raised         userfriendship.create user: users(:a), friend: friends(:b)     end  end  end 

any idea?

update: part of schema.rb

create_table "user_friendships", :force => true |t|  t.integer  "user_id"  t.integer  "friend_id"  t.datetime "created_at", :null => false  t.datetime "updated_at", :null => false end  add_index "user_friendships", ["user_id", "friend_id"], :name => "index_user_friendships_on_user_id_and_friend_id"  create_table "users", :force => true |t|  t.string   "first_name"  t.string   "last_name"  t.string   "profile_name"  t.string   "email",                  :default => "", :null => false  t.string   "encrypted_password",     :default => "", :null => false  t.string   "reset_password_token"  t.datetime "reset_password_sent_at"  t.datetime "remember_created_at"  t.integer  "sign_in_count",          :default => 0,  :null => false  t.datetime "current_sign_in_at"  t.datetime "last_sign_in_at"  t.string   "current_sign_in_ip"  t.string   "last_sign_in_ip"  t.datetime "created_at",                             :null => false  t.datetime "updated_at",                             :null => false end  add_index "users", ["email"], :name => "index_users_on_email", :unique => true add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true  end 

i ran well. seems related screwing rails naming conventions. in case, doing "rails g model activity_item" instead of "rails g model activity_items" solved issue.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -