Rails 3.1: Sqlite exception

隐身守侯 提交于 2019-12-07 00:33:26

Still sounds like a privileges issue to me. Make sure that the user that you're running rails as has permission to edit the file. For instance, if you're running rails under phusion, I believe that the rails effective user and group are the user and group that nginx runs as. To test if it is permissions. I would start with chmod 777 on your sqlite db file, and see if that helps. If so, follow up to see if you can set the permissions more reasonably and ownership of the db file to your nginx user.

After altering owner & rights of db files I had to restart rails server to make things work.

If you are logged in as anyone other than the admin, you can use rvmsudo rake db:migrate which will prompt you for your admin password and allow access rights for the migration you are attempting.

Rails 2.3.5 I also got the same problem when i am trying to insert a record then i am getting the same error :

The problem was when i created a project the db/schema.rb has the owner is root. i am logged in with my current user [not the root]. after changing the owner in ubuntu of the file.

check the owner of the file first then change the owner

chown userName fileName

Dan Barron

I know this is an old question, but for others that find it as I did while searching, I'd suggest looking at Benjamin's answer to this question:

How should I set up permission for Rails app?

Specifically as regards the above answer, his first line: "You should definitely not use 0777 for your file permissions. This more easily exposes you to vulnerabilities."

I know Matt was just suggesting it as a debugging step, he was not suggesting leaving it that way in production, but the OP seems to have taken it that way.

I received this same error in Rails 4.1 after removing the impressionist gem from my app.

What I ended up doing to fix this:

  1. Removing the db/migration related to generating a new table for impressionist
  2. Altering the schema.rb file manually to remove references to impressionist
  3. reboot the server
  4. passenger-memory-stats to verify that the app had restarted and apache had picked up the rackapp pid.

Everything worked fine after that, although it was a huge pain trying to figure out the cause.

One thing I would recommend doing for sure is to check your users and make sure there aren't duplicates.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!