Commit ff9130058d63fea9540c1a2a2e0ee3df7797d26c

Authored by Lee Dykes
1 parent ec19eb0b
Exists in master

Taking relationship stuff out of the concerns, into the instance

lib/surveyable/acts_as_response.rb
... ... @@ -3,14 +3,16 @@ module Surveyable
3 3 extend ActiveSupport::Concern
4 4 included do
5 5 has_many :answers, as: :response
  6 + def survey
  7 + self.send(survey_relationship)
  8 + end
6 9 end
7 10 module ClassMethods
8   - def acts_as_response(survey, options = {})
  11 + def acts_as_response(survey_relationship, options = {})
9 12 cattr_accessor :survey
10   - self.survey = survey
  13 + self.survey_relationship = survey_relationship.to_s
11 14 end
12 15 end
13 16 end
14 17 end
15   -
16 18 ActiveRecord::Base.send :include, Surveyable::ActsAsResponse
17 19 \ No newline at end of file
... ...
lib/surveyable/acts_as_survey.rb
... ... @@ -6,9 +6,9 @@ module Surveyable
6 6  
7 7 end
8 8 module ClassMethods
9   - def acts_as_survey(responses, options = {})
10   - cattr_accessor :responses
11   - self.responses = responses
  9 + def acts_as_survey(response_relationship, options = {})
  10 + #cattr_accessor :responses
  11 + #self.responses = responses
12 12 end
13 13 end
14 14 end
... ...
lib/surveyable/version.rb
1 1 module Surveyable
2   - VERSION = "0.1.1"
  2 + VERSION = "0.1.2"
3 3 end
... ...