Commit 295914e1c02f1f6066d2a7165f479ff649a90587

Authored by Braulio Bhavamitra
1 parent b3ca57de
Exists in rails5

rails5: drop unsecure and unsupported protected_attributes

Showing 173 changed files with 99 additions and 530 deletions   Show diff stats
@@ -49,7 +49,6 @@ gem 'sass-rails' @@ -49,7 +49,6 @@ gem 'sass-rails'
49 gem 'sprockets-rails', '~> 2.1' 49 gem 'sprockets-rails', '~> 2.1'
50 50
51 # gems to enable rails3 behaviour 51 # gems to enable rails3 behaviour
52 -gem 'protected_attributes'  
53 gem 'rails-observers', github: 'rails/rails-observers' 52 gem 'rails-observers', github: 'rails/rails-observers'
54 gem 'actionpack-page_caching' 53 gem 'actionpack-page_caching'
55 gem 'actionpack-action_caching' 54 gem 'actionpack-action_caching'
app/controllers/my_profile/cms_controller.rb
@@ -207,14 +207,11 @@ class CmsController < MyProfileController @@ -207,14 +207,11 @@ class CmsController < MyProfileController
207 params[:uploaded_files].each do |file| 207 params[:uploaded_files].each do |file|
208 unless file == '' 208 unless file == ''
209 @uploaded_files << UploadedFile.create( 209 @uploaded_files << UploadedFile.create(
210 - {  
211 - :uploaded_data => file,  
212 - :profile => profile,  
213 - :parent => @parent,  
214 - :last_changed_by => user,  
215 - :author => user,  
216 - },  
217 - :without_protection => true 210 + uploaded_data: file,
  211 + profile: profile,
  212 + parent: @parent,
  213 + last_changed_by: user,
  214 + author: user,
218 ) 215 )
219 end 216 end
220 end 217 end
app/controllers/my_profile/manage_products_controller.rb
@@ -86,7 +86,7 @@ class ManageProductsController &lt; ApplicationController @@ -86,7 +86,7 @@ class ManageProductsController &lt; ApplicationController
86 @edit = true 86 @edit = true
87 @level = @category.level 87 @level = @category.level
88 if request.post? 88 if request.post?
89 - if @product.update({:product_category_id => params[:selected_category_id]}, :without_protection => true) 89 + if @product.update product_category_id: params[:selected_category_id]
90 render :partial => 'shared/redirect_via_javascript', 90 render :partial => 'shared/redirect_via_javascript',
91 :locals => { :url => url_for(:controller => 'manage_products', :action => 'show', :id => @product) } 91 :locals => { :url => url_for(:controller => 'manage_products', :action => 'show', :id => @product) }
92 else 92 else
app/controllers/my_profile/profile_roles_controller.rb
@@ -12,7 +12,7 @@ class ProfileRolesController &lt; MyProfileController @@ -12,7 +12,7 @@ class ProfileRolesController &lt; MyProfileController
12 end 12 end
13 13
14 def create 14 def create
15 - @role = Role.new({:name => params[:role][:name], :permissions => params[:role][:permissions], :environment => environment }, :without_protection => true) 15 + @role = Role.new name: params[:role][:name], permissions: params[:role][:permissions], environment: environment
16 if @role.save 16 if @role.save
17 profile.custom_roles << @role 17 profile.custom_roles << @role
18 redirect_to :action => 'show', :id => @role 18 redirect_to :action => 'show', :id => @role
app/mailers/mailing.rb
@@ -4,8 +4,6 @@ class Mailing &lt; ActiveRecord::Base @@ -4,8 +4,6 @@ class Mailing &lt; ActiveRecord::Base
4 4
5 acts_as_having_settings :field => :data 5 acts_as_having_settings :field => :data
6 6
7 - attr_accessible :subject, :body, :data  
8 -  
9 validates_presence_of :source_id, :subject, :body 7 validates_presence_of :source_id, :subject, :body
10 belongs_to :source, :foreign_key => :source_id, :polymorphic => true 8 belongs_to :source, :foreign_key => :source_id, :polymorphic => true
11 belongs_to :person 9 belongs_to :person
app/models/abuse_report.rb
1 class AbuseReport < ActiveRecord::Base 1 class AbuseReport < ActiveRecord::Base
2 2
3 - attr_accessible :content, :reason  
4 -  
5 belongs_to :reporter, :class_name => 'Person' 3 belongs_to :reporter, :class_name => 'Person'
6 belongs_to :abuse_complaint 4 belongs_to :abuse_complaint
7 has_many :reported_images, :dependent => :destroy 5 has_many :reported_images, :dependent => :destroy
app/models/action_tracker_notification.rb
@@ -8,8 +8,6 @@ class ActionTrackerNotification &lt; ActiveRecord::Base @@ -8,8 +8,6 @@ class ActionTrackerNotification &lt; ActiveRecord::Base
8 validates_presence_of :profile_id, :action_tracker_id 8 validates_presence_of :profile_id, :action_tracker_id
9 validates_uniqueness_of :action_tracker_id, :scope => :profile_id 9 validates_uniqueness_of :action_tracker_id, :scope => :profile_id
10 10
11 - attr_accessible :profile_id, :action_tracker_id  
12 -  
13 end 11 end
14 12
15 ActionTracker::Record.has_many :action_tracker_notifications, :class_name => 'ActionTrackerNotification', :foreign_key => 'action_tracker_id', :dependent => :destroy 13 ActionTracker::Record.has_many :action_tracker_notifications, :class_name => 'ActionTrackerNotification', :foreign_key => 'action_tracker_id', :dependent => :destroy
app/models/approve_comment.rb
@@ -8,7 +8,7 @@ class ApproveComment &lt; Task @@ -8,7 +8,7 @@ class ApproveComment &lt; Task
8 def comment 8 def comment
9 unless @comment || self.comment_attributes.nil? 9 unless @comment || self.comment_attributes.nil?
10 @comment = Comment.new 10 @comment = Comment.new
11 - @comment.assign_attributes(ActiveSupport::JSON.decode(self.comment_attributes.to_s), :without_protection => true) 11 + @comment.assign_attributes ActiveSupport::JSON.decode(self.comment_attributes.to_s)
12 end 12 end
13 @comment 13 @comment
14 end 14 end
app/models/article.rb
1 1
2 class Article < ActiveRecord::Base 2 class Article < ActiveRecord::Base
3 3
4 - attr_accessible :name, :body, :abstract, :profile, :tag_list, :parent,  
5 - :allow_members_to_edit, :translation_of_id, :language,  
6 - :license_id, :parent_id, :display_posts_in_current_language,  
7 - :category_ids, :posts_per_page, :moderate_comments,  
8 - :accept_comments, :feed, :published, :source, :source_name,  
9 - :highlighted, :notify_comments, :display_hits, :slug,  
10 - :external_feed_builder, :display_versions, :external_link,  
11 - :image_builder, :show_to_followers,  
12 - :author, :display_preview, :published_at, :person_followers  
13 -  
14 acts_as_having_image 4 acts_as_having_image
15 include Noosfero::Plugin::HotSpot 5 include Noosfero::Plugin::HotSpot
16 6
app/models/article_block.rb
1 class ArticleBlock < Block 1 class ArticleBlock < Block
2 2
3 - attr_accessible :article_id  
4 -  
5 def self.description 3 def self.description
6 _('Display one of your contents.') 4 _('Display one of your contents.')
7 end 5 end
app/models/block.rb
1 class Block < ActiveRecord::Base 1 class Block < ActiveRecord::Base
2 2
3 - attr_accessible :title, :subtitle, :display, :limit, :box_id, :posts_per_page,  
4 - :visualization_format, :language, :display_user,  
5 - :box, :edit_modes, :move_modes, :mirror  
6 -  
7 include ActionView::Helpers::TagHelper 3 include ActionView::Helpers::TagHelper
8 4
9 # Block-specific stuff 5 # Block-specific stuff
app/models/blog.rb
1 class Blog < Folder 1 class Blog < Folder
2 2
3 - attr_accessible :visualization_format  
4 -  
5 acts_as_having_posts 3 acts_as_having_posts
6 include PostsLimit 4 include PostsLimit
7 5
@@ -55,7 +53,7 @@ class Blog &lt; Folder @@ -55,7 +53,7 @@ class Blog &lt; Folder
55 if self.external_feed(true) && self.external_feed.id == self.external_feed_data[:id].to_i 53 if self.external_feed(true) && self.external_feed.id == self.external_feed_data[:id].to_i
56 self.external_feed.attributes = self.external_feed_data.except(:id) 54 self.external_feed.attributes = self.external_feed_data.except(:id)
57 else 55 else
58 - self.build_external_feed(self.external_feed_data, :without_protection => true) 56 + self.build_external_feed self.external_feed_data
59 end 57 end
60 self.external_feed.valid? 58 self.external_feed.valid?
61 self.external_feed.errors.delete(:blog_id) # dont validate here relation: external_feed <-> blog 59 self.external_feed.errors.delete(:blog_id) # dont validate here relation: external_feed <-> blog
app/models/box.rb
@@ -5,8 +5,6 @@ class Box &lt; ActiveRecord::Base @@ -5,8 +5,6 @@ class Box &lt; ActiveRecord::Base
5 belongs_to :owner, :polymorphic => true 5 belongs_to :owner, :polymorphic => true
6 has_many :blocks, -> { order 'position' }, dependent: :destroy 6 has_many :blocks, -> { order 'position' }, dependent: :destroy
7 7
8 - attr_accessible :owner  
9 -  
10 include Noosfero::Plugin::HotSpot 8 include Noosfero::Plugin::HotSpot
11 9
12 scope :with_position, -> { where 'boxes.position > 0' } 10 scope :with_position, -> { where 'boxes.position > 0' }
app/models/categories_block.rb
@@ -8,8 +8,6 @@ class CategoriesBlock &lt; Block @@ -8,8 +8,6 @@ class CategoriesBlock &lt; Block
8 8
9 settings_items :category_types, :type => Array, :default => [] 9 settings_items :category_types, :type => Array, :default => []
10 10
11 - attr_accessible :category_types  
12 -  
13 def self.description 11 def self.description
14 _("Categories Menu") 12 _("Categories Menu")
15 end 13 end
app/models/category.rb
1 class Category < ActiveRecord::Base 1 class Category < ActiveRecord::Base
2 2
3 - attr_accessible :name, :parent_id, :display_color, :display_in_menu, :image_builder, :environment, :parent  
4 -  
5 SEARCHABLE_FIELDS = { 3 SEARCHABLE_FIELDS = {
6 :name => {:label => _('Name'), :weight => 10}, 4 :name => {:label => _('Name'), :weight => 10},
7 :acronym => {:label => _('Acronym'), :weight => 5}, 5 :acronym => {:label => _('Acronym'), :weight => 5},
app/models/certifier.rb
1 class Certifier < ActiveRecord::Base 1 class Certifier < ActiveRecord::Base
2 2
3 - attr_accessible :name, :environment  
4 -  
5 SEARCHABLE_FIELDS = { 3 SEARCHABLE_FIELDS = {
6 :name => {:label => _('Name'), :weight => 10}, 4 :name => {:label => _('Name'), :weight => 10},
7 :description => {:label => _('Description'), :weight => 3}, 5 :description => {:label => _('Description'), :weight => 3},
app/models/chat_message.rb
1 class ChatMessage < ActiveRecord::Base 1 class ChatMessage < ActiveRecord::Base
2 - attr_accessible :body, :from, :to  
3 2
4 belongs_to :to, :class_name => 'Profile' 3 belongs_to :to, :class_name => 'Profile'
5 belongs_to :from, :class_name => 'Profile' 4 belongs_to :from, :class_name => 'Profile'
6 5
7 validates_presence_of :from, :to 6 validates_presence_of :from, :to
  7 +
8 end 8 end
app/models/city.rb
1 class City < Region 1 class City < Region
2 - attr_accessible :name, :parent_id 2 +
3 end 3 end
app/models/comment.rb
@@ -6,8 +6,6 @@ class Comment &lt; ActiveRecord::Base @@ -6,8 +6,6 @@ class Comment &lt; ActiveRecord::Base
6 :body => {:label => _('Content'), :weight => 2}, 6 :body => {:label => _('Content'), :weight => 2},
7 } 7 }
8 8
9 - attr_accessible :body, :author, :name, :email, :title, :reply_of_id, :source, :follow_article  
10 -  
11 validates_presence_of :body 9 validates_presence_of :body
12 10
13 belongs_to :source, :counter_cache => true, :polymorphic => true 11 belongs_to :source, :counter_cache => true, :polymorphic => true
app/models/communities_block.rb
1 class CommunitiesBlock < ProfileListBlock 1 class CommunitiesBlock < ProfileListBlock
2 2
3 - attr_accessible :accessor_id, :accessor_type, :role_id, :resource_id, :resource_type  
4 -  
5 def self.description 3 def self.description
6 _("<p>Display all of your communities.</p><p>You could choose the amount of communities will be displayed and you could priorize that profiles with images.</p> <p>The view all button is always present in the block.</p>") 4 _("<p>Display all of your communities.</p><p>You could choose the amount of communities will be displayed and you could priorize that profiles with images.</p> <p>The view all button is always present in the block.</p>")
7 end 5 end
app/models/community.rb
1 class Community < Organization 1 class Community < Organization
2 2
3 - attr_accessible :accessor_id, :accessor_type, :role_id, :resource_id, :resource_type  
4 - attr_accessible :address_reference, :district, :tag_list, :language, :description  
5 after_destroy :check_invite_member_for_destroy 3 after_destroy :check_invite_member_for_destroy
6 4
7 def self.type_name 5 def self.type_name
app/models/create_community.rb
@@ -9,15 +9,11 @@ class CreateCommunity &lt; Task @@ -9,15 +9,11 @@ class CreateCommunity &lt; Task
9 alias :environment :target 9 alias :environment :target
10 alias :environment= :target= 10 alias :environment= :target=
11 11
12 - attr_accessible :environment, :requestor, :target  
13 - attr_accessible :reject_explanation, :template_id  
14 -  
15 acts_as_having_image 12 acts_as_having_image
16 13
17 DATA_FIELDS = Community.fields + ['name', 'closed', 'description'] 14 DATA_FIELDS = Community.fields + ['name', 'closed', 'description']
18 DATA_FIELDS.each do |field| 15 DATA_FIELDS.each do |field|
19 settings_items field.to_sym 16 settings_items field.to_sym
20 - attr_accessible field.to_sym  
21 end 17 end
22 18
23 settings_items :custom_values 19 settings_items :custom_values
app/models/custom_field.rb
1 class CustomField < ActiveRecord::Base 1 class CustomField < ActiveRecord::Base
2 - attr_accessible :name, :default_value, :format, :extras, :customized_type, :active, :required, :signup, :environment, :moderation_task 2 +
3 serialize :customized_type 3 serialize :customized_type
4 serialize :extras 4 serialize :extras
5 has_many :custom_field_values, :dependent => :delete_all 5 has_many :custom_field_values, :dependent => :delete_all
app/models/custom_field_value.rb
1 class CustomFieldValue < ActiveRecord::Base 1 class CustomFieldValue < ActiveRecord::Base
  2 +
2 belongs_to :custom_field 3 belongs_to :custom_field
3 belongs_to :customized, :polymorphic => true 4 belongs_to :customized, :polymorphic => true
4 - attr_accessible :value, :public, :customized, :custom_field, :customized_type 5 +
5 validate :can_save? 6 validate :can_save?
6 7
7 def can_save? 8 def can_save?
app/models/domain.rb
@@ -2,8 +2,6 @@ require &#39;noosfero/multi_tenancy&#39; @@ -2,8 +2,6 @@ require &#39;noosfero/multi_tenancy&#39;
2 2
3 class Domain < ActiveRecord::Base 3 class Domain < ActiveRecord::Base
4 4
5 - attr_accessible :name, :owner, :is_default  
6 -  
7 # relationships 5 # relationships
8 ############### 6 ###############
9 7
app/models/enterprise.rb
@@ -2,8 +2,6 @@ @@ -2,8 +2,6 @@
2 # only enterprises can offer products and services. 2 # only enterprises can offer products and services.
3 class Enterprise < Organization 3 class Enterprise < Organization
4 4
5 - attr_accessible :business_name, :address_reference, :district, :tag_list, :organization_website, :historic_and_current_context, :activities_short_description, :products_per_catalog_page  
6 -  
7 SEARCH_FILTERS = { 5 SEARCH_FILTERS = {
8 :order => %w[more_recent more_popular more_active], 6 :order => %w[more_recent more_popular more_active],
9 :display => %w[compact full map] 7 :display => %w[compact full map]
app/models/environment.rb
@@ -3,18 +3,6 @@ @@ -3,18 +3,6 @@
3 # domains. 3 # domains.
4 class Environment < ActiveRecord::Base 4 class Environment < ActiveRecord::Base
5 5
6 - attr_accessible :name, :is_default, :signup_welcome_text_subject,  
7 - :signup_welcome_text_body, :terms_of_use,  
8 - :message_for_disabled_enterprise, :news_amount_by_folder,  
9 - :default_language, :languages, :description,  
10 - :organization_approval_method, :enabled_plugins,  
11 - :enabled_features, :redirection_after_login,  
12 - :redirection_after_signup, :contact_email, :theme,  
13 - :reports_lower_bound, :noreply_email,  
14 - :signup_welcome_screen_body, :members_whitelist_enabled,  
15 - :members_whitelist, :highlighted_news_amount,  
16 - :portal_news_amount, :date_format, :signup_intro  
17 -  
18 has_many :users 6 has_many :users
19 7
20 # allow roles use 8 # allow roles use
app/models/event.rb
@@ -3,8 +3,6 @@ require &#39;builder&#39; @@ -3,8 +3,6 @@ require &#39;builder&#39;
3 3
4 class Event < Article 4 class Event < Article
5 5
6 - attr_accessible :start_date, :end_date, :link, :address  
7 -  
8 def self.type_name 6 def self.type_name
9 _('Event') 7 _('Event')
10 end 8 end
app/models/external_feed.rb
@@ -10,8 +10,6 @@ class ExternalFeed &lt; ActiveRecord::Base @@ -10,8 +10,6 @@ class ExternalFeed &lt; ActiveRecord::Base
10 where '(fetched_at is NULL) OR (fetched_at < ?)', Time.now - FeedUpdater.update_interval 10 where '(fetched_at is NULL) OR (fetched_at < ?)', Time.now - FeedUpdater.update_interval
11 } 11 }
12 12
13 - attr_accessible :address, :enabled, :only_once  
14 -  
15 def add_item(title, link, date, content) 13 def add_item(title, link, date, content)
16 return if content.blank? 14 return if content.blank?
17 doc = Nokogiri::HTML.fragment content 15 doc = Nokogiri::HTML.fragment content
app/models/favorite_enterprise_person.rb
1 class FavoriteEnterprisePerson < ActiveRecord::Base 1 class FavoriteEnterprisePerson < ActiveRecord::Base
2 2
3 - attr_accessible :person, :enterprise  
4 -  
5 track_actions :favorite_enterprise, :after_create, keep_params: [:enterprise_name, :enterprise_url], if: proc{ |f| f.is_trackable? } 3 track_actions :favorite_enterprise, :after_create, keep_params: [:enterprise_name, :enterprise_url], if: proc{ |f| f.is_trackable? }
6 4
7 belongs_to :enterprise 5 belongs_to :enterprise
app/models/featured_products_block.rb
1 class FeaturedProductsBlock < Block 1 class FeaturedProductsBlock < Block
2 2
3 - attr_accessible :product_ids, :groups_of, :speed, :reflect  
4 -  
5 settings_items :product_ids, :type => Array, :default => [] 3 settings_items :product_ids, :type => Array, :default => []
6 settings_items :groups_of, :type => :integer, :default => 3 4 settings_items :groups_of, :type => :integer, :default => 3
7 settings_items :speed, :type => :integer, :default => 1000 5 settings_items :speed, :type => :integer, :default => 1000
app/models/feed_reader_block.rb
1 class FeedReaderBlock < Block 1 class FeedReaderBlock < Block
2 2
3 - attr_accessible :address, :update_errors  
4 -  
5 def initialize(attributes = nil, options = {}) 3 def initialize(attributes = nil, options = {})
6 data = attributes || {} 4 data = attributes || {}
7 super(data) 5 super(data)
app/models/forum.rb
@@ -3,8 +3,6 @@ class Forum &lt; Folder @@ -3,8 +3,6 @@ class Forum &lt; Folder
3 acts_as_having_posts -> { reorder 'updated_at DESC' } 3 acts_as_having_posts -> { reorder 'updated_at DESC' }
4 include PostsLimit 4 include PostsLimit
5 5
6 - attr_accessible :has_terms_of_use, :terms_of_use, :topic_creation  
7 -  
8 settings_items :terms_of_use, :type => :string, :default => "" 6 settings_items :terms_of_use, :type => :string, :default => ""
9 settings_items :has_terms_of_use, :type => :boolean, :default => false 7 settings_items :has_terms_of_use, :type => :boolean, :default => false
10 settings_items :topic_creation, :type => :string, :default => 'self' 8 settings_items :topic_creation, :type => :string, :default => 'self'
app/models/highlights_block.rb
1 class HighlightsBlock < Block 1 class HighlightsBlock < Block
2 2
3 - attr_accessible :images, :interval, :shuffle, :navigation  
4 -  
5 settings_items :images, :type => Array, :default => [] 3 settings_items :images, :type => Array, :default => []
6 settings_items :interval, :type => 'integer', :default => 4 4 settings_items :interval, :type => 'integer', :default => 4
7 settings_items :shuffle, :type => 'boolean', :default => false 5 settings_items :shuffle, :type => 'boolean', :default => false
app/models/image.rb
1 class Image < ActiveRecord::Base 1 class Image < ActiveRecord::Base
2 2
3 - attr_accessible :uploaded_data, :label, :remove_image  
4 attr_accessor :remove_image 3 attr_accessor :remove_image
5 4
6 def self.max_size 5 def self.max_size
app/models/input.rb
1 class Input < ActiveRecord::Base 1 class Input < ActiveRecord::Base
2 2
3 - attr_accessible :product, :product_id, :product_category, :product_category_id,  
4 - :amount_used, :unit_id, :price_per_unit, :relevant_to_price, :is_from_solidarity_economy  
5 -  
6 belongs_to :product 3 belongs_to :product
7 belongs_to :product_category 4 belongs_to :product_category
8 5
app/models/license.rb
1 class License < ActiveRecord::Base 1 class License < ActiveRecord::Base
2 2
3 - attr_accessible :name, :url  
4 -  
5 SEARCHABLE_FIELDS = { 3 SEARCHABLE_FIELDS = {
6 :name => {:label => _('Name'), :weight => 10}, 4 :name => {:label => _('Name'), :weight => 10},
7 :url => {:label => _('URL'), :weight => 5}, 5 :url => {:label => _('URL'), :weight => 5},
@@ -14,8 +12,6 @@ class License &lt; ActiveRecord::Base @@ -14,8 +12,6 @@ class License &lt; ActiveRecord::Base
14 validates_presence_of :slug, :if => lambda {|license| license.name.present?} 12 validates_presence_of :slug, :if => lambda {|license| license.name.present?}
15 validates_uniqueness_of :slug, :scope => :environment_id 13 validates_uniqueness_of :slug, :scope => :environment_id
16 14
17 - attr_accessible :environment, :slug  
18 -  
19 before_validation do |license| 15 before_validation do |license|
20 license.slug ||= license.name.to_slug if license.name.present? 16 license.slug ||= license.name.to_slug if license.name.present?
21 end 17 end
app/models/link_article.rb
1 class LinkArticle < Article 1 class LinkArticle < Article
2 2
3 - attr_accessible :reference_article  
4 -  
5 def self.short_description 3 def self.short_description
6 "Article link" 4 "Article link"
7 end 5 end
app/models/link_list_block.rb
1 class LinkListBlock < Block 1 class LinkListBlock < Block
2 2
3 - attr_accessible :links  
4 -  
5 ICONS = [ 3 ICONS = [
6 ['no-icon', _('(No icon)')], 4 ['no-icon', _('(No icon)')],
7 ['edit', N_('Edit')], 5 ['edit', N_('Edit')],
app/models/location_block.rb
1 class LocationBlock < Block 1 class LocationBlock < Block
2 2
3 - attr_accessible :zoom, :map_type  
4 -  
5 settings_items :zoom, :type => :integer, :default => 4 3 settings_items :zoom, :type => :integer, :default => 4
6 settings_items :map_type, :type => :string, :default => 'roadmap' 4 settings_items :map_type, :type => :string, :default => 'roadmap'
7 5
app/models/mailing_sent.rb
1 class MailingSent < ActiveRecord::Base 1 class MailingSent < ActiveRecord::Base
2 - attr_accessible :person 2 +
3 belongs_to :mailing 3 belongs_to :mailing
4 belongs_to :person 4 belongs_to :person
  5 +
5 end 6 end
app/models/my_network_block.rb
1 class MyNetworkBlock < Block 1 class MyNetworkBlock < Block
2 2
3 - attr_accessible :display, :box  
4 -  
5 def self.description 3 def self.description
6 _('My network') 4 _('My network')
7 end 5 end
app/models/organization.rb
1 # Represents any organization of the system 1 # Represents any organization of the system
2 class Organization < Profile 2 class Organization < Profile
3 3
4 - attr_accessible :moderated_articles, :foundation_year, :contact_person, :acronym, :legal_form, :economic_activity, :management_information, :cnpj, :display_name, :enable_contact_us  
5 -  
6 SEARCH_FILTERS = { 4 SEARCH_FILTERS = {
7 :order => %w[more_recent more_popular more_active], 5 :order => %w[more_recent more_popular more_active],
8 :display => %w[compact] 6 :display => %w[compact]
app/models/person.rb
1 # A person is the profile of an user holding all relationships with the rest of the system 1 # A person is the profile of an user holding all relationships with the rest of the system
2 class Person < Profile 2 class Person < Profile
3 3
4 - attr_accessible :organization, :contact_information, :sex, :birth_date, :cell_phone, :comercial_phone, :jabber_id, :personal_website, :nationality, :address_reference, :district, :schooling, :schooling_status, :formation, :custom_formation, :area_of_study, :custom_area_of_study, :professional_activity, :organization_website, :following_articles  
5 -  
6 SEARCH_FILTERS = { 4 SEARCH_FILTERS = {
7 :order => %w[more_recent more_popular more_active], 5 :order => %w[more_recent more_popular more_active],
8 :display => %w[compact] 6 :display => %w[compact]
9 } 7 }
10 8
11 -  
12 def self.type_name 9 def self.type_name
13 _('Person') 10 _('Person')
14 end 11 end
app/models/price_detail.rb
1 class PriceDetail < ActiveRecord::Base 1 class PriceDetail < ActiveRecord::Base
2 2
3 - attr_accessible :price, :production_cost_id  
4 -  
5 belongs_to :product 3 belongs_to :product
6 validates_presence_of :product_id 4 validates_presence_of :product_id
7 5
app/models/product.rb
@@ -10,9 +10,6 @@ class Product &lt; ActiveRecord::Base @@ -10,9 +10,6 @@ class Product &lt; ActiveRecord::Base
10 :display => %w[full map] 10 :display => %w[full map]
11 } 11 }
12 12
13 - attr_accessible :name, :product_category, :profile, :profile_id, :enterprise,  
14 - :highlighted, :price, :image_builder, :description, :available, :qualifiers, :unit_id, :discount, :inputs, :qualifiers_list  
15 -  
16 def self.default_search_display 13 def self.default_search_display
17 'full' 14 'full'
18 end 15 end
app/models/product_category.rb
@@ -3,8 +3,6 @@ class ProductCategory &lt; Category @@ -3,8 +3,6 @@ class ProductCategory &lt; Category
3 has_many :products 3 has_many :products
4 has_many :inputs 4 has_many :inputs
5 5
6 - attr_accessible :name, :parent, :environment  
7 -  
8 scope :unique, -> { select 'DISTINCT ON (path) categories.*' } 6 scope :unique, -> { select 'DISTINCT ON (path) categories.*' }
9 scope :by_enterprise, -> enterprise { 7 scope :by_enterprise, -> enterprise {
10 distinct.joins(:products). 8 distinct.joins(:products).
app/models/product_qualifier.rb
1 class ProductQualifier < ActiveRecord::Base 1 class ProductQualifier < ActiveRecord::Base
2 2
3 - attr_accessible :qualifier, :product, :certifier  
4 -  
5 belongs_to :qualifier 3 belongs_to :qualifier
6 belongs_to :product 4 belongs_to :product
7 belongs_to :certifier 5 belongs_to :certifier
  6 +
8 end 7 end
app/models/production_cost.rb
1 class ProductionCost < ActiveRecord::Base 1 class ProductionCost < ActiveRecord::Base
2 2
3 - attr_accessible :name, :owner  
4 -  
5 belongs_to :owner, :polymorphic => true 3 belongs_to :owner, :polymorphic => true
  4 +
6 validates_presence_of :owner 5 validates_presence_of :owner
7 validates_presence_of :name 6 validates_presence_of :name
8 validates_length_of :name, :maximum => 30, :allow_blank => true 7 validates_length_of :name, :maximum => 30, :allow_blank => true
app/models/products_block.rb
1 class ProductsBlock < Block 1 class ProductsBlock < Block
2 2
3 - attr_accessible :product_ids  
4 -  
5 include ActionView::Helpers::TagHelper 3 include ActionView::Helpers::TagHelper
6 include ActionView::Helpers::UrlHelper 4 include ActionView::Helpers::UrlHelper
7 include ActionView::Helpers 5 include ActionView::Helpers
app/models/profile.rb
@@ -3,10 +3,6 @@ @@ -3,10 +3,6 @@
3 # which by default is the one returned by Environment:default. 3 # which by default is the one returned by Environment:default.
4 class Profile < ActiveRecord::Base 4 class Profile < ActiveRecord::Base
5 5
6 - attr_accessible :name, :identifier, :public_profile, :nickname, :custom_footer, :custom_header, :address, :zip_code, :contact_phone, :image_builder, :description, :closed, :template_id, :environment, :lat, :lng, :is_template, :fields_privacy, :preferred_domain_id, :category_ids, :country, :city, :state, :national_region_code, :email, :contact_email, :redirect_l10n, :notification_time,  
7 - :redirection_after_login, :custom_url_redirection,  
8 - :email_suggestions, :allow_members_to_invite, :invite_friends_only, :secret, :profile_admin_mail_notification  
9 -  
10 # use for internationalizable human type names in search facets 6 # use for internationalizable human type names in search facets
11 # reimplement on subclasses 7 # reimplement on subclasses
12 def self.type_name 8 def self.type_name
app/models/profile_activity.rb
@@ -2,9 +2,6 @@ class ProfileActivity &lt; ActiveRecord::Base @@ -2,9 +2,6 @@ class ProfileActivity &lt; ActiveRecord::Base
2 2
3 self.record_timestamps = false 3 self.record_timestamps = false
4 4
5 - attr_accessible :profile_id,  
6 - :profile, :activity  
7 -  
8 belongs_to :profile 5 belongs_to :profile
9 belongs_to :activity, polymorphic: true 6 belongs_to :activity, polymorphic: true
10 7
app/models/profile_image_block.rb
1 class ProfileImageBlock < Block 1 class ProfileImageBlock < Block
2 2
3 - attr_accessible :show_name  
4 -  
5 settings_items :show_name, :type => :boolean, :default => false 3 settings_items :show_name, :type => :boolean, :default => false
6 4
7 def self.description 5 def self.description
app/models/profile_list_block.rb
1 class ProfileListBlock < Block 1 class ProfileListBlock < Block
2 2
3 - attr_accessible :prioritize_profiles_with_image  
4 -  
5 settings_items :limit, :type => :integer, :default => 6 3 settings_items :limit, :type => :integer, :default => 6
6 settings_items :prioritize_profiles_with_image, :type => :boolean, :default => true 4 settings_items :prioritize_profiles_with_image, :type => :boolean, :default => true
7 5
app/models/profile_suggestion.rb
1 class ProfileSuggestion < ActiveRecord::Base 1 class ProfileSuggestion < ActiveRecord::Base
  2 +
2 belongs_to :person 3 belongs_to :person
3 belongs_to :suggestion, :class_name => 'Profile', :foreign_key => :suggestion_id 4 belongs_to :suggestion, :class_name => 'Profile', :foreign_key => :suggestion_id
4 5
5 - attr_accessible :person, :suggestion, :suggestion_type, :categories, :enabled  
6 -  
7 has_many :suggestion_connections, :foreign_key => 'suggestion_id' 6 has_many :suggestion_connections, :foreign_key => 'suggestion_id'
8 has_many :profile_connections, :through => :suggestion_connections, :source => :connection, :source_type => 'Profile' 7 has_many :profile_connections, :through => :suggestion_connections, :source => :connection, :source_type => 'Profile'
9 has_many :tag_connections, :through => :suggestion_connections, :source => :connection, :source_type => 'ActsAsTaggableOn::Tag' 8 has_many :tag_connections, :through => :suggestion_connections, :source => :connection, :source_type => 'ActsAsTaggableOn::Tag'
@@ -67,7 +66,6 @@ class ProfileSuggestion &lt; ActiveRecord::Base @@ -67,7 +66,6 @@ class ProfileSuggestion &lt; ActiveRecord::Base
67 66
68 RULES.keys.each do |rule| 67 RULES.keys.each do |rule|
69 settings_items rule 68 settings_items rule
70 - attr_accessible rule  
71 end 69 end
72 70
73 # Number of suggestions by rule 71 # Number of suggestions by rule
app/models/qualifier.rb
1 class Qualifier < ActiveRecord::Base 1 class Qualifier < ActiveRecord::Base
2 2
3 - attr_accessible :name, :environment  
4 -  
5 SEARCHABLE_FIELDS = { 3 SEARCHABLE_FIELDS = {
6 :name => {:label => _('Name'), :weight => 1}, 4 :name => {:label => _('Name'), :weight => 1},
7 } 5 }
app/models/raw_html_block.rb
@@ -10,8 +10,6 @@ class RawHTMLBlock &lt; Block @@ -10,8 +10,6 @@ class RawHTMLBlock &lt; Block
10 10
11 settings_items :html, :type => :text 11 settings_items :html, :type => :text
12 12
13 - attr_accessible :html  
14 -  
15 def has_macro? 13 def has_macro?
16 true 14 true
17 end 15 end
app/models/region.rb
1 # Region is a special type of category that is related to geographical issues. 1 # Region is a special type of category that is related to geographical issues.
2 class Region < Category 2 class Region < Category
3 3
4 - attr_accessible :name  
5 -  
6 has_and_belongs_to_many :validators, :class_name => 'Organization', :join_table => :region_validators 4 has_and_belongs_to_many :validators, :class_name => 'Organization', :join_table => :region_validators
7 5
8 require_dependency 'enterprise' # enterprises can also be validators 6 require_dependency 'enterprise' # enterprises can also be validators
app/models/rss_feed.rb
1 class RssFeed < Article 1 class RssFeed < Article
2 2
3 - attr_accessible :limit, :enabled, :language, :include, :feed_item_description  
4 -  
5 def self.type_name 3 def self.type_name
6 _('RssFeed') 4 _('RssFeed')
7 end 5 end
app/models/scrap.rb
1 class Scrap < ActiveRecord::Base 1 class Scrap < ActiveRecord::Base
2 2
3 - attr_accessible :content, :sender_id, :receiver_id, :scrap_id  
4 -  
5 SEARCHABLE_FIELDS = { 3 SEARCHABLE_FIELDS = {
6 :content => {:label => _('Content'), :weight => 1}, 4 :content => {:label => _('Content'), :weight => 1},
7 } 5 }
app/models/search_term.rb
@@ -5,8 +5,6 @@ class SearchTerm &lt; ActiveRecord::Base @@ -5,8 +5,6 @@ class SearchTerm &lt; ActiveRecord::Base
5 belongs_to :context, :polymorphic => true 5 belongs_to :context, :polymorphic => true
6 has_many :occurrences, :class_name => 'SearchTermOccurrence' 6 has_many :occurrences, :class_name => 'SearchTermOccurrence'
7 7
8 - attr_accessible :term, :context, :asset  
9 -  
10 def self.calculate_scores 8 def self.calculate_scores
11 os = occurrences_scores 9 os = occurrences_scores
12 find_each { |search_term| search_term.calculate_score(os) } 10 find_each { |search_term| search_term.calculate_score(os) }
app/models/search_term_occurrence.rb
@@ -2,7 +2,6 @@ class SearchTermOccurrence &lt; ActiveRecord::Base @@ -2,7 +2,6 @@ class SearchTermOccurrence &lt; ActiveRecord::Base
2 2
3 belongs_to :search_term 3 belongs_to :search_term
4 validates_presence_of :search_term 4 validates_presence_of :search_term
5 - attr_accessible :search_term, :created_at, :total, :indexed  
6 5
7 EXPIRATION_TIME = 1.year 6 EXPIRATION_TIME = 1.year
8 7
app/models/sellers_search_block.rb
1 class SellersSearchBlock < Block 1 class SellersSearchBlock < Block
2 2
3 - attr_accessible :title  
4 -  
5 def self.description 3 def self.description
6 _('Search for enterprises and products') 4 _('Search for enterprises and products')
7 end 5 end
app/models/slideshow_block.rb
@@ -6,8 +6,6 @@ class SlideshowBlock &lt; Block @@ -6,8 +6,6 @@ class SlideshowBlock &lt; Block
6 settings_items :navigation, :type => 'boolean', :default => false 6 settings_items :navigation, :type => 'boolean', :default => false
7 settings_items :image_size, :type => 'string', :default => 'thumb' 7 settings_items :image_size, :type => 'string', :default => 'thumb'
8 8
9 - attr_accessible :gallery_id, :image_size, :interval, :shuffle, :navigation  
10 -  
11 def self.description 9 def self.description
12 _('Slideshow') 10 _('Slideshow')
13 end 11 end
app/models/state.rb
1 class State < Region 1 class State < Region
2 - attr_accessible :name, :acronym, :environment 2 +
3 end 3 end
app/models/suggestion_connection.rb
1 class SuggestionConnection < ActiveRecord::Base 1 class SuggestionConnection < ActiveRecord::Base
2 - attr_accessible :suggestion, :suggestion_id, :connection_type, :connection_id  
3 2
4 belongs_to :suggestion, :class_name => 'ProfileSuggestion', :foreign_key => 'suggestion_id' 3 belongs_to :suggestion, :class_name => 'ProfileSuggestion', :foreign_key => 'suggestion_id'
5 belongs_to :connection, :polymorphic => true 4 belongs_to :connection, :polymorphic => true
  5 +
6 end 6 end
app/models/tag.rb
1 Tag = ActsAsTaggableOn::Tag 1 Tag = ActsAsTaggableOn::Tag
2 class Tag 2 class Tag
3 3
4 - attr_accessible :name, :parent_id, :pending  
5 -  
6 has_many :children, class_name: 'Tag', foreign_key: 'parent_id', dependent: :destroy 4 has_many :children, class_name: 'Tag', foreign_key: 'parent_id', dependent: :destroy
7 5
8 @@original_find = self.method(:find) 6 @@original_find = self.method(:find)
app/models/task.rb
@@ -41,8 +41,6 @@ class Task &lt; ActiveRecord::Base @@ -41,8 +41,6 @@ class Task &lt; ActiveRecord::Base
41 validates_uniqueness_of :code, :on => :create 41 validates_uniqueness_of :code, :on => :create
42 validates_presence_of :code 42 validates_presence_of :code
43 43
44 - attr_protected :status  
45 -  
46 settings_items :email_template_id, :type => :integer 44 settings_items :email_template_id, :type => :integer
47 45
48 def initialize(*args) 46 def initialize(*args)
app/models/thumbnail.rb
1 class Thumbnail < ActiveRecord::Base 1 class Thumbnail < ActiveRecord::Base
2 2
3 - attr_accessible :uploaded_data  
4 - # mass assigned by attachment_fu  
5 - attr_accessible :content_type, :filename, :thumbnail_resize_options, :thumbnail, :parent_id  
6 -  
7 has_attachment :storage => :file_system, 3 has_attachment :storage => :file_system,
8 :content_type => :image, :max_size => UploadedFile.max_size, processor: 'Rmagick' 4 :content_type => :image, :max_size => UploadedFile.max_size, processor: 'Rmagick'
9 validates_as_attachment 5 validates_as_attachment
app/models/unit.rb
@@ -2,8 +2,6 @@ class Unit &lt; ActiveRecord::Base @@ -2,8 +2,6 @@ class Unit &lt; ActiveRecord::Base
2 2
3 acts_as_list scope: -> unit { where environment_id: unit.environment_id } 3 acts_as_list scope: -> unit { where environment_id: unit.environment_id }
4 4
5 - attr_accessible :name, :singular, :plural, :environment  
6 -  
7 validates_presence_of :singular 5 validates_presence_of :singular
8 validates_presence_of :plural 6 validates_presence_of :plural
9 7
app/models/uploaded_file.rb
@@ -7,8 +7,6 @@ require &#39;sdbm&#39; @@ -7,8 +7,6 @@ require &#39;sdbm&#39;
7 7
8 class UploadedFile < Article 8 class UploadedFile < Article
9 9
10 - attr_accessible :uploaded_data, :title  
11 -  
12 def self.type_name 10 def self.type_name
13 _('File') 11 _('File')
14 end 12 end
app/models/user.rb
@@ -6,8 +6,6 @@ require &#39;securerandom&#39; @@ -6,8 +6,6 @@ require &#39;securerandom&#39;
6 # Rails generator. 6 # Rails generator.
7 class User < ActiveRecord::Base 7 class User < ActiveRecord::Base
8 8
9 - attr_accessible :login, :email, :password, :password_confirmation, :activated_at  
10 -  
11 N_('Password') 9 N_('Password')
12 N_('Password confirmation') 10 N_('Password confirmation')
13 N_('Terms accepted') 11 N_('Terms accepted')
@@ -110,8 +108,6 @@ class User &lt; ActiveRecord::Base @@ -110,8 +108,6 @@ class User &lt; ActiveRecord::Base
110 # holds the current session, see lib/authenticated_system.rb 108 # holds the current session, see lib/authenticated_system.rb
111 attr_accessor :session 109 attr_accessor :session
112 110
113 - attr_protected :activated_at  
114 -  
115 # Virtual attribute for the unencrypted password 111 # Virtual attribute for the unencrypted password
116 attr_accessor :password, :name 112 attr_accessor :password, :name
117 113
app/models/validation_info.rb
1 class ValidationInfo < ActiveRecord::Base 1 class ValidationInfo < ActiveRecord::Base
2 2
3 - attr_accessible :validation_methodology, :restrictions, :organization  
4 -  
5 belongs_to :organization 3 belongs_to :organization
6 4
7 validates_presence_of :organization 5 validates_presence_of :organization
config/application.rb
@@ -72,12 +72,6 @@ module Noosfero @@ -72,12 +72,6 @@ module Noosfero
72 # like if you have constraints or database-specific column types 72 # like if you have constraints or database-specific column types
73 # config.active_record.schema_format = :sql 73 # config.active_record.schema_format = :sql
74 74
75 - # Enforce whitelist mode for mass assignment.  
76 - # This will create an empty whitelist of attributes available for mass-assignment for all models  
77 - # in your app. As such, your models will need to explicitly whitelist or blacklist accessible  
78 - # parameters by using an attr_accessible or attr_protected declaration.  
79 - config.active_record.whitelist_attributes = true  
80 -  
81 # Asset pipeline 75 # Asset pipeline
82 config.assets.paths = 76 config.assets.paths =
83 Dir.glob("app/assets/plugins/*/{,stylesheets,javascripts}") + 77 Dir.glob("app/assets/plugins/*/{,stylesheets,javascripts}") +
config/environments/development.rb
@@ -20,9 +20,6 @@ Noosfero::Application.configure do @@ -20,9 +20,6 @@ Noosfero::Application.configure do
20 # Only use best-standards-support built into browsers 20 # Only use best-standards-support built into browsers
21 config.action_dispatch.best_standards_support = :builtin 21 config.action_dispatch.best_standards_support = :builtin
22 22
23 - # Raise exception on mass assignment protection for Active Record models  
24 - config.active_record.mass_assignment_sanitizer = :strict  
25 -  
26 # Do not compress assets 23 # Do not compress assets
27 config.assets.compress = false 24 config.assets.compress = false
28 config.assets.digest = false 25 config.assets.digest = false
config/environments/test.rb
@@ -25,9 +25,6 @@ Noosfero::Application.configure do @@ -25,9 +25,6 @@ Noosfero::Application.configure do
25 # ActionMailer::Base.deliveries array. 25 # ActionMailer::Base.deliveries array.
26 config.action_mailer.delivery_method = :test 26 config.action_mailer.delivery_method = :test
27 27
28 - # Raise exception on mass assignment protection for Active Record models  
29 - config.active_record.mass_assignment_sanitizer = :strict  
30 -  
31 # Print deprecation notices to the stderr 28 # Print deprecation notices to the stderr
32 config.active_support.deprecation = :stderr 29 config.active_support.deprecation = :stderr
33 end 30 end
config/initializers/03_protected_attributes.rb
@@ -1,6 +0,0 @@ @@ -1,6 +0,0 @@
1 -class Delayed::Backend::ActiveRecord::Job  
2 - # rake db:schema:load run?  
3 - if self.table_exists?  
4 - attr_accessible *self.column_names, :payload_object  
5 - end  
6 -end  
features/step_definitions/noosfero_steps.rb
@@ -31,7 +31,7 @@ Given /^the following (community|communities|enterprises?|organizations?)$/ do | @@ -31,7 +31,7 @@ Given /^the following (community|communities|enterprises?|organizations?)$/ do |
31 category = row.delete("category") 31 category = row.delete("category")
32 img_name = row.delete("img") 32 img_name = row.delete("img")
33 city = row.delete("region") 33 city = row.delete("region")
34 - organization = klass.create!(row, :without_protection => true) 34 + organization = klass.create! row
35 if owner 35 if owner
36 organization.add_admin(Profile[owner]) 36 organization.add_admin(Profile[owner])
37 end 37 end
@@ -204,7 +204,7 @@ Given /^the following products?$/ do |table| @@ -204,7 +204,7 @@ Given /^the following products?$/ do |table|
204 qualifier = Qualifier.find_by name: data.delete("qualifier") 204 qualifier = Qualifier.find_by name: data.delete("qualifier")
205 data.merge!(:qualifiers => [qualifier]) 205 data.merge!(:qualifiers => [qualifier])
206 end 206 end
207 - product = Product.create!(data, :without_protection => true) 207 + product = Product.create! data
208 end 208 end
209 end 209 end
210 210
@@ -215,8 +215,8 @@ Given /^the following inputs?$/ do |table| @@ -215,8 +215,8 @@ Given /^the following inputs?$/ do |table|
215 category = Category.find_by slug: data.delete("category").to_slug 215 category = Category.find_by slug: data.delete("category").to_slug
216 unit = Unit.find_by singular: data.delete("unit") 216 unit = Unit.find_by singular: data.delete("unit")
217 solidary = data.delete("solidary") 217 solidary = data.delete("solidary")
218 - input = Input.create!(data.merge(:product => product, :product_category => category, :unit => unit,  
219 - :is_from_solidarity_economy => solidary), :without_protection => true) 218 + input = Input.create! data.merge(product: product, product_category: category, unit: unit,
  219 + is_from_solidarity_economy: solidary)
220 input.update_attribute(:position, data['position']) 220 input.update_attribute(:position, data['position'])
221 end 221 end
222 end 222 end
@@ -254,7 +254,7 @@ end @@ -254,7 +254,7 @@ end
254 254
255 Given /^the following qualifiers$/ do |table| 255 Given /^the following qualifiers$/ do |table|
256 table.hashes.each do |row| 256 table.hashes.each do |row|
257 - Qualifier.create!(row.merge(:environment_id => 1), :without_protection => true) 257 + Qualifier.create! row.merge(environment_id: 1)
258 end 258 end
259 end 259 end
260 260
@@ -265,7 +265,7 @@ Given /^the following certifiers$/ do |table| @@ -265,7 +265,7 @@ Given /^the following certifiers$/ do |table|
265 if qualifiers_list 265 if qualifiers_list
266 row["qualifiers"] = qualifiers_list.split(', ').map{|i| Qualifier.find_by name: i } 266 row["qualifiers"] = qualifiers_list.split(', ').map{|i| Qualifier.find_by name: i }
267 end 267 end
268 - Certifier.create!(row.merge(:environment_id => 1), :without_protection => true) 268 + Certifier.create! row.merge(environment_id: 1)
269 end 269 end
270 end 270 end
271 271
@@ -505,7 +505,7 @@ end @@ -505,7 +505,7 @@ end
505 505
506 Given /^the following units?$/ do |table| 506 Given /^the following units?$/ do |table|
507 table.hashes.each do |row| 507 table.hashes.each do |row|
508 - Unit.create!(row.merge(:environment_id => 1), :without_protection => true) 508 + Unit.create! row.merge(environment_id: 1)
509 end 509 end
510 end 510 end
511 511
lib/acts_as_customizable.rb
1 module Customizable 1 module Customizable
2 2
3 def self.included(base) 3 def self.included(base)
4 - base.attr_accessible :custom_values  
5 base.extend ClassMethods 4 base.extend ClassMethods
6 end 5 end
7 6
lib/acts_as_having_image.rb
@@ -5,7 +5,6 @@ module ActsAsHavingImage @@ -5,7 +5,6 @@ module ActsAsHavingImage
5 belongs_to :image, dependent: :destroy 5 belongs_to :image, dependent: :destroy
6 scope :with_image, -> { where "#{table_name}.image_id IS NOT NULL" } 6 scope :with_image, -> { where "#{table_name}.image_id IS NOT NULL" }
7 scope :without_image, -> { where "#{table_name}.image_id IS NULL" } 7 scope :without_image, -> { where "#{table_name}.image_id IS NULL" }
8 - attr_accessible :image_builder  
9 include ActsAsHavingImage 8 include ActsAsHavingImage
10 end 9 end
11 end 10 end
plugins/analytics/models/analytics_plugin/page_view.rb
@@ -2,11 +2,7 @@ class AnalyticsPlugin::PageView &lt; ActiveRecord::Base @@ -2,11 +2,7 @@ class AnalyticsPlugin::PageView &lt; ActiveRecord::Base
2 2
3 serialize :data 3 serialize :data
4 4
5 - attr_accessible *self.column_names  
6 - attr_accessible :user, :profile  
7 -  
8 attr_accessor :request 5 attr_accessor :request
9 - attr_accessible :request  
10 6
11 acts_as_having_settings field: :options 7 acts_as_having_settings field: :options
12 8
plugins/analytics/models/analytics_plugin/visit.rb
1 class AnalyticsPlugin::Visit < ActiveRecord::Base 1 class AnalyticsPlugin::Visit < ActiveRecord::Base
2 2
3 - attr_accessible *self.column_names  
4 - attr_accessible :profile  
5 -  
6 belongs_to :profile 3 belongs_to :profile
7 has_many :page_views, class_name: 'AnalyticsPlugin::PageView', dependent: :destroy 4 has_many :page_views, class_name: 'AnalyticsPlugin::PageView', dependent: :destroy
8 5
plugins/breadcrumbs/lib/breadcrumbs_plugin/content_breadcrumbs_block.rb
@@ -4,8 +4,6 @@ class BreadcrumbsPlugin::ContentBreadcrumbsBlock &lt; Block @@ -4,8 +4,6 @@ class BreadcrumbsPlugin::ContentBreadcrumbsBlock &lt; Block
4 settings_items :show_profile, :type => :boolean, :default => true 4 settings_items :show_profile, :type => :boolean, :default => true
5 settings_items :show_section_name, :type => :boolean, :default => true 5 settings_items :show_section_name, :type => :boolean, :default => true
6 6
7 - attr_accessible :show_cms_action, :show_profile, :show_section_name  
8 -  
9 def self.description 7 def self.description
10 _("<p>Display a breadcrumb of the current content navigation.</p><p>You could choose if the breadcrumb is going to appear in the cms editing or not.</p> <p>There is either the option of display the profile location in the breadcrumb path.</p>") 8 _("<p>Display a breadcrumb of the current content navigation.</p><p>You could choose if the breadcrumb is going to appear in the cms editing or not.</p> <p>There is either the option of display the profile location in the breadcrumb path.</p>")
11 end 9 end
plugins/comment_classification/lib/comment_classification_plugin/comment_label_user.rb
@@ -5,8 +5,6 @@ class CommentClassificationPlugin::CommentLabelUser &lt; ActiveRecord::Base @@ -5,8 +5,6 @@ class CommentClassificationPlugin::CommentLabelUser &lt; ActiveRecord::Base
5 belongs_to :comment 5 belongs_to :comment
6 belongs_to :label, :class_name => 'CommentClassificationPlugin::Label' 6 belongs_to :label, :class_name => 'CommentClassificationPlugin::Label'
7 7
8 - attr_accessible :profile, :comment, :label  
9 -  
10 validates_presence_of :profile 8 validates_presence_of :profile
11 validates_presence_of :comment 9 validates_presence_of :comment
12 validates_presence_of :label 10 validates_presence_of :label
plugins/comment_classification/lib/comment_classification_plugin/comment_status_user.rb
@@ -5,8 +5,6 @@ class CommentClassificationPlugin::CommentStatusUser &lt; ActiveRecord::Base @@ -5,8 +5,6 @@ class CommentClassificationPlugin::CommentStatusUser &lt; ActiveRecord::Base
5 belongs_to :comment 5 belongs_to :comment
6 belongs_to :status, :class_name => 'CommentClassificationPlugin::Status' 6 belongs_to :status, :class_name => 'CommentClassificationPlugin::Status'
7 7
8 - attr_accessible :name, :enabled, :profile, :comment, :status_id, :reason  
9 -  
10 validates_presence_of :profile 8 validates_presence_of :profile
11 validates_presence_of :comment 9 validates_presence_of :comment
12 validates_presence_of :status 10 validates_presence_of :status
plugins/comment_classification/lib/comment_classification_plugin/label.rb
@@ -6,8 +6,6 @@ class CommentClassificationPlugin::Label &lt; ActiveRecord::Base @@ -6,8 +6,6 @@ class CommentClassificationPlugin::Label &lt; ActiveRecord::Base
6 6
7 scope :enabled, -> { where enabled: true } 7 scope :enabled, -> { where enabled: true }
8 8
9 - attr_accessible :name, :enabled, :color  
10 -  
11 COLORS = ['red', 'green', 'yellow', 'gray', 'blue'] 9 COLORS = ['red', 'green', 'yellow', 'gray', 'blue']
12 10
13 end 11 end
plugins/comment_classification/lib/comment_classification_plugin/status.rb
@@ -2,8 +2,6 @@ class CommentClassificationPlugin::Status &lt; ActiveRecord::Base @@ -2,8 +2,6 @@ class CommentClassificationPlugin::Status &lt; ActiveRecord::Base
2 2
3 belongs_to :owner, :polymorphic => true 3 belongs_to :owner, :polymorphic => true
4 4
5 - attr_accessible :name, :enabled  
6 -  
7 validates_presence_of :name 5 validates_presence_of :name
8 6
9 scope :enabled, -> { where enabled: true } 7 scope :enabled, -> { where enabled: true }
plugins/comment_group/lib/ext/comment.rb
@@ -6,6 +6,4 @@ class Comment @@ -6,6 +6,4 @@ class Comment
6 6
7 scope :in_group, -> group_id { where 'group_id = ?', group_id } 7 scope :in_group, -> group_id { where 'group_id = ?', group_id }
8 8
9 - attr_accessible :group_id  
10 -  
11 end 9 end
plugins/comment_paragraph/lib/ext/comment.rb
@@ -11,8 +11,6 @@ class Comment @@ -11,8 +11,6 @@ class Comment
11 where 'paragraph_uuid = ?', paragraph_uuid 11 where 'paragraph_uuid = ?', paragraph_uuid
12 } 12 }
13 13
14 - attr_accessible :paragraph_uuid, :comment_paragraph_selected_area, :id, :comment_paragraph_selected_content  
15 -  
16 before_validation do |comment| 14 before_validation do |comment|
17 comment.comment_paragraph_selected_area = nil if comment.comment_paragraph_selected_area.blank? 15 comment.comment_paragraph_selected_area = nil if comment.comment_paragraph_selected_area.blank?
18 comment.comment_paragraph_selected_content = nil if comment_paragraph_selected_content.blank? 16 comment.comment_paragraph_selected_content = nil if comment_paragraph_selected_content.blank?
plugins/community_track/lib/community_track_plugin/step.rb
@@ -3,8 +3,6 @@ class CommunityTrackPlugin::Step &lt; Folder @@ -3,8 +3,6 @@ class CommunityTrackPlugin::Step &lt; Folder
3 settings_items :hidden, :type => :boolean, :default => false 3 settings_items :hidden, :type => :boolean, :default => false
4 settings_items :tool_type, :type => String 4 settings_items :tool_type, :type => String
5 5
6 - attr_accessible :start_date, :end_date, :tool_type, :hidden  
7 -  
8 alias :tools :children 6 alias :tools :children
9 7
10 acts_as_list scope: -> step { where parent_id: step.parent_id } 8 acts_as_list scope: -> step { where parent_id: step.parent_id }
plugins/community_track/lib/community_track_plugin/track.rb
@@ -5,8 +5,6 @@ class CommunityTrackPlugin::Track &lt; Folder @@ -5,8 +5,6 @@ class CommunityTrackPlugin::Track &lt; Folder
5 5
6 validate :validate_categories 6 validate :validate_categories
7 7
8 - attr_accessible :goals, :expected_results  
9 -  
10 def comments_count 8 def comments_count
11 @comments_count = sum_children_comments self unless @comments_count 9 @comments_count = sum_children_comments self unless @comments_count
12 @comments_count 10 @comments_count
plugins/context_content/lib/context_content_plugin/context_content_block.rb
@@ -7,8 +7,6 @@ class ContextContentPlugin::ContextContentBlock &lt; Block @@ -7,8 +7,6 @@ class ContextContentPlugin::ContextContentBlock &lt; Block
7 settings_items :types, :type => Array, :default => ['UploadedFile'] 7 settings_items :types, :type => Array, :default => ['UploadedFile']
8 settings_items :limit, :type => :integer, :default => 6 8 settings_items :limit, :type => :integer, :default => 6
9 9
10 - attr_accessible :show_image, :show_name, :use_parent_title, :show_parent_content, :types  
11 -  
12 alias :profile :owner 10 alias :profile :owner
13 11
14 include Noosfero::Plugin::HotSpot 12 include Noosfero::Plugin::HotSpot
plugins/custom_forms/lib/custom_forms_plugin/alternative.rb
@@ -5,6 +5,5 @@ class CustomFormsPlugin::Alternative &lt; ActiveRecord::Base @@ -5,6 +5,5 @@ class CustomFormsPlugin::Alternative &lt; ActiveRecord::Base
5 5
6 belongs_to :field, :class_name => 'CustomFormsPlugin::Field' 6 belongs_to :field, :class_name => 'CustomFormsPlugin::Field'
7 7
8 - attr_accessible :label, :field, :position, :selected_by_default  
9 end 8 end
10 9
plugins/custom_forms/lib/custom_forms_plugin/answer.rb
@@ -6,8 +6,6 @@ class CustomFormsPlugin::Answer &lt; ActiveRecord::Base @@ -6,8 +6,6 @@ class CustomFormsPlugin::Answer &lt; ActiveRecord::Base
6 validates_presence_of :field 6 validates_presence_of :field
7 validate :value_mandatory, :if => 'field.present?' 7 validate :value_mandatory, :if => 'field.present?'
8 8
9 - attr_accessible :field, :value, :submission  
10 -  
11 def value_mandatory 9 def value_mandatory
12 if field.mandatory && value.blank? 10 if field.mandatory && value.blank?
13 errors.add(:value, _("is mandatory.").fix_i18n) 11 errors.add(:value, _("is mandatory.").fix_i18n)
plugins/custom_forms/lib/custom_forms_plugin/field.rb
@@ -4,8 +4,6 @@ class CustomFormsPlugin::Field &lt; ActiveRecord::Base @@ -4,8 +4,6 @@ class CustomFormsPlugin::Field &lt; ActiveRecord::Base
4 validates_presence_of :name 4 validates_presence_of :name
5 validates_length_of :default_value, :maximum => 255 5 validates_length_of :default_value, :maximum => 255
6 6
7 - attr_accessible :name, :form, :mandatory, :type, :position, :default_value, :show_as, :alternatives_attributes  
8 -  
9 belongs_to :form, :class_name => 'CustomFormsPlugin::Form' 7 belongs_to :form, :class_name => 'CustomFormsPlugin::Form'
10 has_many :answers, :class_name => 'CustomFormsPlugin::Answer', :dependent => :destroy 8 has_many :answers, :class_name => 'CustomFormsPlugin::Answer', :dependent => :destroy
11 9
plugins/custom_forms/lib/custom_forms_plugin/form.rb
@@ -14,8 +14,6 @@ class CustomFormsPlugin::Form &lt; ActiveRecord::Base @@ -14,8 +14,6 @@ class CustomFormsPlugin::Form &lt; ActiveRecord::Base
14 validate :period_range, :if => Proc.new { |f| f.begining.present? && f.ending.present? } 14 validate :period_range, :if => Proc.new { |f| f.begining.present? && f.ending.present? }
15 validate :access_format 15 validate :access_format
16 16
17 - attr_accessible :name, :profile, :for_admission, :access, :begining, :ending, :description, :fields_attributes, :profile_id, :on_membership  
18 -  
19 before_validation do |form| 17 before_validation do |form|
20 form.slug = form.name.to_slug if form.name.present? 18 form.slug = form.name.to_slug if form.name.present?
21 form.access = nil if form.access.blank? 19 form.access = nil if form.access.blank?
plugins/custom_forms/lib/custom_forms_plugin/submission.rb
@@ -6,8 +6,6 @@ class CustomFormsPlugin::Submission &lt; ActiveRecord::Base @@ -6,8 +6,6 @@ class CustomFormsPlugin::Submission &lt; ActiveRecord::Base
6 # validation is done manually, see below 6 # validation is done manually, see below
7 has_many :answers, :class_name => 'CustomFormsPlugin::Answer', :dependent => :destroy, :validate => false 7 has_many :answers, :class_name => 'CustomFormsPlugin::Answer', :dependent => :destroy, :validate => false
8 8
9 - attr_accessible :form, :profile, :author_name, :author_email  
10 -  
11 validates_presence_of :form 9 validates_presence_of :form
12 validates_presence_of :author_name, :author_email, :if => lambda {|submission| submission.profile.nil?} 10 validates_presence_of :author_name, :author_email, :if => lambda {|submission| submission.profile.nil?}
13 validates_uniqueness_of :author_email, :scope => :form_id, :allow_nil => true 11 validates_uniqueness_of :author_email, :scope => :form_id, :allow_nil => true
plugins/delivery/models/delivery_plugin/method.rb
@@ -7,9 +7,6 @@ class DeliveryPlugin::Method &lt; ActiveRecord::Base @@ -7,9 +7,6 @@ class DeliveryPlugin::Method &lt; ActiveRecord::Base
7 address address_line2 address_reference district city state country_name zip_code 7 address address_line2 address_reference district city state country_name zip_code
8 ].map(&:to_sym) 8 ].map(&:to_sym)
9 9
10 - attr_accessible :profile, :delivery_type, :name, :description,  
11 - :fixed_cost, :free_over_price, :distribution_margin_percentage, :distribution_margin_fixed  
12 -  
13 belongs_to :profile 10 belongs_to :profile
14 11
15 has_many :delivery_options, class_name: 'DeliveryPlugin::Option', foreign_key: :delivery_method_id, dependent: :destroy 12 has_many :delivery_options, class_name: 'DeliveryPlugin::Option', foreign_key: :delivery_method_id, dependent: :destroy
plugins/delivery/models/delivery_plugin/option.rb
@@ -6,6 +6,4 @@ class DeliveryPlugin::Option &lt; ActiveRecord::Base @@ -6,6 +6,4 @@ class DeliveryPlugin::Option &lt; ActiveRecord::Base
6 validates_presence_of :delivery_method 6 validates_presence_of :delivery_method
7 validates_presence_of :owner 7 validates_presence_of :owner
8 8
9 - attr_accessible :owner_id, :owner_type, :delivery_methods, :delivery_method  
10 -  
11 end 9 end
plugins/display_content/lib/display_content_block.rb
@@ -29,8 +29,6 @@ class DisplayContentBlock &lt; Block @@ -29,8 +29,6 @@ class DisplayContentBlock &lt; Block
29 settings_items :content_with_translations, :type => :boolean, :default => :true 29 settings_items :content_with_translations, :type => :boolean, :default => :true
30 settings_items :limit_to_show, :type => :integer, :default => 6 30 settings_items :limit_to_show, :type => :integer, :default => 6
31 31
32 - attr_accessible :sections, :checked_nodes, :display_folder_children, :types, :order_by_recent, :limit_to_show, :content_with_translations  
33 -  
34 def self.description 32 def self.description
35 _('Display your contents') 33 _('Display your contents')
36 end 34 end
plugins/driven_signup/models/driven_signup_plugin/auth.rb
1 class DrivenSignupPlugin::Auth < ActiveRecord::Base 1 class DrivenSignupPlugin::Auth < ActiveRecord::Base
2 2
3 - attr_accessible :name, :token  
4 -  
5 belongs_to :environment 3 belongs_to :environment
6 4
7 validates_presence_of :environment 5 validates_presence_of :environment
plugins/environment_notification/lib/environment_notifications_user.rb
@@ -4,7 +4,5 @@ class EnvironmentNotificationsUser &lt; ActiveRecord::Base @@ -4,7 +4,5 @@ class EnvironmentNotificationsUser &lt; ActiveRecord::Base
4 belongs_to :user 4 belongs_to :user
5 belongs_to :environment_notification, class_name: 'EnvironmentNotificationPlugin::EnvironmentNotification' 5 belongs_to :environment_notification, class_name: 'EnvironmentNotificationPlugin::EnvironmentNotification'
6 6
7 - attr_accessible :user_id, :environment_notification_id  
8 -  
9 validates_uniqueness_of :user_id, :scope => :environment_notification_id 7 validates_uniqueness_of :user_id, :scope => :environment_notification_id
10 end 8 end
plugins/environment_notification/models/environment_notification_plugin/environment_notification.rb
@@ -9,8 +9,6 @@ class EnvironmentNotificationPlugin::EnvironmentNotification &lt; ActiveRecord::Bas @@ -9,8 +9,6 @@ class EnvironmentNotificationPlugin::EnvironmentNotification &lt; ActiveRecord::Bas
9 "EnvironmentNotificationPlugin::DangerNotification" 9 "EnvironmentNotificationPlugin::DangerNotification"
10 ] 10 ]
11 11
12 - attr_accessible :message, :environment_id, :active, :type, :display_only_in_homepage, :display_to_all_users, :display_popup, :title  
13 -  
14 has_many :environment_notifications_users 12 has_many :environment_notifications_users
15 has_many :users, :through => :environment_notifications_users 13 has_many :users, :through => :environment_notifications_users
16 14
plugins/event/lib/event_plugin/event_block.rb
1 class EventPlugin::EventBlock < Block 1 class EventPlugin::EventBlock < Block
2 include DatesHelper 2 include DatesHelper
3 3
4 - attr_accessible :all_env_events, :limit, :future_only, :date_distance_limit  
5 -  
6 settings_items :all_env_events, :type => :boolean, :default => false 4 settings_items :all_env_events, :type => :boolean, :default => false
7 settings_items :limit, :type => :integer, :default => 4 5 settings_items :limit, :type => :integer, :default => 4
8 settings_items :future_only, :type => :boolean, :default => true 6 settings_items :future_only, :type => :boolean, :default => true
plugins/fb_app/lib/ext/profile.rb
@@ -2,13 +2,6 @@ require_dependency &#39;profile&#39; @@ -2,13 +2,6 @@ require_dependency &#39;profile&#39;
2 # hate to wrte this, but without Noosfero::Plugin::Settings is loaded instead 2 # hate to wrte this, but without Noosfero::Plugin::Settings is loaded instead
3 require 'fb_app_plugin/settings' 3 require 'fb_app_plugin/settings'
4 4
5 -# attr_accessible must be defined on subclasses  
6 -Profile.descendants.each do |subclass|  
7 - subclass.class_eval do  
8 - attr_accessible :fb_app_settings  
9 - end  
10 -end  
11 -  
12 class Profile 5 class Profile
13 6
14 def fb_app_settings attrs = {} 7 def fb_app_settings attrs = {}
plugins/fb_app/models/fb_app_plugin/auth.rb
@@ -9,8 +9,6 @@ class FbAppPlugin::Auth &lt; OauthClientPlugin::Auth @@ -9,8 +9,6 @@ class FbAppPlugin::Auth &lt; OauthClientPlugin::Auth
9 settings_items :signed_request 9 settings_items :signed_request
10 settings_items :fb_user 10 settings_items :fb_user
11 11
12 - attr_accessible :provider_user_id, :signed_request  
13 -  
14 before_create :update_user 12 before_create :update_user
15 before_create :exchange_token 13 before_create :exchange_token
16 after_create :schedule_exchange_token 14 after_create :schedule_exchange_token
plugins/fb_app/models/fb_app_plugin/page_tab.rb
@@ -3,10 +3,6 @@ class FbAppPlugin::PageTab &lt; ActiveRecord::Base @@ -3,10 +3,6 @@ class FbAppPlugin::PageTab &lt; ActiveRecord::Base
3 # FIXME: rename table to match model 3 # FIXME: rename table to match model
4 self.table_name = :fb_app_plugin_page_tab_configs 4 self.table_name = :fb_app_plugin_page_tab_configs
5 5
6 - attr_accessible :owner_profile, :profile_id, :page_id,  
7 - :config_type, :profile_ids, :query,  
8 - :title, :subtitle  
9 -  
10 belongs_to :owner_profile, foreign_key: :profile_id, class_name: 'Profile' 6 belongs_to :owner_profile, foreign_key: :profile_id, class_name: 'Profile'
11 7
12 acts_as_having_settings field: :config 8 acts_as_having_settings field: :config
plugins/gallery_block/lib/gallery_block.rb
1 class GalleryBlock < Block 1 class GalleryBlock < Block
2 2
3 - attr_accessible :gallery_id, :groups_of, :speed, :interval  
4 -  
5 settings_items :gallery_id, :type => :integer 3 settings_items :gallery_id, :type => :integer
6 settings_items :groups_of, :type => :integer, :default => 3 4 settings_items :groups_of, :type => :integer, :default => 3
7 settings_items :speed, :type => :integer, :default => 1000 5 settings_items :speed, :type => :integer, :default => 1000
plugins/google_analytics/lib/ext/profile.rb
1 require_dependency 'profile' 1 require_dependency 'profile'
2 2
3 class Profile 3 class Profile
  4 +
4 settings_items :google_analytics_profile_id 5 settings_items :google_analytics_profile_id
5 - attr_accessible :google_analytics_profile_id  
6 6
7 - descendants.each do |descendant|  
8 - descendant.attr_accessible :google_analytics_profile_id  
9 - end  
10 end 7 end
plugins/lattes_curriculum/lib/academic_info.rb
@@ -2,7 +2,6 @@ class AcademicInfo &lt; ActiveRecord::Base @@ -2,7 +2,6 @@ class AcademicInfo &lt; ActiveRecord::Base
2 2
3 belongs_to :person 3 belongs_to :person
4 4
5 - attr_accessible :lattes_url  
6 validate :lattes_url_validate? 5 validate :lattes_url_validate?
7 6
8 def lattes_url_validate? 7 def lattes_url_validate?
plugins/lattes_curriculum/lib/ext/person.rb
@@ -2,8 +2,6 @@ require_dependency &#39;person&#39; @@ -2,8 +2,6 @@ require_dependency &#39;person&#39;
2 2
3 class Person 3 class Person
4 4
5 - attr_accessible :lattes_url, :academic_info_attributes  
6 -  
7 has_one :academic_info 5 has_one :academic_info
8 6
9 after_destroy do |person| 7 after_destroy do |person|
plugins/ldap/lib/ext/environment.rb
@@ -6,8 +6,6 @@ class Environment @@ -6,8 +6,6 @@ class Environment
6 6
7 validates_presence_of :ldap_plugin_host, :if => lambda {|env| !env.ldap_plugin.blank? } 7 validates_presence_of :ldap_plugin_host, :if => lambda {|env| !env.ldap_plugin.blank? }
8 8
9 - attr_accessible :ldap_plugin_host, :ldap_plugin_port, :ldap_plugin_tls, :ldap_plugin_onthefly_register, :ldap_plugin_account, :ldap_plugin_account_password, :ldap_plugin_filter, :ldap_plugin_base_dn, :ldap_plugin_attr_mail, :ldap_plugin_attr_login, :ldap_plugin_attr_fullname, :ldap_plugin_allow_password_recovery  
10 -  
11 def ldap_plugin_attributes 9 def ldap_plugin_attributes
12 self.ldap_plugin || {} 10 self.ldap_plugin || {}
13 end 11 end
plugins/newsletter/lib/newsletter_plugin/newsletter.rb
@@ -9,8 +9,6 @@ class NewsletterPlugin::Newsletter &lt; ActiveRecord::Base @@ -9,8 +9,6 @@ class NewsletterPlugin::Newsletter &lt; ActiveRecord::Base
9 validates_numericality_of :periodicity, only_integer: true, greater_than: -1, message: _('must be a positive number') 9 validates_numericality_of :periodicity, only_integer: true, greater_than: -1, message: _('must be a positive number')
10 validates_numericality_of :posts_per_blog, only_integer: true, greater_than: -1, message: _('must be a positive number') 10 validates_numericality_of :posts_per_blog, only_integer: true, greater_than: -1, message: _('must be a positive number')
11 11
12 - attr_accessible :environment, :enabled, :periodicity, :subject, :posts_per_blog, :footer, :blog_ids, :additional_recipients, :person, :person_id, :moderated  
13 -  
14 scope :enabled, -> { where enabled: true } 12 scope :enabled, -> { where enabled: true }
15 13
16 # These methods are used by NewsletterMailing 14 # These methods are used by NewsletterMailing
plugins/newsletter/lib/newsletter_plugin/newsletter_mailing.rb
1 class NewsletterPlugin::NewsletterMailing < EnvironmentMailing 1 class NewsletterPlugin::NewsletterMailing < EnvironmentMailing
2 2
3 - attr_accessible :source, :person, :locale  
4 -  
5 validates_presence_of :person 3 validates_presence_of :person
6 4
7 def url 5 def url
plugins/oauth_client/models/oauth_client_plugin/auth.rb
1 class OauthClientPlugin::Auth < ActiveRecord::Base 1 class OauthClientPlugin::Auth < ActiveRecord::Base
2 2
3 - attr_accessible :profile, :provider, :enabled,  
4 - :access_token, :expires_in  
5 -  
6 belongs_to :profile, class_name: 'Profile' 3 belongs_to :profile, class_name: 'Profile'
7 belongs_to :provider, class_name: 'OauthClientPlugin::Provider' 4 belongs_to :provider, class_name: 'OauthClientPlugin::Provider'
8 5
plugins/oauth_client/models/oauth_client_plugin/provider.rb
@@ -10,10 +10,6 @@ class OauthClientPlugin::Provider &lt; ActiveRecord::Base @@ -10,10 +10,6 @@ class OauthClientPlugin::Provider &lt; ActiveRecord::Base
10 settings_items :site, type: String 10 settings_items :site, type: String
11 settings_items :client_options, type: Hash 11 settings_items :client_options, type: Hash
12 12
13 - attr_accessible :name, :strategy, :enabled, :site, :image_builder,  
14 - :environment, :environment_id, :options,  
15 - :client_id, :client_secret, :client_options  
16 -  
17 scope :enabled, -> { where enabled: true } 13 scope :enabled, -> { where enabled: true }
18 14
19 acts_as_having_image 15 acts_as_having_image
plugins/open_graph/lib/ext/profile.rb
@@ -2,11 +2,8 @@ require_dependency &#39;profile&#39; @@ -2,11 +2,8 @@ require_dependency &#39;profile&#39;
2 # hate to wrte this, but without Noosfero::Plugin::Settings is loaded instead 2 # hate to wrte this, but without Noosfero::Plugin::Settings is loaded instead
3 require 'open_graph_plugin/settings' 3 require 'open_graph_plugin/settings'
4 4
5 -# attr_accessible must be defined on subclasses  
6 Profile.descendants.each do |subclass| 5 Profile.descendants.each do |subclass|
7 subclass.class_eval do 6 subclass.class_eval do
8 - attr_accessible :open_graph_settings  
9 -  
10 has_many :open_graph_tracks, class_name: 'OpenGraphPlugin::Track', source: :tracker_id, foreign_key: :tracker_id 7 has_many :open_graph_tracks, class_name: 'OpenGraphPlugin::Track', source: :tracker_id, foreign_key: :tracker_id
11 8
12 has_many :open_graph_activities, class_name: 'OpenGraphPlugin::Activity', source: :tracker_id, foreign_key: :tracker_id 9 has_many :open_graph_activities, class_name: 'OpenGraphPlugin::Activity', source: :tracker_id, foreign_key: :tracker_id
@@ -21,9 +18,6 @@ Profile.descendants.each do |subclass| @@ -21,9 +18,6 @@ Profile.descendants.each do |subclass|
21 association = klass.association 18 association = klass.association
22 has_many association, class_name: klass.name, foreign_key: :tracker_id 19 has_many association, class_name: klass.name, foreign_key: :tracker_id
23 accepts_nested_attributes_for association, allow_destroy: true, reject_if: :open_graph_reject_empty_object_type 20 accepts_nested_attributes_for association, allow_destroy: true, reject_if: :open_graph_reject_empty_object_type
24 -  
25 - attr_accessible attributes  
26 - attr_accessible profile_ids  
27 end 21 end
28 end 22 end
29 end 23 end
plugins/open_graph/models/open_graph_plugin/track.rb
@@ -3,10 +3,6 @@ class OpenGraphPlugin::Track &lt; ActiveRecord::Base @@ -3,10 +3,6 @@ class OpenGraphPlugin::Track &lt; ActiveRecord::Base
3 class_attribute :context 3 class_attribute :context
4 self.context = :open_graph 4 self.context = :open_graph
5 5
6 - attr_accessible :type, :context, :tracker_id, :tracker, :actor_id, :action,  
7 - :object_type, :object_data_id, :object_data_type, :object_data_url,  
8 - :story, :object_data, :actor  
9 -  
10 belongs_to :tracker, class_name: 'Profile' 6 belongs_to :tracker, class_name: 'Profile'
11 belongs_to :actor, class_name: 'Profile' 7 belongs_to :actor, class_name: 'Profile'
12 belongs_to :object_data, polymorphic: true 8 belongs_to :object_data, polymorphic: true
plugins/orders/lib/orders_plugin/date_range_attr.rb
@@ -15,7 +15,6 @@ module OrdersPlugin @@ -15,7 +15,6 @@ module OrdersPlugin
15 options[:dummy] = true if options[:dummy].nil? 15 options[:dummy] = true if options[:dummy].nil?
16 16
17 range_attr = self.date_range_attr_for start_field, end_field 17 range_attr = self.date_range_attr_for start_field, end_field
18 - attr_accessible range_attr  
19 18
20 define_method range_attr do 19 define_method range_attr do
21 return if options[:dummy] 20 return if options[:dummy]
plugins/orders/models/orders_plugin/item.rb
1 class OrdersPlugin::Item < ActiveRecord::Base 1 class OrdersPlugin::Item < ActiveRecord::Base
2 2
3 - attr_accessible :order, :sale, :purchase,  
4 - :product, :product_id,  
5 - :price, :name  
6 -  
7 # flag used by items to compare them with products 3 # flag used by items to compare them with products
8 attr_accessor :product_diff 4 attr_accessor :product_diff
9 5
@@ -28,9 +24,6 @@ class OrdersPlugin::Item &lt; ActiveRecord::Base @@ -28,9 +24,6 @@ class OrdersPlugin::Item &lt; ActiveRecord::Base
28 StatusDataMap.each do |status, data| 24 StatusDataMap.each do |status, data|
29 quantity = "quantity_#{data}".to_sym 25 quantity = "quantity_#{data}".to_sym
30 price = "price_#{data}".to_sym 26 price = "price_#{data}".to_sym
31 -  
32 - attr_accessible quantity  
33 - attr_accessible price  
34 end 27 end
35 28
36 serialize :data 29 serialize :data
plugins/orders/models/orders_plugin/order.rb
@@ -40,9 +40,6 @@ class OrdersPlugin::Order &lt; ActiveRecord::Base @@ -40,9 +40,6 @@ class OrdersPlugin::Order &lt; ActiveRecord::Base
40 supplier: StatusAccessMap.map{ |s, a| s if a == :supplier }.compact, 40 supplier: StatusAccessMap.map{ |s, a| s if a == :supplier }.compact,
41 } 41 }
42 42
43 - attr_accessible :status, :consumer, :profile,  
44 - :supplier_delivery_id, :consumer_delivery_id, :supplier_delivery_data, :consumer_delivery_data  
45 -  
46 belongs_to :profile 43 belongs_to :profile
47 # may be override by subclasses 44 # may be override by subclasses
48 belongs_to :supplier, foreign_key: :profile_id, class_name: 'Profile' 45 belongs_to :supplier, foreign_key: :profile_id, class_name: 'Profile'
plugins/orders_cycle/models/orders_cycle_plugin/cycle.rb
1 class OrdersCyclePlugin::Cycle < ActiveRecord::Base 1 class OrdersCyclePlugin::Cycle < ActiveRecord::Base
2 2
3 - attr_accessible :profile, :status, :name, :description, :opening_message  
4 -  
5 - attr_accessible :start, :finish, :delivery_start, :delivery_finish  
6 - attr_accessible :start_date, :start_time, :finish_date, :finish_time, :delivery_start_date, :delivery_start_time, :delivery_finish_date, :delivery_finish_time,  
7 -  
8 Statuses = %w[edition orders purchases receipts separation delivery closing] 3 Statuses = %w[edition orders purchases receipts separation delivery closing]
9 DbStatuses = %w[new] + Statuses 4 DbStatuses = %w[new] + Statuses
10 UserStatuses = Statuses 5 UserStatuses = Statuses
@@ -72,7 +67,6 @@ class OrdersCyclePlugin::Cycle &lt; ActiveRecord::Base @@ -72,7 +67,6 @@ class OrdersCyclePlugin::Cycle &lt; ActiveRecord::Base
72 67
73 has_many :volunteers_periods, class_name: 'VolunteersPlugin::Period', as: :owner 68 has_many :volunteers_periods, class_name: 'VolunteersPlugin::Period', as: :owner
74 has_many :volunteers, through: :volunteers_periods, source: :profile 69 has_many :volunteers, through: :volunteers_periods, source: :profile
75 - attr_accessible :volunteers_periods_attributes  
76 accepts_nested_attributes_for :volunteers_periods, allow_destroy: true 70 accepts_nested_attributes_for :volunteers_periods, allow_destroy: true
77 71
78 scope :has_volunteers_periods, -> { distinct.joins :volunteers_periods } 72 scope :has_volunteers_periods, -> { distinct.joins :volunteers_periods }
plugins/orders_cycle/models/orders_cycle_plugin/order_base.rb
@@ -4,8 +4,6 @@ module OrdersCyclePlugin::OrderBase @@ -4,8 +4,6 @@ module OrdersCyclePlugin::OrderBase
4 extend ActiveSupport::Concern 4 extend ActiveSupport::Concern
5 included do 5 included do
6 6
7 - attr_accessible :cycle  
8 -  
9 has_many :cycle_sales, class_name: 'OrdersCyclePlugin::CycleOrder', foreign_key: :sale_id, dependent: :destroy 7 has_many :cycle_sales, class_name: 'OrdersCyclePlugin::CycleOrder', foreign_key: :sale_id, dependent: :destroy
10 has_one :cycle_sale, class_name: 'OrdersCyclePlugin::CycleOrder', foreign_key: :sale_id 8 has_one :cycle_sale, class_name: 'OrdersCyclePlugin::CycleOrder', foreign_key: :sale_id
11 has_many :cycle_purchases, class_name: 'OrdersCyclePlugin::CycleOrder', foreign_key: :purchase_id, dependent: :destroy 9 has_many :cycle_purchases, class_name: 'OrdersCyclePlugin::CycleOrder', foreign_key: :purchase_id, dependent: :destroy
plugins/organization_ratings/lib/create_organization_rating_comment.rb
@@ -6,9 +6,6 @@ class CreateOrganizationRatingComment &lt; Task @@ -6,9 +6,6 @@ class CreateOrganizationRatingComment &lt; Task
6 settings_items :organization_rating_id, :type => Integer, :default => nil 6 settings_items :organization_rating_id, :type => Integer, :default => nil
7 settings_items :organization_rating_comment_id, :type => Integer, :default => nil 7 settings_items :organization_rating_comment_id, :type => Integer, :default => nil
8 8
9 - attr_accessible :organization_rating_id, :body, :requestor  
10 - attr_accessible :reject_explanation, :target  
11 -  
12 DATA_FIELDS = ['body'] 9 DATA_FIELDS = ['body']
13 DATA_FIELDS.each do |field| 10 DATA_FIELDS.each do |field|
14 settings_items field.to_sym 11 settings_items field.to_sym
plugins/organization_ratings/lib/organization_rating.rb
@@ -3,8 +3,6 @@ class OrganizationRating &lt; ActiveRecord::Base @@ -3,8 +3,6 @@ class OrganizationRating &lt; ActiveRecord::Base
3 belongs_to :organization 3 belongs_to :organization
4 belongs_to :comment 4 belongs_to :comment
5 5
6 - attr_accessible :value, :person, :organization, :comment  
7 -  
8 validates :value, 6 validates :value,
9 :presence => true, :inclusion => { 7 :presence => true, :inclusion => {
10 in: 1..5, message: _("must be between 1 and 5") 8 in: 1..5, message: _("must be between 1 and 5")
plugins/organization_ratings/lib/organization_ratings_config.rb
@@ -2,9 +2,6 @@ class OrganizationRatingsConfig &lt; ActiveRecord::Base @@ -2,9 +2,6 @@ class OrganizationRatingsConfig &lt; ActiveRecord::Base
2 2
3 belongs_to :environment 3 belongs_to :environment
4 4
5 - attr_accessible :cooldown, :default_rating, :order, :per_page  
6 - attr_accessible :vote_once, :are_moderated, :environment_id  
7 -  
8 ORDER_OPTIONS = {recent: _('More Recent'), best: _('Best Ratings')} 5 ORDER_OPTIONS = {recent: _('More Recent'), best: _('Best Ratings')}
9 6
10 MINIMUM_RATING = 1 7 MINIMUM_RATING = 1
plugins/people_block/lib/members_block.rb
1 class MembersBlock < PeopleBlockBase 1 class MembersBlock < PeopleBlockBase
  2 +
2 settings_items :show_join_leave_button, :type => :boolean, :default => false 3 settings_items :show_join_leave_button, :type => :boolean, :default => false
3 settings_items :visible_role, :type => :string, :default => nil 4 settings_items :visible_role, :type => :string, :default => nil
4 - attr_accessible :show_join_leave_button, :visible_role  
5 5
6 def self.description 6 def self.description
7 c_('Members') 7 c_('Members')
plugins/people_block/lib/people_block_base.rb
@@ -3,7 +3,6 @@ class PeopleBlockBase &lt; Block @@ -3,7 +3,6 @@ class PeopleBlockBase &lt; Block
3 settings_items :limit, :type => :integer, :default => 6 3 settings_items :limit, :type => :integer, :default => 6
4 settings_items :name, :type => String, :default => "" 4 settings_items :name, :type => String, :default => ""
5 settings_items :address, :type => String, :default => "" 5 settings_items :address, :type => String, :default => ""
6 - attr_accessible :name, :address, :prioritize_profiles_with_image  
7 6
8 def self.description 7 def self.description
9 _('Random people') 8 _('Random people')
plugins/piwik/lib/ext/environment.rb
@@ -4,5 +4,4 @@ class Environment @@ -4,5 +4,4 @@ class Environment
4 settings_items :piwik_domain 4 settings_items :piwik_domain
5 settings_items :piwik_path, :default => 'piwik' 5 settings_items :piwik_path, :default => 'piwik'
6 settings_items :piwik_site_id 6 settings_items :piwik_site_id
7 - attr_accessible :piwik_domain, :piwik_site_id, :piwik_path  
8 end 7 end
plugins/profile_members_headlines/lib/profile_members_headlines_block.rb
@@ -5,8 +5,6 @@ class ProfileMembersHeadlinesBlock &lt; Block @@ -5,8 +5,6 @@ class ProfileMembersHeadlinesBlock &lt; Block
5 settings_items :navigation, :type => 'boolean', :default => true 5 settings_items :navigation, :type => 'boolean', :default => true
6 settings_items :filtered_roles, :type => Array, :default => [] 6 settings_items :filtered_roles, :type => Array, :default => []
7 7
8 - attr_accessible :interval, :limit, :navigation, :filtered_roles  
9 -  
10 def self.description 8 def self.description
11 _('Display headlines from members of a community') 9 _('Display headlines from members of a community')
12 end 10 end
plugins/recent_content/lib/recent_content_block.rb
@@ -5,8 +5,6 @@ class RecentContentBlock &lt; Block @@ -5,8 +5,6 @@ class RecentContentBlock &lt; Block
5 settings_items :show_blog_picture, :type => :boolean, :default => false 5 settings_items :show_blog_picture, :type => :boolean, :default => false
6 settings_items :selected_folder, :type => Integer 6 settings_items :selected_folder, :type => Integer
7 7
8 - attr_accessible :presentation_mode, :total_items, :show_blog_picture, :selected_folder  
9 -  
10 VALID_CONTENT = ['RawHTMLArticle', 'TextArticle', 'TextileArticle', 'TinyMceArticle'] 8 VALID_CONTENT = ['RawHTMLArticle', 'TextArticle', 'TextileArticle', 'TinyMceArticle']
11 9
12 def self.description 10 def self.description
plugins/relevant_content/lib/relevant_content_plugin/relevant_content_block.rb
@@ -18,8 +18,6 @@ class RelevantContentPlugin::RelevantContentBlock &lt; Block @@ -18,8 +18,6 @@ class RelevantContentPlugin::RelevantContentBlock &lt; Block
18 settings_items :show_most_disliked, :type => :boolean, :default => 0 18 settings_items :show_most_disliked, :type => :boolean, :default => 0
19 settings_items :show_most_voted, :type => :boolean, :default => 1 19 settings_items :show_most_voted, :type => :boolean, :default => 1
20 20
21 - attr_accessible :limit, :show_most_voted, :show_most_disliked, :show_most_liked, :show_most_commented, :show_most_read  
22 -  
23 include ActionView::Helpers 21 include ActionView::Helpers
24 include Rails.application.routes.url_helpers 22 include Rails.application.routes.url_helpers
25 23
plugins/require_auth_to_comment/lib/ext/profile.rb
1 require_dependency 'profile' 1 require_dependency 'profile'
2 2
3 class Profile 3 class Profile
  4 +
4 settings_items :allow_unauthenticated_comments, :type => :boolean 5 settings_items :allow_unauthenticated_comments, :type => :boolean
5 - attr_accessible :allow_unauthenticated_comments  
6 6
7 - descendants.each do |descendant|  
8 - descendant.attr_accessible :allow_unauthenticated_comments  
9 - end  
10 end 7 end
plugins/send_email/lib/send_email_plugin/core_ext.rb
@@ -1,4 +0,0 @@ @@ -1,4 +0,0 @@
1 -Environment.class_eval do  
2 - attr_accessible :send_email_plugin_allow_to  
3 -end  
4 -  
plugins/site_tour/lib/site_tour_plugin/tour_block.rb
@@ -4,8 +4,6 @@ class SiteTourPlugin::TourBlock &lt; Block @@ -4,8 +4,6 @@ class SiteTourPlugin::TourBlock &lt; Block
4 settings_items :group_triggers, :type => Array, :default => [] 4 settings_items :group_triggers, :type => Array, :default => []
5 settings_items :display_button, :type => :boolean, :default => true 5 settings_items :display_button, :type => :boolean, :default => true
6 6
7 - attr_accessible :actions, :display_button, :group_triggers  
8 -  
9 before_save do |block| 7 before_save do |block|
10 block.actions.reject! {|i| i[:group_name].blank? && i[:selector].blank? && i[:description].blank?} 8 block.actions.reject! {|i| i[:group_name].blank? && i[:selector].blank? && i[:description].blank?}
11 block.group_triggers.reject! {|i| i[:group_name].blank? && i[:selector].blank?} 9 block.group_triggers.reject! {|i| i[:group_name].blank? && i[:selector].blank?}
plugins/spaminator/lib/spaminator_plugin/report.rb
@@ -6,8 +6,6 @@ class SpaminatorPlugin::Report &lt; ActiveRecord::Base @@ -6,8 +6,6 @@ class SpaminatorPlugin::Report &lt; ActiveRecord::Base
6 6
7 validates_presence_of :environment 7 validates_presence_of :environment
8 8
9 - attr_accessible :environment  
10 -  
11 scope :from_environment, -> environment { where :environment_id => environment } 9 scope :from_environment, -> environment { where :environment_id => environment }
12 10
13 after_initialize do |report| 11 after_initialize do |report|
plugins/spaminator/lib/spaminator_plugin/spaminator.rb
@@ -29,10 +29,9 @@ class SpaminatorPlugin::Spaminator @@ -29,10 +29,9 @@ class SpaminatorPlugin::Spaminator
29 def initialize(environment) 29 def initialize(environment)
30 @environment = environment 30 @environment = environment
31 @settings = Noosfero::Plugin::Settings.new(@environment, SpaminatorPlugin) 31 @settings = Noosfero::Plugin::Settings.new(@environment, SpaminatorPlugin)
32 - @report = SpaminatorPlugin::Report.new({:environment => environment,  
33 - :total_people => Person.count,  
34 - :total_comments => Comment.count},  
35 - :without_protection => true) 32 + @report = SpaminatorPlugin::Report.new environment: environment,
  33 + total_people: Person.count, total_comments: Comment.count
  34 +
36 self.class.initialize_logger(environment) 35 self.class.initialize_logger(environment)
37 end 36 end
38 37
plugins/statistics/lib/statistics_block.rb
@@ -10,8 +10,6 @@ class StatisticsBlock &lt; Block @@ -10,8 +10,6 @@ class StatisticsBlock &lt; Block
10 settings_items :hit_counter, :default => false 10 settings_items :hit_counter, :default => false
11 settings_items :templates_ids_counter, type: Hash, default: {} 11 settings_items :templates_ids_counter, type: Hash, default: {}
12 12
13 - attr_accessible :comment_counter, :community_counter, :user_counter, :enterprise_counter, :product_counter, :category_counter, :tag_counter, :hit_counter, :templates_ids_counter  
14 -  
15 USER_COUNTERS = [:community_counter, :user_counter, :enterprise_counter, :tag_counter, :comment_counter, :hit_counter] 13 USER_COUNTERS = [:community_counter, :user_counter, :enterprise_counter, :tag_counter, :comment_counter, :hit_counter]
16 COMMUNITY_COUNTERS = [:user_counter, :tag_counter, :comment_counter, :hit_counter] 14 COMMUNITY_COUNTERS = [:user_counter, :tag_counter, :comment_counter, :hit_counter]
17 ENTERPRISE_COUNTERS = [:user_counter, :tag_counter, :comment_counter, :hit_counter] 15 ENTERPRISE_COUNTERS = [:user_counter, :tag_counter, :comment_counter, :hit_counter]
plugins/stoa/lib/ext/person.rb
1 require_dependency 'person' 1 require_dependency 'person'
2 2
3 class Person 3 class Person
4 - attr_accessible :usp_id, :invitation_code  
5 4
6 SEARCHABLE_FIELDS[:usp_id] = {:label => _('USP Number'), :weight => 5} 5 SEARCHABLE_FIELDS[:usp_id] = {:label => _('USP Number'), :weight => 5}
7 6
@@ -23,4 +22,5 @@ class Person @@ -23,4 +22,5 @@ class Person
23 Task.pending.where(code: invitation_code.to_s).first or 22 Task.pending.where(code: invitation_code.to_s).first or
24 Task.finished.where(code: invitation_code.to_s, target_id: id).first 23 Task.finished.where(code: invitation_code.to_s, target_id: id).first
25 end 24 end
  25 +
26 end 26 end
plugins/stoa/test/functional/account_controller_test.rb
@@ -21,7 +21,7 @@ class AccountControllerTest &lt; ActionController::TestCase @@ -21,7 +21,7 @@ class AccountControllerTest &lt; ActionController::TestCase
21 @controller = AccountController.new 21 @controller = AccountController.new
22 @request = ActionController::TestRequest.new 22 @request = ActionController::TestRequest.new
23 @response = ActionController::TestResponse.new 23 @response = ActionController::TestResponse.new
24 - StoaPlugin::UspUser.create!({:codpes => 12345678, :cpf => Digest::MD5.hexdigest(SALT+'12345678'), :birth_date => '1970-01-30'}, :without_protection => true) 24 + StoaPlugin::UspUser.create! codpes: 12345678, cpf: Digest::MD5.hexdigest(SALT+'12345678'), birth_date: '1970-01-30'
25 Environment.default.enable_plugin(StoaPlugin.name) 25 Environment.default.enable_plugin(StoaPlugin.name)
26 @user = create_user('joao-stoa', {:password => 'pass', :password_confirmation => 'pass'},:usp_id=>'87654321') 26 @user = create_user('joao-stoa', {:password => 'pass', :password_confirmation => 'pass'},:usp_id=>'87654321')
27 @user.activate 27 @user.activate
plugins/stoa/test/unit/usp_user_test.rb
@@ -16,7 +16,7 @@ class StoaPlugin::UspUserTest &lt; ActiveSupport::TestCase @@ -16,7 +16,7 @@ class StoaPlugin::UspUserTest &lt; ActiveSupport::TestCase
16 ActiveRecord::Base.establish_connection(:test) 16 ActiveRecord::Base.establish_connection(:test)
17 17
18 def setup 18 def setup
19 - StoaPlugin::UspUser.create({:codpes => 123456, :cpf => Digest::MD5.hexdigest(SALT+'12345678'), :birth_date => '1970-01-30'}, :without_protection => true) 19 + StoaPlugin::UspUser.create codpes: 123456, cpf: Digest::MD5.hexdigest(SALT+'12345678'), birth_date: '1970-01-30'
20 end 20 end
21 21
22 should 'check existence of usp_id' do 22 should 'check existence of usp_id' do
plugins/sub_organizations/lib/ext/organization.rb
@@ -2,8 +2,6 @@ require_dependency &#39;organization&#39; @@ -2,8 +2,6 @@ require_dependency &#39;organization&#39;
2 class Organization 2 class Organization
3 settings_items :sub_organizations_plugin_parent_to_be 3 settings_items :sub_organizations_plugin_parent_to_be
4 4
5 - attr_accessible :sub_organizations_plugin_parent_to_be  
6 -  
7 after_create do |organization| 5 after_create do |organization|
8 if organization.sub_organizations_plugin_parent_to_be.present? 6 if organization.sub_organizations_plugin_parent_to_be.present?
9 parent = Organization.find(organization.sub_organizations_plugin_parent_to_be) 7 parent = Organization.find(organization.sub_organizations_plugin_parent_to_be)
plugins/sub_organizations/lib/related_organizations_block.rb
@@ -2,8 +2,6 @@ class RelatedOrganizationsBlock &lt; ProfileListBlock @@ -2,8 +2,6 @@ class RelatedOrganizationsBlock &lt; ProfileListBlock
2 2
3 settings_items :organization_type, :type => :string, :default => 'both' 3 settings_items :organization_type, :type => :string, :default => 'both'
4 4
5 - attr_accessible :organization_type  
6 -  
7 def self.description 5 def self.description
8 _("Related Organizations") 6 _("Related Organizations")
9 end 7 end
plugins/sub_organizations/lib/sub_organizations_plugin/approve_paternity_relation.rb
@@ -6,8 +6,6 @@ class SubOrganizationsPlugin::ApprovePaternityRelation &lt; ActiveRecord::Base @@ -6,8 +6,6 @@ class SubOrganizationsPlugin::ApprovePaternityRelation &lt; ActiveRecord::Base
6 6
7 validates_presence_of :task, :parent, :child 7 validates_presence_of :task, :parent, :child
8 8
9 - attr_accessible :task, :parent, :child  
10 -  
11 class << self 9 class << self
12 def parent_approval(task) 10 def parent_approval(task)
13 find_by_task_id(task.id).parent 11 find_by_task_id(task.id).parent
plugins/sub_organizations/lib/sub_organizations_plugin/relation.rb
@@ -8,8 +8,6 @@ class SubOrganizationsPlugin::Relation &lt; ActiveRecord::Base @@ -8,8 +8,6 @@ class SubOrganizationsPlugin::Relation &lt; ActiveRecord::Base
8 validate :no_cyclical_reference, :if => 'parent.present? && child.present?' 8 validate :no_cyclical_reference, :if => 'parent.present? && child.present?'
9 validate :no_multi_level, :if => 'parent.present? && child.present?' 9 validate :no_multi_level, :if => 'parent.present? && child.present?'
10 10
11 - attr_accessible :parent, :child  
12 -  
13 def no_self_reference 11 def no_self_reference
14 errors.add(:child, c_('self-reference is not allowed.')) if parent == child 12 errors.add(:child, c_('self-reference is not allowed.')) if parent == child
15 end 13 end
plugins/suppliers/lib/ext/price_detail.rb
@@ -1,8 +0,0 @@ @@ -1,8 +0,0 @@
1 -require_dependency 'price_detail'  
2 -  
3 -class PriceDetail  
4 -  
5 - # should be on core, used by SuppliersPlugin::Import  
6 - attr_accessible :production_cost  
7 -  
8 -end  
plugins/suppliers/lib/ext/product.rb
@@ -28,18 +28,12 @@ class Product @@ -28,18 +28,12 @@ class Product
28 ProductCategory.find products.collect(&:product_category_id).compact.select{ |id| not id.zero? } 28 ProductCategory.find products.collect(&:product_category_id).compact.select{ |id| not id.zero? }
29 end 29 end
30 30
31 - attr_accessible :external_id  
32 settings_items :external_id, type: String, default: nil 31 settings_items :external_id, type: String, default: nil
33 32
34 - # should be on core, used by SuppliersPlugin::Import  
35 - attr_accessible :price_details  
36 -  
37 end 33 end
38 34
39 class Product 35 class Product
40 36
41 - attr_accessible :from_products, :from_product, :supplier_id, :supplier  
42 -  
43 has_many :sources_from_products, foreign_key: :to_product_id, class_name: 'SuppliersPlugin::SourceProduct', dependent: :destroy 37 has_many :sources_from_products, foreign_key: :to_product_id, class_name: 'SuppliersPlugin::SourceProduct', dependent: :destroy
44 has_one :sources_from_product, foreign_key: :to_product_id, class_name: 'SuppliersPlugin::SourceProduct' 38 has_one :sources_from_product, foreign_key: :to_product_id, class_name: 'SuppliersPlugin::SourceProduct'
45 has_many :sources_to_products, foreign_key: :from_product_id, class_name: 'SuppliersPlugin::SourceProduct', dependent: :destroy 39 has_many :sources_to_products, foreign_key: :from_product_id, class_name: 'SuppliersPlugin::SourceProduct', dependent: :destroy
plugins/suppliers/models/suppliers_plugin/base_product.rb
@@ -2,9 +2,6 @@ @@ -2,9 +2,6 @@
2 # cycle.products will go to an infinite loop 2 # cycle.products will go to an infinite loop
3 class SuppliersPlugin::BaseProduct < Product 3 class SuppliersPlugin::BaseProduct < Product
4 4
5 - attr_accessible :default_margin_percentage, :margin_percentage, :default_unit, :unit_detail,  
6 - :supplier_product_attributes  
7 -  
8 accepts_nested_attributes_for :supplier_product 5 accepts_nested_attributes_for :supplier_product
9 6
10 default_scope -> { 7 default_scope -> {
plugins/suppliers/models/suppliers_plugin/distributed_product.rb
1 class SuppliersPlugin::DistributedProduct < SuppliersPlugin::BaseProduct 1 class SuppliersPlugin::DistributedProduct < SuppliersPlugin::BaseProduct
2 2
3 - attr_accessible :from_products  
4 -  
5 - # missed from lib/ext/product.rb because of STI  
6 - attr_accessible :external_id, :price_details  
7 -  
8 validates_presence_of :supplier 3 validates_presence_of :supplier
9 4
10 def supplier_price 5 def supplier_price
plugins/suppliers/models/suppliers_plugin/source_product.rb
1 class SuppliersPlugin::SourceProduct < ActiveRecord::Base 1 class SuppliersPlugin::SourceProduct < ActiveRecord::Base
2 2
3 - attr_accessible :from_product, :to_product, :quantity  
4 -  
5 default_scope -> { includes :from_product, :to_product } 3 default_scope -> { includes :from_product, :to_product }
6 4
7 belongs_to :from_product, class_name: 'Product' 5 belongs_to :from_product, class_name: 'Product'
plugins/suppliers/models/suppliers_plugin/supplier.rb
@@ -2,8 +2,6 @@ class SuppliersPlugin::Supplier &lt; ActiveRecord::Base @@ -2,8 +2,6 @@ class SuppliersPlugin::Supplier &lt; ActiveRecord::Base
2 2
3 attr_accessor :distribute_products_on_create, :dont_destroy_dummy, :identifier_from_name 3 attr_accessor :distribute_products_on_create, :dont_destroy_dummy, :identifier_from_name
4 4
5 - attr_accessible :profile_id, :profile, :consumer, :consumer_id, :name, :name_abbreviation, :description  
6 -  
7 belongs_to :profile 5 belongs_to :profile
8 belongs_to :consumer, class_name: 'Profile' 6 belongs_to :consumer, class_name: 'Profile'
9 alias_method :supplier, :profile 7 alias_method :supplier, :profile
plugins/tolerance_time/lib/tolerance_time_plugin/publication.rb
1 class ToleranceTimePlugin::Publication < ActiveRecord::Base 1 class ToleranceTimePlugin::Publication < ActiveRecord::Base
2 2
3 belongs_to :target, :polymorphic => true 3 belongs_to :target, :polymorphic => true
  4 +
4 validates_presence_of :target_id, :target_type 5 validates_presence_of :target_id, :target_type
5 validates_uniqueness_of :target_id, :scope => :target_type 6 validates_uniqueness_of :target_id, :scope => :target_type
6 - attr_accessible :target  
7 7
8 class << self 8 class << self
9 def find_by_target(target) 9 def find_by_target(target)
plugins/tolerance_time/lib/tolerance_time_plugin/tolerance.rb
1 class ToleranceTimePlugin::Tolerance < ActiveRecord::Base 1 class ToleranceTimePlugin::Tolerance < ActiveRecord::Base
2 2
3 belongs_to :profile 3 belongs_to :profile
  4 +
4 validates_presence_of :profile_id 5 validates_presence_of :profile_id
5 validates_uniqueness_of :profile_id 6 validates_uniqueness_of :profile_id
6 validates_numericality_of :content_tolerance, :only_integer => true, :allow_nil => true 7 validates_numericality_of :content_tolerance, :only_integer => true, :allow_nil => true
7 validates_numericality_of :comment_tolerance, :only_integer => true, :allow_nil => true 8 validates_numericality_of :comment_tolerance, :only_integer => true, :allow_nil => true
8 - attr_accessible :profile, :content_tolerance, :comment_tolerance  
9 9
10 end 10 end
plugins/video/lib/video_plugin/video_block.rb
1 class VideoPlugin::VideoBlock < Block 1 class VideoPlugin::VideoBlock < Block
2 2
3 - attr_accessible :url, :width, :height  
4 -  
5 settings_items :url, :type => :string, :default => "" 3 settings_items :url, :type => :string, :default => ""
6 settings_items :width, :type => :integer, :default => 400 4 settings_items :width, :type => :integer, :default => 400
7 settings_items :height, :type => :integer, :default => 315 5 settings_items :height, :type => :integer, :default => 315
plugins/volunteers/lib/ext/profile.rb
1 require_dependency 'profile' 1 require_dependency 'profile'
2 2
3 -# attr_accessible must be defined on subclasses  
4 -Profile.descendants.each do |subclass|  
5 - subclass.class_eval do  
6 - attr_accessible :volunteers_settings  
7 - end  
8 -end  
9 -  
10 class Profile 3 class Profile
11 4
12 def volunteers_settings attrs = {} 5 def volunteers_settings attrs = {}
plugins/volunteers/models/volunteers_plugin/assignment.rb
1 class VolunteersPlugin::Assignment < ActiveRecord::Base 1 class VolunteersPlugin::Assignment < ActiveRecord::Base
2 2
3 - attr_accessible :profile_id  
4 -  
5 belongs_to :profile 3 belongs_to :profile
6 belongs_to :period, class_name: 'VolunteersPlugin::Period' 4 belongs_to :period, class_name: 'VolunteersPlugin::Period'
7 5
plugins/volunteers/models/volunteers_plugin/period.rb
1 class VolunteersPlugin::Period < ActiveRecord::Base 1 class VolunteersPlugin::Period < ActiveRecord::Base
2 2
3 - attr_accessible :name  
4 - attr_accessible :start, :end  
5 - attr_accessible :owner_type  
6 - attr_accessible :minimum_assigments  
7 - attr_accessible :maximum_assigments  
8 -  
9 belongs_to :owner, polymorphic: true 3 belongs_to :owner, polymorphic: true
10 4
11 has_many :assignments, class_name: 'VolunteersPlugin::Assignment', foreign_key: :period_id, include: [:profile], dependent: :destroy 5 has_many :assignments, class_name: 'VolunteersPlugin::Assignment', foreign_key: :period_id, include: [:profile], dependent: :destroy
plugins/work_assignment/lib/work_assignment_plugin/work_assignment.rb
@@ -4,10 +4,6 @@ class WorkAssignmentPlugin::WorkAssignment &lt; Folder @@ -4,10 +4,6 @@ class WorkAssignmentPlugin::WorkAssignment &lt; Folder
4 settings_items :default_email, :type => :string, :default => "" 4 settings_items :default_email, :type => :string, :default => ""
5 settings_items :allow_visibility_edition, :type => :boolean, :default => false 5 settings_items :allow_visibility_edition, :type => :boolean, :default => false
6 6
7 - attr_accessible :publish_submissions  
8 - attr_accessible :default_email  
9 - attr_accessible :allow_visibility_edition  
10 -  
11 def self.icon_name(article = nil) 7 def self.icon_name(article = nil)
12 'work-assignment' 8 'work-assignment'
13 end 9 end
@@ -39,16 +35,13 @@ class WorkAssignmentPlugin::WorkAssignment &lt; Folder @@ -39,16 +35,13 @@ class WorkAssignmentPlugin::WorkAssignment &lt; Folder
39 end 35 end
40 36
41 def find_or_create_author_folder(author) 37 def find_or_create_author_folder(author)
42 - children.find_by(slug: author.name.to_slug) || Folder.create!(  
43 - {  
44 - :name => author.name,  
45 - :parent => self,  
46 - :profile => profile,  
47 - :author => author,  
48 - :published => publish_submissions,  
49 - },  
50 - :without_protection => true  
51 - ) 38 + children.find_by_slug(author.name.to_slug) || Folder.create!(
  39 + name: author.name,
  40 + parent: self,
  41 + profile: profile,
  42 + author: author,
  43 + published: publish_submissions,
  44 + )
52 end 45 end
53 46
54 def submissions 47 def submissions
plugins/work_assignment/test/functional/work_assignment_plugin_myprofile_controller_test.rb
@@ -22,16 +22,7 @@ class WorkAssignmentPluginMyprofileControllerTest &lt; ActionController::TestCase @@ -22,16 +22,7 @@ class WorkAssignmentPluginMyprofileControllerTest &lt; ActionController::TestCase
22 work_assignment.save! 22 work_assignment.save!
23 assert_equal false, work_assignment.allow_visibility_edition 23 assert_equal false, work_assignment.allow_visibility_edition
24 parent = work_assignment.find_or_create_author_folder(@person) 24 parent = work_assignment.find_or_create_author_folder(@person)
25 - UploadedFile.create(  
26 - {  
27 - :uploaded_data => fixture_file_upload('/files/test.txt', 'text/plain'),  
28 - :profile => @organization,  
29 - :parent => parent,  
30 - :last_changed_by => @person,  
31 - :author => @person,  
32 - },  
33 - :without_protection => true  
34 - ) 25 + create_uploaded_file
35 submission = UploadedFile.find_by filename: 'test.txt' 26 submission = UploadedFile.find_by filename: 'test.txt'
36 assert_equal false, submission.published 27 assert_equal false, submission.published
37 assert_equal false, submission.parent.published 28 assert_equal false, submission.parent.published
@@ -67,16 +58,7 @@ class WorkAssignmentPluginMyprofileControllerTest &lt; ActionController::TestCase @@ -67,16 +58,7 @@ class WorkAssignmentPluginMyprofileControllerTest &lt; ActionController::TestCase
67 assert_equal true, work_assignment.allow_visibility_edition 58 assert_equal true, work_assignment.allow_visibility_edition
68 work_assignment.save! 59 work_assignment.save!
69 parent = work_assignment.find_or_create_author_folder(@person) 60 parent = work_assignment.find_or_create_author_folder(@person)
70 - UploadedFile.create(  
71 - {  
72 - :uploaded_data => fixture_file_upload('/files/test.txt', 'text/plain'),  
73 - :profile => @organization,  
74 - :parent => parent,  
75 - :last_changed_by => @person,  
76 - :author => @person,  
77 - },  
78 - :without_protection => true  
79 - ) 61 + create_uploaded_file
80 logout 62 logout
81 submission = UploadedFile.find_by filename: 'test.txt' 63 submission = UploadedFile.find_by filename: 'test.txt'
82 assert_equal false, submission.parent.published 64 assert_equal false, submission.parent.published
@@ -95,19 +77,9 @@ class WorkAssignmentPluginMyprofileControllerTest &lt; ActionController::TestCase @@ -95,19 +77,9 @@ class WorkAssignmentPluginMyprofileControllerTest &lt; ActionController::TestCase
95 @organization.add_member(@person) # current_user is a member 77 @organization.add_member(@person) # current_user is a member
96 work_assignment = create_work_assignment('Another Work Assignment', @organization, nil, true) 78 work_assignment = create_work_assignment('Another Work Assignment', @organization, nil, true)
97 parent = work_assignment.find_or_create_author_folder(@person) 79 parent = work_assignment.find_or_create_author_folder(@person)
98 - UploadedFile.create(  
99 - {  
100 - :uploaded_data => fixture_file_upload('/files/test.txt', 'text/plain'),  
101 - :profile => @organization,  
102 - :parent => parent,  
103 - :last_changed_by => @person,  
104 - :author => @person,  
105 - },  
106 - :without_protection => true  
107 - ) 80 + create_uploaded_file
108 logout 81 logout
109 82
110 -  
111 other_person = create_user('other_user').person 83 other_person = create_user('other_user').person
112 @organization.add_member(other_person) 84 @organization.add_member(other_person)
113 login_as :other_user 85 login_as :other_user
@@ -133,16 +105,7 @@ class WorkAssignmentPluginMyprofileControllerTest &lt; ActionController::TestCase @@ -133,16 +105,7 @@ class WorkAssignmentPluginMyprofileControllerTest &lt; ActionController::TestCase
133 @organization.add_member(other_person) 105 @organization.add_member(other_person)
134 work_assignment = create_work_assignment('Another Work Assignment', @organization, false, true) 106 work_assignment = create_work_assignment('Another Work Assignment', @organization, false, true)
135 parent = work_assignment.find_or_create_author_folder(@person) 107 parent = work_assignment.find_or_create_author_folder(@person)
136 - UploadedFile.create(  
137 - {  
138 - :uploaded_data => fixture_file_upload('/files/test.txt', 'text/plain'),  
139 - :profile => @organization,  
140 - :parent => parent,  
141 - :last_changed_by => @person,  
142 - :author => @person,  
143 - },  
144 - :without_protection => true  
145 - ) 108 + create_uploaded_file
146 submission = UploadedFile.find_by filename: 'test.txt' 109 submission = UploadedFile.find_by filename: 'test.txt'
147 assert_equal false, submission.article_privacy_exceptions.include?(other_person) 110 assert_equal false, submission.article_privacy_exceptions.include?(other_person)
148 post :edit_visibility, :profile => @organization.identifier, :article_id => parent.id, :article => { :published => false }, :q => other_person.id 111 post :edit_visibility, :profile => @organization.identifier, :article_id => parent.id, :article => { :published => false }, :q => other_person.id
@@ -155,16 +118,7 @@ class WorkAssignmentPluginMyprofileControllerTest &lt; ActionController::TestCase @@ -155,16 +118,7 @@ class WorkAssignmentPluginMyprofileControllerTest &lt; ActionController::TestCase
155 @organization.add_member(@person) # current_user is a member 118 @organization.add_member(@person) # current_user is a member
156 work_assignment = create_work_assignment('Work Assignment', @organization, nil, true) 119 work_assignment = create_work_assignment('Work Assignment', @organization, nil, true)
157 parent = work_assignment.find_or_create_author_folder(@person) 120 parent = work_assignment.find_or_create_author_folder(@person)
158 - UploadedFile.create(  
159 - {  
160 - :uploaded_data => fixture_file_upload('/files/test.txt', 'text/plain'),  
161 - :profile => @organization,  
162 - :parent => parent,  
163 - :last_changed_by => @person,  
164 - :author => @person,  
165 - },  
166 - :without_protection => true  
167 - ) 121 + create_uploaded_file
168 @organization.remove_member(@person) 122 @organization.remove_member(@person)
169 submission = UploadedFile.find_by filename: 'test.txt' 123 submission = UploadedFile.find_by filename: 'test.txt'
170 124
@@ -182,7 +136,18 @@ class WorkAssignmentPluginMyprofileControllerTest &lt; ActionController::TestCase @@ -182,7 +136,18 @@ class WorkAssignmentPluginMyprofileControllerTest &lt; ActionController::TestCase
182 end 136 end
183 137
184 private 138 private
185 - def create_work_assignment(name = nil, profile = nil, publish_submissions = nil, allow_visibility_edition = nil)  
186 - @work_assignment = WorkAssignmentPlugin::WorkAssignment.create!(:name => name, :profile => profile, :publish_submissions => publish_submissions, :allow_visibility_edition => allow_visibility_edition)  
187 - end 139 +
  140 + def create_work_assignment(name = nil, profile = nil, publish_submissions = nil, allow_visibility_edition = nil)
  141 + @work_assignment = WorkAssignmentPlugin::WorkAssignment.create!(:name => name, :profile => profile, :publish_submissions => publish_submissions, :allow_visibility_edition => allow_visibility_edition)
  142 + end
  143 +
  144 + def create_uploaded_file
  145 + UploadedFile.create(
  146 + uploaded_data: fixture_file_upload('/files/test.txt', 'text/plain'),
  147 + profile: @organization,
  148 + parent: parent,
  149 + last_changed_by: @person,
  150 + author: @person,
  151 + )
  152 + end
188 end 153 end
plugins/work_assignment/test/unit/work_assingment_plugin_test.rb
1 require 'test_helper' 1 require 'test_helper'
2 2
3 class WorkAssignmentPluginTest < ActiveSupport::TestCase 3 class WorkAssignmentPluginTest < ActiveSupport::TestCase
  4 +
4 should 'verify if a content is a work_assignment submission' do 5 should 'verify if a content is a work_assignment submission' do
5 organization = fast_create(Organization) 6 organization = fast_create(Organization)
6 folder = fast_create(Folder) 7 folder = fast_create(Folder)
7 person = fast_create(Person) 8 person = fast_create(Person)
8 - content = UploadedFile.create(  
9 - {  
10 - :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'),  
11 - :profile => organization,  
12 - :parent => folder,  
13 - :last_changed_by => person,  
14 - :author => person,  
15 - },  
16 - :without_protection => true  
17 - ) 9 +
  10 + create_uploaded_file organization, folder, person
18 refute WorkAssignmentPlugin.is_submission?(content) 11 refute WorkAssignmentPlugin.is_submission?(content)
19 12
20 work_assignment = WorkAssignmentPlugin::WorkAssignment.create!(:name => 'Work Assignment', :profile => organization) 13 work_assignment = WorkAssignmentPlugin::WorkAssignment.create!(:name => 'Work Assignment', :profile => organization)
@@ -64,15 +57,16 @@ class WorkAssignmentPluginTest &lt; ActiveSupport::TestCase @@ -64,15 +57,16 @@ class WorkAssignmentPluginTest &lt; ActiveSupport::TestCase
64 organization.add_member(author) 57 organization.add_member(author)
65 work_assignment ||= WorkAssignmentPlugin::WorkAssignment.create!(:name => 'Work Assignment', :profile => organization) 58 work_assignment ||= WorkAssignmentPlugin::WorkAssignment.create!(:name => 'Work Assignment', :profile => organization)
66 author_folder = work_assignment.find_or_create_author_folder(author) 59 author_folder = work_assignment.find_or_create_author_folder(author)
67 - content = UploadedFile.create(  
68 - {  
69 - :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'),  
70 - :profile => organization,  
71 - :parent => author_folder,  
72 - :last_changed_by => author,  
73 - :author => author,  
74 - },  
75 - :without_protection => true  
76 - ) 60 + create_uploaded_file organization, author_folder, author
  61 + end
  62 +
  63 + def create_uploaded_file organization, parent, author
  64 + UploadedFile.create(
  65 + uploaded_data: fixture_file_upload('/files/rails.png', 'image/png'),
  66 + profile: organization,
  67 + parent: parent,
  68 + last_changed_by: author,
  69 + author: author,
  70 + )
77 end 71 end
78 end 72 end
test/functional/content_viewer_controller_test.rb
@@ -143,7 +143,7 @@ class ContentViewerControllerTest &lt; ActionController::TestCase @@ -143,7 +143,7 @@ class ContentViewerControllerTest &lt; ActionController::TestCase
143 143
144 should 'not display forbidden articles' do 144 should 'not display forbidden articles' do
145 profile.articles.create!(:name => 'test') 145 profile.articles.create!(:name => 'test')
146 - profile.update!({:public_content => false}, :without_protection => true) 146 + profile.update! public_content: false
147 147
148 Article.any_instance.expects(:display_to?).with(anything).returns(false) 148 Article.any_instance.expects(:display_to?).with(anything).returns(false)
149 get :view_page, :profile => profile.identifier, :page => [ 'test' ] 149 get :view_page, :profile => profile.identifier, :page => [ 'test' ]
@@ -152,7 +152,7 @@ class ContentViewerControllerTest &lt; ActionController::TestCase @@ -152,7 +152,7 @@ class ContentViewerControllerTest &lt; ActionController::TestCase
152 152
153 should 'display allowed articles' do 153 should 'display allowed articles' do
154 profile.articles.create!(:name => 'test') 154 profile.articles.create!(:name => 'test')
155 - profile.update!({:public_content => false}, :without_protection => true) 155 + profile.update! public_content: false
156 156
157 Article.any_instance.expects(:display_to?).with(anything).returns(true) 157 Article.any_instance.expects(:display_to?).with(anything).returns(true)
158 get :view_page, :profile => profile.identifier, :page => [ 'test' ] 158 get :view_page, :profile => profile.identifier, :page => [ 'test' ]
test/functional/profile_roles_controller_test.rb
@@ -40,7 +40,8 @@ class ProfileRolesControllerTest &lt; ActionController::TestCase @@ -40,7 +40,8 @@ class ProfileRolesControllerTest &lt; ActionController::TestCase
40 community = fast_create(Community) 40 community = fast_create(Community)
41 admin = create_user_with_permission('admin_user', 'manage_custom_roles', community) 41 admin = create_user_with_permission('admin_user', 'manage_custom_roles', community)
42 login_as :admin_user 42 login_as :admin_user
43 - role = Role.create!({:name => 'delete_article', :key => 'profile_delete_article', :profile_id => community.id, :environment => Environment.default}, :without_protection => true) 43 + role = Role.create! name: 'delete_article', key: 'profile_delete_article',
  44 + profile_id: community.id, environment: Environment.default
44 post :remove , :profile => community.identifier, :id => role.id 45 post :remove , :profile => community.identifier, :id => role.id
45 46
46 assert_response :redirect 47 assert_response :redirect
@@ -53,7 +54,8 @@ class ProfileRolesControllerTest &lt; ActionController::TestCase @@ -53,7 +54,8 @@ class ProfileRolesControllerTest &lt; ActionController::TestCase
53 community = fast_create(Community) 54 community = fast_create(Community)
54 admin = create_user_with_permission('admin_user', 'manage_custom_roles', community) 55 admin = create_user_with_permission('admin_user', 'manage_custom_roles', community)
55 login_as :admin_user 56 login_as :admin_user
56 - role = Role.create!({:name => 'delete_article', :key => 'profile_delete_article', :profile_id => community.id, :environment => Environment.default}, :without_protection => true) 57 + role = Role.create! name: 'delete_article', key: 'profile_delete_article',
  58 + profile_id: community.id, environment: Environment.default
57 admin.add_role(role, community) 59 admin.add_role(role, community)
58 moderator_role = Role.find_by(name: "moderator") 60 moderator_role = Role.find_by(name: "moderator")
59 61
@@ -72,7 +74,8 @@ class ProfileRolesControllerTest &lt; ActionController::TestCase @@ -72,7 +74,8 @@ class ProfileRolesControllerTest &lt; ActionController::TestCase
72 community = fast_create(Community) 74 community = fast_create(Community)
73 admin = create_user_with_permission('admin_user', 'manage_custom_roles', community) 75 admin = create_user_with_permission('admin_user', 'manage_custom_roles', community)
74 login_as :admin_user 76 login_as :admin_user
75 - role = Role.create!({:name => 'delete_article', :key => 'profile_delete_article', :profile_id => community.id, :environment => Environment.default}, :without_protection => true) 77 + role = Role.create! name: 'delete_article', key: 'profile_delete_article',
  78 + profile_id: community.id, environment: Environment.default
76 79
77 assert_not_includes community.members_by_role(role), admin 80 assert_not_includes community.members_by_role(role), admin
78 81
@@ -86,7 +89,8 @@ class ProfileRolesControllerTest &lt; ActionController::TestCase @@ -86,7 +89,8 @@ class ProfileRolesControllerTest &lt; ActionController::TestCase
86 admin = create_user_with_permission('admin_user', 'manage_custom_roles', community) 89 admin = create_user_with_permission('admin_user', 'manage_custom_roles', community)
87 moderator = create_user_with_permission('profile_admin', 'edit_profile', community) 90 moderator = create_user_with_permission('profile_admin', 'edit_profile', community)
88 login_as :admin_user 91 login_as :admin_user
89 - role = Role.create!({:name => 'delete_article', :key => 'profile_delete_article', :profile_id => community.id, :environment => Environment.default}, :without_protection => true) 92 + role = Role.create! name: 'delete_article', key: 'profile_delete_article',
  93 + profile_id: community.id, environment: Environment.default
90 moderator_role = Role.find_by(name: "moderator") 94 moderator_role = Role.find_by(name: "moderator")
91 admin.add_role(moderator_role, community) 95 admin.add_role(moderator_role, community)
92 96
test/support/factories.rb
@@ -44,7 +44,7 @@ module Noosfero::Factory @@ -44,7 +44,7 @@ module Noosfero::Factory
44 data = defaults_for(name).merge(attrs) 44 data = defaults_for(name).merge(attrs)
45 object = name.to_s.camelize.constantize.new 45 object = name.to_s.camelize.constantize.new
46 if object.respond_to?(:assign_attributes) 46 if object.respond_to?(:assign_attributes)
47 - object.assign_attributes(data, :without_protection => true) 47 + object.assign_attributes data
48 else 48 else
49 data.each { |attribute, value| object.send(attribute.to_s+'=', value) } 49 data.each { |attribute, value| object.send(attribute.to_s+'=', value) }
50 end 50 end
test/unit/acts_as_having_settings_test.rb
@@ -8,7 +8,6 @@ class ActsAsHavingSettingsTest &lt; ActiveSupport::TestCase @@ -8,7 +8,6 @@ class ActsAsHavingSettingsTest &lt; ActiveSupport::TestCase
8 settings_items :flag_disabled_by_default, type: :boolean, default: false 8 settings_items :flag_disabled_by_default, type: :boolean, default: false
9 # to test that 'name' will be symbolized (see below) 9 # to test that 'name' will be symbolized (see below)
10 settings_items 'name', type: :string, default: N_('ENGLISH TEXT') 10 settings_items 'name', type: :string, default: N_('ENGLISH TEXT')
11 - attr_accessible :flag, :name, :flag_disabled_by_default  
12 end 11 end
13 12
14 should 'store settings in a hash' do 13 should 'store settings in a hash' do
test/unit/profile_activity_test.rb
@@ -10,7 +10,6 @@ class ProfileActivityTest &lt; ActiveSupport::TestCase @@ -10,7 +10,6 @@ class ProfileActivityTest &lt; ActiveSupport::TestCase
10 profile = fast_create Person 10 profile = fast_create Person
11 target = fast_create Person 11 target = fast_create Person
12 12
13 - ActionTracker::Record.attr_accessible :created_at, :updated_at  
14 tracker = ActionTracker::Record.create! verb: :leave_scrap, user: profile, target: target, created_at: Time.now-2.days, updated_at: Time.now-1.day 13 tracker = ActionTracker::Record.create! verb: :leave_scrap, user: profile, target: target, created_at: Time.now-2.days, updated_at: Time.now-1.day
15 14
16 pa = ProfileActivity.create! profile: profile, activity: tracker 15 pa = ProfileActivity.create! profile: profile, activity: tracker
vendor/plugins/access_control/lib/role.rb
1 class Role < ActiveRecord::Base 1 class Role < ActiveRecord::Base
2 2
3 - attr_accessible :key, :name, :environment, :permissions  
4 -  
5 has_many :role_assignments, :dependent => :destroy 3 has_many :role_assignments, :dependent => :destroy
  4 +
6 belongs_to :environment 5 belongs_to :environment
7 belongs_to :organization 6 belongs_to :organization
  7 +
8 serialize :permissions, Array 8 serialize :permissions, Array
  9 +
9 validates_presence_of :name 10 validates_presence_of :name
10 validates_uniqueness_of :name, :scope => :environment_id 11 validates_uniqueness_of :name, :scope => :environment_id
11 validates_uniqueness_of :key, :if => lambda { |role| !role.key.blank? }, :scope => :environment_id 12 validates_uniqueness_of :key, :if => lambda { |role| !role.key.blank? }, :scope => :environment_id
  13 +
12 before_validation :create_key, :on => :create 14 before_validation :create_key, :on => :create
13 15
14 def initialize(*args) 16 def initialize(*args)
vendor/plugins/access_control/lib/role_assignment.rb
1 class RoleAssignment < ActiveRecord::Base 1 class RoleAssignment < ActiveRecord::Base
2 2
3 - attr_accessible :accessor_id, :accessor_type, :role_id, :resource_id, :resource_type, :created_at  
4 -  
5 belongs_to :role 3 belongs_to :role
6 belongs_to :accessor, :polymorphic => true 4 belongs_to :accessor, :polymorphic => true
7 belongs_to :resource, :polymorphic => true 5 belongs_to :resource, :polymorphic => true
vendor/plugins/access_control/test/acts_as_accessor_test.rb
@@ -3,10 +3,6 @@ require File.dirname(__FILE__) + &#39;/test_helper&#39; @@ -3,10 +3,6 @@ require File.dirname(__FILE__) + &#39;/test_helper&#39;
3 3
4 class ActAsAccessorTest < Test::Unit::TestCase 4 class ActAsAccessorTest < Test::Unit::TestCase
5 5
6 - def setup  
7 - RoleAssignment.attr_accessible :accessor  
8 - end  
9 -  
10 def test_can_have_role_in_respect_to_an_resource 6 def test_can_have_role_in_respect_to_an_resource
11 res = AccessControlTestResource.create!(:name => 'bla') 7 res = AccessControlTestResource.create!(:name => 'bla')
12 a = AccessControlTestAccessor.create!(:name => 'ze') 8 a = AccessControlTestAccessor.create!(:name => 'ze')
@@ -57,7 +53,7 @@ class ActAsAccessorTest &lt; Test::Unit::TestCase @@ -57,7 +53,7 @@ class ActAsAccessorTest &lt; Test::Unit::TestCase
57 a = AccessControlTestAccessor.create!(:name => 'ze') 53 a = AccessControlTestAccessor.create!(:name => 'ze')
58 role = Role.create!(:name => 'an_author', :permissions => ['bli']) 54 role = Role.create!(:name => 'an_author', :permissions => ['bli'])
59 55
60 - assert !a.role_assignments.map{|ra|[ra.role, ra.accessor, ra.resource]}.include?([role, a, res]) 56 + assert !a.role_assignments.map{|ra|[ra.role, ra.accessor, ra.resource]}.include?([role, a, res])
61 assert !a.remove_role(role, res) 57 assert !a.remove_role(role, res)
62 end 58 end
63 59
vendor/plugins/access_control/test/role_assignment_test.rb
@@ -2,17 +2,13 @@ require File.dirname(__FILE__) + &#39;/test_helper&#39; @@ -2,17 +2,13 @@ require File.dirname(__FILE__) + &#39;/test_helper&#39;
2 2
3 class RoleAssignmentTest < Test::Unit::TestCase 3 class RoleAssignmentTest < Test::Unit::TestCase
4 4
5 - def setup  
6 - RoleAssignment.attr_accessible :is_global, :role, :accessor, :resource  
7 - end  
8 -  
9 def test_has_global_permission 5 def test_has_global_permission
10 role = Role.create(:name => 'new_role', :permissions => ['permission']) 6 role = Role.create(:name => 'new_role', :permissions => ['permission'])
11 ra = RoleAssignment.create(:role_id => role.id, :is_global => true) 7 ra = RoleAssignment.create(:role_id => role.id, :is_global => true)
12 assert ra.has_permission?('permission', 'global') 8 assert ra.has_permission?('permission', 'global')
13 assert !ra.has_permission?('not_permitted', 'global') 9 assert !ra.has_permission?('not_permitted', 'global')
14 - end  
15 - 10 + end
  11 +
16 def test_has_global_permission_with_global_resource 12 def test_has_global_permission_with_global_resource
17 role = Role.create(:name => 'new_role', :permissions => ['permission']) 13 role = Role.create(:name => 'new_role', :permissions => ['permission'])
18 accessor = AccessControlTestAccessor.create(:name => 'accessor') 14 accessor = AccessControlTestAccessor.create(:name => 'accessor')
vendor/plugins/access_control/test/role_test.rb
@@ -4,8 +4,6 @@ require File.join(File.dirname(__FILE__), &#39;test_helper&#39;) @@ -4,8 +4,6 @@ require File.join(File.dirname(__FILE__), &#39;test_helper&#39;)
4 class RoleTest < Test::Unit::TestCase 4 class RoleTest < Test::Unit::TestCase
5 5
6 def setup 6 def setup
7 - RoleAssignment.attr_accessible :role, :accessor  
8 - Role.attr_accessible :system  
9 Role.delete_all 7 Role.delete_all
10 end 8 end
11 9
@@ -15,11 +13,11 @@ class RoleTest &lt; Test::Unit::TestCase @@ -15,11 +13,11 @@ class RoleTest &lt; Test::Unit::TestCase
15 assert role.save 13 assert role.save
16 assert_equal count + 1, Role.count 14 assert_equal count + 1, Role.count
17 end 15 end
18 - 16 +
19 def test_uniqueness_of_name 17 def test_uniqueness_of_name
20 Role.create(:name => 'role_name') 18 Role.create(:name => 'role_name')
21 role = Role.new(:name => 'role_name') 19 role = Role.new(:name => 'role_name')
22 - assert ! role.save 20 + assert ! role.save
23 end 21 end
24 22
25 def test_uniqueness_of_key 23 def test_uniqueness_of_key
vendor/plugins/access_control/test/test_helper.rb
@@ -18,7 +18,6 @@ RoleAssignment.table_name = &#39;access_control_test_role_assignments&#39; @@ -18,7 +18,6 @@ RoleAssignment.table_name = &#39;access_control_test_role_assignments&#39;
18 class AccessControlTestAccessor < ActiveRecord::Base 18 class AccessControlTestAccessor < ActiveRecord::Base
19 self.table_name = 'access_control_test_accessors' 19 self.table_name = 'access_control_test_accessors'
20 acts_as_accessor 20 acts_as_accessor
21 - attr_accessible :name  
22 def cache_keys(arg) 21 def cache_keys(arg)
23 [] 22 []
24 end 23 end
@@ -32,8 +31,6 @@ class AccessControlTestResource &lt; ActiveRecord::Base @@ -32,8 +31,6 @@ class AccessControlTestResource &lt; ActiveRecord::Base
32 self.table_name = 'access_control_test_resources' 31 self.table_name = 'access_control_test_resources'
33 acts_as_accessible 32 acts_as_accessible
34 PERMISSIONS[self.class.name] = {'bla' => N_('Bla')} 33 PERMISSIONS[self.class.name] = {'bla' => N_('Bla')}
35 -  
36 - attr_accessible :name  
37 end 34 end
38 35
39 # controller to test protection 36 # controller to test protection
vendor/plugins/action_tracker/lib/action_tracker_model.rb
1 module ActionTracker 1 module ActionTracker
2 class Record < ActiveRecord::Base 2 class Record < ActiveRecord::Base
3 - attr_accessible :verb, :params, :user, :target  
4 3
5 self.table_name = 'action_tracker' 4 self.table_name = 'action_tracker'
6 5
vendor/plugins/kandadaboggu-vote_fu/lib/models/vote.rb
@@ -15,8 +15,6 @@ class Vote &lt; ActiveRecord::Base @@ -15,8 +15,6 @@ class Vote &lt; ActiveRecord::Base
15 belongs_to :voteable, :polymorphic => true 15 belongs_to :voteable, :polymorphic => true
16 belongs_to :voter, :polymorphic => true 16 belongs_to :voter, :polymorphic => true
17 17
18 - attr_accessible :vote, :voter, :voteable  
19 -  
20 # Uncomment this to limit users to a single vote on each item. 18 # Uncomment this to limit users to a single vote on each item.
21 #validates_uniqueness_of :voteable_id, :scope => [:voteable_type, :voter_type, :voter_id] 19 #validates_uniqueness_of :voteable_id, :scope => [:voteable_type, :voter_type, :voter_id]
22 20