Project

General

Profile

Actions

Defect #19274

closed

Plugin Model Creation Failure

Added by Ricardo Gutiérrez about 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Plugin API
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
No feedback
Affected version:

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

Actions #1

Updated by Ricardo Gutiérrez about 9 years ago

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'

Actions #2

Updated by Go MAEDA about 9 years ago

  • Priority changed from Urgent to Normal

I could not reproduce.
Could you show commands you typed to generate a model?

Actions #3

Updated by Ricardo Gutiérrez about 9 years ago

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
Actions #4

Updated by Go MAEDA about 9 years ago

  • 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
Actions #5

Updated by Jan Niggemann (redmine.org team member) over 8 years ago

  • Status changed from Needs feedback to Closed
  • Resolution set to No feedback
Actions

Also available in: Atom PDF