如果我登录到 mysql 终端,我可以对 RDS 数据库进行任何我想要的更新或添加。但是当我从 Rails 控制台使用 Active Record 时,我只能访问数据,不能更新或销毁它。
我似乎有正确的赠款:
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, PROCESS, REFERENCES, INDEX,
ALTER, SHOW DATABASES, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION
CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT,
TRIGGER ON *.* TO 'root'@'%' IDENTIFIED BY PASSWORD'*XXXXX' WITH GRANT OPTION |
我的 database.yml 看起来像:
development:
host: XXXX.YYYY.us-east-1.rds.amazonaws.com
adapter: mysql2
encoding: utf8
reconnect: false
database: filemaker
pool: 5
username: root
password: ZZZZZ
当我尝试更新记录时,现在返回 false:
>> Section.first.update_column(:craigslist_posts, 1)
Section Load (101.6ms) SELECT `sections`.* FROM `sections` LIMIT 1
SQL (49.9ms) UPDATE `sections` SET `craigslist_posts` = 1 WHERE `sections`.`_id`=
4470
=> false
我已经关闭了 whitelist_attributes 认为这可能与它有关。因为 RDS 没有任何错误日志,所以我看不到是否有任何错误被提交。