以下是我的database.yml
development:
adapter: postgresql
host: localhost
encoding: unicode
database: pepe_development
pool: 5
username: pepe
password: password
template: template0
当我db:migrate
smaringanti-mbp:xpm smaringanti $ rake db:migrate警告:使用字符串 对于费加罗配置。 [" admin","用户"," VIP"]已转换为 " [\" admin \",\"用户\",\" VIP \"]"。耙子流产了! ActiveRecord :: StatementInvalid:PG :: InsufficientPrivilege:错误: 关系schema_migrations的权限被拒绝:SELECT " schema_migrations"。* FROM" schema_migrations" /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/connection_adapters/postgresql_adapter.rb:774:in
async_exec' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/connection_adapters/postgresql_adapter.rb:774:in
exec_no_cache' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:138:inblock in exec_query' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:435:in
阻止日志记录 /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activesupport-4.0.2/lib/active_support/notifications/instrumenter.rb:20:ininstrument' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:430:in
登录' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:137:inexec_query' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/connection_adapters/postgresql_adapter.rb:891:in
选择' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:24:inselect_all' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:63:in
SELECT_ALL' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/querying.rb:36:infind_by_sql' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/relation.rb:585:in
exec_queries' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/relation.rb:471:inload' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/relation.rb:220:in
to_a' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/relation/delegation.rb:12:inmap' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/migration.rb:787:in
get_all_versions' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/migration.rb:949:inmigrated' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/migration.rb:954:in
跑&#39?; /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/migration.rb:931:inblock in runnable' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/migration.rb:931:in
拒绝' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/migration.rb:931:inrunnable' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/migration.rb:908:in
迁移' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/migration.rb:764:inup' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/migration.rb:742:in
迁移&#39; /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/railties/databases.rake:42:inblock (2 levels) in <top (required)>' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/bin/ruby_executable_hooks:15:in
的eval&#39; /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/bin/ruby_executable_hooks:15:in `&#39;任务:TOP =&gt; db:migrate(通过运行任务查看完整跟踪 --trace)
帮帮我。我正在尝试在我的localhost上开发它
答案 0 :(得分:4)
最终工作得很好
以超级用户身份登录
ALTER TABLE schema_migrations TO OWNER menuquizz
\q
记录为menuquizz
menuquizz_development=# \d
List of relations
Schema | Name | Type | Owner
--------+--------------------------+----------+-----------
public | .schema_migrations | table | denis
public | menus | table | menuquizz
public | menus_id_seq | sequence | menuquizz
public | schema_migrations | table | menuquizz
(4 rows)
menuquizz_development=# \q
:~/Projects/menuquizz$ rake db:fixtures:load FIXTURES=menus
:~/Projects/menuquizz$ psql -U menuquizz menuquizz_development
Password for user menuquizz:
psql (9.3.10)
Type "help" for help.
menuquizz_development=> select count(*) from menus;
count
-------
45
(1 row)
OK
答案 1 :(得分:0)
更新:
记录为替代:
$('#addBtn').click(function () {
var amodal = $('#addModal');
$('#IDPost').val(null);
amodal.modal('show');
});
$('#addPostBtn').click(function () { ... });