Introduce strong parameters

This commit is contained in:
Stella Rouzi 2015-10-28 18:05:15 +02:00
parent 38bc2e3c3a
commit 355ecc0ac6
93 changed files with 172 additions and 241 deletions

View file

@ -1,6 +1,4 @@
class Answer < ActiveRecord::Base
attr_accessible :title
has_many :qanswers
has_many :questions, through: :qanswers

View file

@ -1,8 +1,5 @@
class CallForPaper < ActiveRecord::Base
belongs_to :conference
attr_accessible :start_date, :end_date,
:schedule_changes, :rating,
:schedule_public, :include_cfp_in_splash, :conference_id
validates_presence_of :start_date, :end_date
validates :rating, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 10 }

View file

@ -1,7 +1,4 @@
class Campaign < ActiveRecord::Base
attr_accessible :name, :utm_source, :utm_medium, :utm_term,
:utm_content, :utm_campaign, :target_ids, :conference_id
validates :name, :utm_campaign, presence: true
has_many :targets, dependent: :nullify

View file

@ -1,6 +1,5 @@
class Comment < ActiveRecord::Base
acts_as_nested_set scope: [:commentable_id, :commentable_type]
attr_accessible :commentable, :body, :user_id
validates_presence_of :body
validates_presence_of :user
after_create :send_notification

View file

@ -1,8 +1,6 @@
class Commercial < ActiveRecord::Base
belongs_to :commercialable, polymorphic: true
attr_accessible :commercial_id, :commercial_type
validates :commercial_id, presence: true
validates :commercial_type, presence: true

View file

@ -8,18 +8,6 @@ class Conference < ActiveRecord::Base
default_scope { order('start_date DESC') }
attr_accessible :title, :short_title, :description, :timezone, :html_export_path,
:start_date, :end_date, :rooms_attributes, :tracks_attributes,
:dietary_choices_attributes, :use_dietary_choices,
:tickets_attributes, :social_events_attributes, :event_types_attributes,
:logo, :questions_attributes,
:question_ids, :answers_attributes, :answer_ids, :difficulty_levels_attributes,
:use_difficulty_levels, :use_vpositions, :use_vdays, :vdays_attributes,
:vpositions_attributes, :use_volunteers, :color,
:sponsorship_levels_attributes, :sponsors_attributes,
:photos_attributes, :targets, :targets_attributes,
:campaigns, :campaigns_attributes
has_paper_trail
has_and_belongs_to_many :questions

View file

@ -1,7 +1,4 @@
class Contact < ActiveRecord::Base
attr_accessible :conference_id, :social_tag, :email, :facebook, :googleplus, :twitter,
:instagram, :public, :sponsor_email
belongs_to :conference
validates :conference, presence: true

View file

@ -1,6 +1,4 @@
class DietaryChoice < ActiveRecord::Base
attr_accessible :title
belongs_to :conference
has_many :registrations
end

View file

@ -1,6 +1,4 @@
class DifficultyLevel < ActiveRecord::Base
attr_accessible :title, :description, :color, :conference_id
belongs_to :conference
has_many :events, dependent: :nullify

View file

