Commit e0483543337f7826e48d593550f2586f27946513
1 parent
0c649c66
Exists in
master
Moving away from concerns setup to model setup
Showing
2 changed files
with
5 additions
and
8 deletions
Show diff stats
lib/surveyable/acts_as_survey.rb
1 | 1 | module Surveyable |
2 | 2 | module ActsAsSurvey |
3 | - extend ActiveSupport::Concern | |
4 | - included do | |
5 | - has_many :questions, as: :survey, class_name: 'Surveyable::Question' | |
6 | - | |
3 | + def self.included(base) | |
4 | + base.send :extend, ClassMethods | |
7 | 5 | end |
8 | 6 | module ClassMethods |
9 | 7 | def acts_as_survey(response_relationship, options = {}) |
8 | + has_many :questions, as: :survey, class_name: 'Surveyable::Question' | |
10 | 9 | #cattr_accessor :responses |
11 | 10 | #self.responses = responses |
12 | 11 | end |
13 | 12 | end |
14 | 13 | end |
15 | -end | |
16 | - | |
17 | -ActiveRecord::Base.extend(Surveyable::ActsAsSurvey) | |
18 | 14 | \ No newline at end of file |
15 | +end | |
19 | 16 | \ No newline at end of file | ... | ... |
lib/surveyable/version.rb