Defect #19274
closed
Plugin Model Creation Failure
Added by Ricardo Gutiérrez about 10 years ago.
Updated over 9 years ago.
Description
After Model plugin creation I tryed to create a new instance of rplugin model with the following error in Rails Console:
ActiveRecord::DangerousAttributeError: errors is defined by Active Record. Check to make sure that you don't have an attribute or method with the same name.
I chaged all most three times the Plugin and Model name without luck, I am following the Redmine Plugin Development guide step by step but something is wrong.
Environment Info:
Environment:
Redmine version 3.0.0.stable.14044
Ruby version 2.1.5-p273 (2014-11-13) [x86_64-linux]
Rails version 4.2.0
Environment development
Database adapter PostgreSQL
SCM:
Subversion 1.8.10
Git 2.1.0
Filesystem
Redmine plugins:
no plugin installed
Finally I can fix my issue but I don't know the root cause. I have been using very particular model names in order to avoid conflicts.
Solution: Add this line in the Gemfile.
gem 'safe_attributes'
- Priority changed from Urgent to Normal
I could not reproduce.
Could you show commands you typed to generate a model?
Shell commands:
rails generate redmine_plugin Odsfs
rails g redmine_plugin_model odsfs odsf lines:integer bad_lines:integer errors:text
rake redmine:plugins:migrate
- Status changed from New to Needs feedback
I could not still produce. A table was successfly created.
$ bundle exec rake redmine:plugins:migrate
Migrating foo (Foo plugin)...
Migrating odsfs (Odsfs plugin)...
== 1 CreateOdsfs: migrating ===================================================
-- create_table(:odsfs)
-> 0.0010s
== 1 CreateOdsfs: migrated (0.0011s) ==========================================
Environment:
Redmine version 3.0.0.devel.14045
Ruby version 2.2.0-p0 (2014-12-25) [x86_64-darwin13]
Rails version 4.2.0
Environment production
Database adapter SQLite
- Status changed from Needs feedback to Closed
- Resolution set to No feedback
Also available in: Atom
PDF