@ -1,14 +1,4 @@
class EmailSettings < ActiveRecord::Base
attr_accessible :send_on_registration, :registration_subject, :registration_body,
:send_on_accepted, :accepted_subject, :accepted_body,
:send_on_rejected, :rejected_subject, :rejected_body,
:send_on_confirmed_without_registration, :confirmed_without_registration_subject, :confirmed_without_registration_body,
:send_on_conference_dates_updated, :conference_dates_updated_subject, :conference_dates_updated_body,
:send_on_conference_registration_dates_updated, :conference_registration_dates_updated_subject, :conference_registration_dates_updated_body,
:send_on_venue_updated, :venue_updated_subject, :venue_updated_body,
:send_on_call_for_papers_dates_updated, :call_for_papers_dates_updated_subject, :call_for_papers_dates_updated_body,
:send_on_call_for_papers_schedule_public, :call_for_papers_schedule_public_subject, :call_for_papers_schedule_public_body
def get_values(conference, user, event = nil)
h = {
'email' => user.email,

View file

@ -1,9 +1,6 @@
class Event < ActiveRecord::Base
include ActiveRecord::Transitions
has_paper_trail
attr_accessible :title, :subtitle, :abstract, :description, :user, :users_attributes,
:proposal_additional_speakers, :event_type_id, :track_id,
:difficulty_level_id, :require_registration, :is_highlight
acts_as_commentable

View file

@ -1,7 +1,4 @@
class EventType < ActiveRecord::Base
attr_accessible :title, :length, :minimum_abstract_length, :maximum_abstract_length, :color,
:conference_id, :description
belongs_to :conference
has_many :events, dependent: :restrict_with_error

View file

@ -1,5 +1,4 @@
class EventUser < ActiveRecord::Base
attr_accessible :event, :user, :user_id, :event_role
# TODO Do we need these roles?
ROLES = [['Speaker', 'speaker'], ['Submitter', 'submitter'], ['Moderator', 'moderator']]

View file

@ -1,6 +1,4 @@
class EventsRegistration < ActiveRecord::Base
attr_accessible :registration_id, :event_id
belongs_to :registration
belongs_to :event
end

View file

@ -1,5 +1,4 @@
class Lodging < ActiveRecord::Base
attr_accessible :name, :description, :photo, :website_link, :conference_id
belongs_to :conference
validates :name, presence: true

View file

@ -1,5 +1,4 @@
class Photo < ActiveRecord::Base
attr_accessible :picture, :description
belongs_to :conference
validates_presence_of :picture
has_attached_file :picture,

View file

@ -1,6 +1,4 @@
class Qanswer < ActiveRecord::Base
attr_accessible :question_id, :answer_id
belongs_to :question
belongs_to :answer, dependent: :delete

View file

@ -1,6 +1,4 @@
class Question < ActiveRecord::Base
attr_accessible :title, :global, :answers_attributes, :answer_ids, :question_type_id, :conference_id
belongs_to :question_type
has_and_belongs_to_many :conferences

View file

@ -1,5 +1,3 @@
class QuestionType < ActiveRecord::Base
attr_accessible :title, :description
has_many :questions
end

View file

@ -11,10 +11,6 @@ class Registration < ActiveRecord::Base
has_many :events_registrations
has_many :workshops, through: :events_registrations, source: :event
attr_accessible :user_id, :conference_id, :arrival, :departure, :user_attributes, :attended,
:other_dietary_choice, :dietary_choice_id, :social_event_ids, :other_special_needs,
:event_ids, :volunteer, :vchoice_ids, :qanswer_ids, :qanswers_attributes
accepts_nested_attributes_for :user
accepts_nested_attributes_for :social_events
accepts_nested_attributes_for :qanswers

View file

@ -1,6 +1,4 @@
class RegistrationPeriod < ActiveRecord::Base
attr_accessible :description, :start_date, :end_date
validates :start_date, :end_date, presence: true
belongs_to :conference

View file

@ -1,5 +1,4 @@
class Role < ActiveRecord::Base
attr_accessible :name, :description
has_and_belongs_to_many :users
belongs_to :resource, polymorphic: true

View file

@ -1,6 +1,4 @@
class Room < ActiveRecord::Base
attr_accessible :name, :size, :conference_id
belongs_to :conference
has_many :events, dependent: :nullify

View file

@ -1,6 +1,4 @@
class SocialEvent < ActiveRecord::Base
attr_accessible :title, :description, :date
belongs_to :conference
has_and_belongs_to_many :registrations
end

View file

@ -1,8 +1,3 @@
class Splashpage < ActiveRecord::Base
belongs_to :conference
attr_accessible :public,
:include_tracks, :include_program, :include_cfp,
:include_venue, :include_registrations,
:include_tickets, :include_lodgings,
:include_sponsors, :include_social_media
end

View file

@ -1,5 +1,4 @@
class Sponsor < ActiveRecord::Base
attr_accessible :name, :description, :website_url, :logo, :sponsorship_level_id, :conference_id
belongs_to :sponsorship_level
belongs_to :conference
has_attached_file :logo,

View file

@ -1,5 +1,4 @@
class SponsorshipLevel < ActiveRecord::Base
attr_accessible :title, :conference_id
validates_presence_of :title
belongs_to :conference
acts_as_list scope: :conference

View file

@ -1,5 +1,4 @@
class Subscription < ActiveRecord::Base
attr_accessible :user_id, :conference_id
validates_uniqueness_of :user_id, scope: [:conference_id]
belongs_to :conference
belongs_to :user

View file

@ -1,8 +1,6 @@
class Target < ActiveRecord::Base
include ActionView::Helpers::TextHelper
attr_accessible :due_date, :target_count, :unit, :conference_id
default_scope { order('due_date ASC') }
def self.units

View file

@ -3,7 +3,6 @@ class Ticket < ActiveRecord::Base
has_many :ticket_purchases, dependent: :destroy
has_many :buyers, -> { distinct }, through: :ticket_purchases, source: :user
attr_accessible :conference, :title, :url, :description, :conference_id, :price_cents, :price_currency, :price
monetize :price_cents, with_model_currency: :price_currency
# This validation is for the sake of simplicity.

View file

@ -3,8 +3,6 @@ class TicketPurchase < ActiveRecord::Base
belongs_to :user
belongs_to :conference
attr_accessible :ticket_id, :user_id, :conference_id, :paid, :quantity
validates :ticket_id, :user_id, :conference_id, :quantity, presence: true
validates_numericality_of :quantity, greater_than: 0

View file

@ -1,5 +1,4 @@
class Track < ActiveRecord::Base
attr_accessible :name, :description, :color, :conference_id
belongs_to :conference
has_many :events, dependent: :nullify

View file

@ -32,10 +32,6 @@ class User < ActiveRecord::Base
has_and_belongs_to_many :roles
has_many :openids
attr_accessible :email, :password, :password_confirmation, :remember_me, :role_id, :role_ids,
:name, :email_public, :biography, :nickname, :affiliation, :is_admin,
:tshirt, :mobile, :volunteer_experience, :languages, :username, :login, :is_disabled
attr_accessor :login
has_many :event_users, dependent: :destroy

View file

@ -1,6 +1,4 @@
class Vday < ActiveRecord::Base
attr_accessible :day, :description
belongs_to :conference
has_many :vchoices

View file

@ -3,7 +3,6 @@ class Venue < ActiveRecord::Base
has_many :lodgings
before_create :generate_guid
attr_accessible :name, :street, :postalcode, :city, :country, :longitude, :latitude, :description, :website, :photo, :lodgings_attributes, :conference_id
validates :name, :street, :city, :country, presence: true
has_attached_file :photo,

View file

@ -1,6 +1,4 @@
class Vote < ActiveRecord::Base
attr_accessible :rating
belongs_to :user
belongs_to :event
delegate :name, to: :user

View file

@ -1,6 +1,4 @@
class Vposition < ActiveRecord::Base
attr_accessible :title, :description, :vday_ids
belongs_to :conference
has_many :vchoices