Module: Surveyor::Models::SurveyTranslationMethods

Included in:
SurveyTranslation
Defined in:
lib/surveyor/models/survey_translation_methods.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/surveyor/models/survey_translation_methods.rb', line 4

def self.included(base)
  # Associations
  base.send :belongs_to, :survey

  @@validations_already_included ||= nil
  unless @@validations_already_included
    # Validations
    base.send :validates_presence_of, :locale, :translation
    base.send :validates_uniqueness_of, :locale, :scope => :survey_id
    # this causes issues with building and saving
    #, :survey

    @@validations_already_included = true
  end

  # Whitelisting attributes
  base.send :attr_accessible, :survey, :survey_id, :locale, :translation
end

Instance Method Details

#default_argsObject



29
30
# File 'lib/surveyor/models/survey_translation_methods.rb', line 29

def default_args
end

#initialize(*args) ⇒ Object

Instance Methods



24
25
26
27
# File 'lib/surveyor/models/survey_translation_methods.rb', line 24

def initialize(*args)
  super(*args)
  default_args
end