Commit f1b53f69a1b6cc1a228107f280bc8e03274ea2fd
1 parent
1ea6b1cb
Exists in
master
and in
20 other branches
rails4: fix migration errors with Noosfero::Plugin::ActiveRecord
Showing
20 changed files
with
33 additions
and
26 deletions
Show diff stats
config/initializers/plugins.rb
1 | require 'noosfero/plugin' | 1 | require 'noosfero/plugin' |
2 | require 'noosfero/plugin/hot_spot' | 2 | require 'noosfero/plugin/hot_spot' |
3 | require 'noosfero/plugin/manager' | 3 | require 'noosfero/plugin/manager' |
4 | -require 'noosfero/plugin/active_record' | ||
5 | require 'noosfero/plugin/mailer_base' | 4 | require 'noosfero/plugin/mailer_base' |
6 | require 'noosfero/plugin/settings' | 5 | require 'noosfero/plugin/settings' |
7 | require 'noosfero/plugin/spammable' | 6 | require 'noosfero/plugin/spammable' |
lib/noosfero/plugin.rb
@@ -713,6 +713,5 @@ end | @@ -713,6 +713,5 @@ end | ||
713 | 713 | ||
714 | require 'noosfero/plugin/hot_spot' | 714 | require 'noosfero/plugin/hot_spot' |
715 | require 'noosfero/plugin/manager' | 715 | require 'noosfero/plugin/manager' |
716 | -require 'noosfero/plugin/active_record' | ||
717 | require 'noosfero/plugin/mailer_base' | 716 | require 'noosfero/plugin/mailer_base' |
718 | require 'noosfero/plugin/settings' | 717 | require 'noosfero/plugin/settings' |
lib/noosfero/plugin/active_record.rb
plugins/bsc/lib/bsc_plugin/contract.rb
1 | -class BscPlugin::Contract < Noosfero::Plugin::ActiveRecord | 1 | +class BscPlugin::Contract < ActiveRecord::Base |
2 | + | ||
2 | validates_presence_of :bsc, :client_name | 3 | validates_presence_of :bsc, :client_name |
3 | 4 | ||
4 | has_many :sales, :class_name => 'BscPlugin::Sale' | 5 | has_many :sales, :class_name => 'BscPlugin::Sale' |
@@ -81,4 +82,5 @@ class BscPlugin::Contract < Noosfero::Plugin::ActiveRecord | @@ -81,4 +82,5 @@ class BscPlugin::Contract < Noosfero::Plugin::ActiveRecord | ||
81 | def total_price | 82 | def total_price |
82 | sales.inject(0) {|result, sale| sale.price*sale.quantity + result} | 83 | sales.inject(0) {|result, sale| sale.price*sale.quantity + result} |
83 | end | 84 | end |
85 | + | ||
84 | end | 86 | end |
plugins/bsc/lib/bsc_plugin/sale.rb
1 | -class BscPlugin::Sale < Noosfero::Plugin::ActiveRecord | 1 | +class BscPlugin::Sale < ActiveRecord::Base |
2 | + | ||
2 | validates_presence_of :product, :contract | 3 | validates_presence_of :product, :contract |
3 | validates_uniqueness_of :product_id, :scope => :contract_id | 4 | validates_uniqueness_of :product_id, :scope => :contract_id |
4 | validates_numericality_of :quantity, :only_integer => true, :greater_than_or_equal_to => 0 | 5 | validates_numericality_of :quantity, :only_integer => true, :greater_than_or_equal_to => 0 |
@@ -16,4 +17,5 @@ class BscPlugin::Sale < Noosfero::Plugin::ActiveRecord | @@ -16,4 +17,5 @@ class BscPlugin::Sale < Noosfero::Plugin::ActiveRecord | ||
16 | before_update do |contract| | 17 | before_update do |contract| |
17 | contract.updated_at ||= Time.now.utc | 18 | contract.updated_at ||= Time.now.utc |
18 | end | 19 | end |
20 | + | ||
19 | end | 21 | end |
plugins/comment_classification/lib/comment_classification_plugin/label.rb
1 | -class CommentClassificationPlugin::Label < Noosfero::Plugin::ActiveRecord | 1 | +class CommentClassificationPlugin::Label < ActiveRecord::Base |
2 | 2 | ||
3 | belongs_to :owner, :polymorphic => true | 3 | belongs_to :owner, :polymorphic => true |
4 | 4 | ||
@@ -9,4 +9,5 @@ class CommentClassificationPlugin::Label < Noosfero::Plugin::ActiveRecord | @@ -9,4 +9,5 @@ class CommentClassificationPlugin::Label < Noosfero::Plugin::ActiveRecord | ||
9 | attr_accessible :name, :enabled, :color | 9 | attr_accessible :name, :enabled, :color |
10 | 10 | ||
11 | COLORS = ['red', 'green', 'yellow', 'gray', 'blue'] | 11 | COLORS = ['red', 'green', 'yellow', 'gray', 'blue'] |
12 | + | ||
12 | end | 13 | end |
plugins/comment_classification/lib/comment_classification_plugin/status.rb
1 | -class CommentClassificationPlugin::Status < Noosfero::Plugin::ActiveRecord | 1 | +class CommentClassificationPlugin::Status < ActiveRecord::Base |
2 | 2 | ||
3 | belongs_to :owner, :polymorphic => true | 3 | belongs_to :owner, :polymorphic => true |
4 | 4 | ||
@@ -7,4 +7,5 @@ class CommentClassificationPlugin::Status < Noosfero::Plugin::ActiveRecord | @@ -7,4 +7,5 @@ class CommentClassificationPlugin::Status < Noosfero::Plugin::ActiveRecord | ||
7 | validates_presence_of :name | 7 | validates_presence_of :name |
8 | 8 | ||
9 | scope :enabled, -> { where enabled: true } | 9 | scope :enabled, -> { where enabled: true } |
10 | + | ||
10 | end | 11 | end |
plugins/custom_forms/lib/custom_forms_plugin/form.rb
1 | -class CustomFormsPlugin::Form < Noosfero::Plugin::ActiveRecord | 1 | +class CustomFormsPlugin::Form < ActiveRecord::Base |
2 | + | ||
2 | belongs_to :profile | 3 | belongs_to :profile |
3 | 4 | ||
4 | has_many :fields, :order => 'position', :class_name => 'CustomFormsPlugin::Field', :dependent => :destroy | 5 | has_many :fields, :order => 'position', :class_name => 'CustomFormsPlugin::Field', :dependent => :destroy |
plugins/custom_forms/lib/custom_forms_plugin/submission.rb
1 | -class CustomFormsPlugin::Submission < Noosfero::Plugin::ActiveRecord | 1 | +class CustomFormsPlugin::Submission < ActiveRecord::Base |
2 | + | ||
2 | belongs_to :form, :class_name => 'CustomFormsPlugin::Form' | 3 | belongs_to :form, :class_name => 'CustomFormsPlugin::Form' |
3 | belongs_to :profile | 4 | belongs_to :profile |
4 | 5 |
plugins/foo/lib/foo_plugin/bar.rb
plugins/oauth_client/lib/oauth_client_plugin/provider.rb
plugins/oauth_client/lib/oauth_client_plugin/user_provider.rb
1 | -class OauthClientPlugin::UserProvider < Noosfero::Plugin::ActiveRecord | 1 | +class OauthClientPlugin::UserProvider < ActiveRecord::Base |
2 | 2 | ||
3 | belongs_to :user, :class_name => 'User' | 3 | belongs_to :user, :class_name => 'User' |
4 | belongs_to :provider, :class_name => 'OauthClientPlugin::Provider' | 4 | belongs_to :provider, :class_name => 'OauthClientPlugin::Provider' |
plugins/shopping_cart/lib/shopping_cart_plugin/purchase_order.rb
1 | -class ShoppingCartPlugin::PurchaseOrder < Noosfero::Plugin::ActiveRecord | 1 | +class ShoppingCartPlugin::PurchaseOrder < ActiveRecord::Base |
2 | 2 | ||
3 | belongs_to :customer, :class_name => "Profile" | 3 | belongs_to :customer, :class_name => "Profile" |
4 | belongs_to :seller, :class_name => "Profile" | 4 | belongs_to :seller, :class_name => "Profile" |
plugins/sniffer/lib/sniffer_plugin/opportunity.rb
plugins/sniffer/lib/sniffer_plugin/profile.rb
plugins/spaminator/lib/spaminator_plugin/report.rb
1 | -class SpaminatorPlugin::Report < Noosfero::Plugin::ActiveRecord | 1 | +class SpaminatorPlugin::Report < ActiveRecord::Base |
2 | + | ||
2 | serialize :failed, Hash | 3 | serialize :failed, Hash |
3 | 4 | ||
4 | belongs_to :environment | 5 | belongs_to :environment |
@@ -29,4 +30,5 @@ class SpaminatorPlugin::Report < Noosfero::Plugin::ActiveRecord | @@ -29,4 +30,5 @@ class SpaminatorPlugin::Report < Noosfero::Plugin::ActiveRecord | ||
29 | # TODO Implement some decent visualization | 30 | # TODO Implement some decent visualization |
30 | inspect | 31 | inspect |
31 | end | 32 | end |
33 | + | ||
32 | end | 34 | end |
plugins/sub_organizations/lib/sub_organizations_plugin/approve_paternity_relation.rb
1 | -class SubOrganizationsPlugin::ApprovePaternityRelation < Noosfero::Plugin::ActiveRecord | 1 | +class SubOrganizationsPlugin::ApprovePaternityRelation < ActiveRecord::Base |
2 | + | ||
2 | belongs_to :task | 3 | belongs_to :task |
3 | belongs_to :parent, :polymorphic => true | 4 | belongs_to :parent, :polymorphic => true |
4 | belongs_to :child, :polymorphic => true | 5 | belongs_to :child, :polymorphic => true |
plugins/sub_organizations/lib/sub_organizations_plugin/relation.rb
1 | -class SubOrganizationsPlugin::Relation < Noosfero::Plugin::ActiveRecord | 1 | +class SubOrganizationsPlugin::Relation < ActiveRecord::Base |
2 | + | ||
2 | belongs_to :parent, :polymorphic => true | 3 | belongs_to :parent, :polymorphic => true |
3 | belongs_to :child, :polymorphic => true | 4 | belongs_to :child, :polymorphic => true |
4 | 5 |
plugins/tolerance_time/lib/tolerance_time_plugin/publication.rb
1 | -class ToleranceTimePlugin::Publication < Noosfero::Plugin::ActiveRecord | 1 | +class ToleranceTimePlugin::Publication < ActiveRecord::Base |
2 | + | ||
2 | belongs_to :target, :polymorphic => true | 3 | belongs_to :target, :polymorphic => true |
3 | validates_presence_of :target_id, :target_type | 4 | validates_presence_of :target_id, :target_type |
4 | validates_uniqueness_of :target_id, :scope => :target_type | 5 | validates_uniqueness_of :target_id, :scope => :target_type |
plugins/tolerance_time/lib/tolerance_time_plugin/tolerance.rb
1 | -class ToleranceTimePlugin::Tolerance < Noosfero::Plugin::ActiveRecord | 1 | +class ToleranceTimePlugin::Tolerance < ActiveRecord::Base |
2 | + | ||
2 | belongs_to :profile | 3 | belongs_to :profile |
3 | validates_presence_of :profile_id | 4 | validates_presence_of :profile_id |
4 | validates_uniqueness_of :profile_id | 5 | validates_uniqueness_of :profile_id |
5 | validates_numericality_of :content_tolerance, :only_integer => true, :allow_nil => true | 6 | validates_numericality_of :content_tolerance, :only_integer => true, :allow_nil => true |
6 | validates_numericality_of :comment_tolerance, :only_integer => true, :allow_nil => true | 7 | validates_numericality_of :comment_tolerance, :only_integer => true, :allow_nil => true |
7 | attr_accessible :profile, :content_tolerance, :comment_tolerance | 8 | attr_accessible :profile, :content_tolerance, :comment_tolerance |
9 | + | ||
8 | end | 10 | end |