census 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
data/app/models/answer.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  class Answer < ActiveRecord::Base
2
2
 
3
- belongs_to :question
4
- belongs_to :user
3
+ belongs_to :question, :inverse_of => :answers
4
+ belongs_to :user, :inverse_of => :answers
5
5
 
6
6
  validates_presence_of :question,
7
7
  :user
@@ -6,7 +6,7 @@ class Question < ActiveRecord::Base
6
6
  has_many :choices, :dependent => :destroy, :inverse_of => :question
7
7
  accepts_nested_attributes_for :choices, :reject_if => lambda { |a| a[:value].blank? }, :allow_destroy => true
8
8
 
9
- has_many :answers, :dependent => :destroy
9
+ has_many :answers, :dependent => :destroy, :inverse_of => :question
10
10
 
11
11
  validates_presence_of :prompt,
12
12
  :data_group
data/lib/census/user.rb CHANGED
@@ -26,7 +26,7 @@ module Census
26
26
  # Hook for defining associations.
27
27
  def self.included(model)
28
28
  model.class_eval do
29
- has_many :answers, :dependent => :destroy
29
+ has_many :answers, :dependent => :destroy, :inverse_of => :user
30
30
  accepts_nested_attributes_for :answers, :reject_if => lambda { |a| a[:data].blank? }
31
31
  end
32
32
  end
@@ -9,7 +9,7 @@
9
9
  #
10
10
  # It's strongly recommended to check this file into your version control system.
11
11
 
12
- ActiveRecord::Schema.define(:version => 20100406160306) do
12
+ ActiveRecord::Schema.define(:version => 20100406184714) do
13
13
 
14
14
  create_table "answers", :force => true do |t|
15
15
  t.integer "question_id"
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
7
+ - 2
8
8
  - 0
9
- version: 0.1.0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mark Kendall
@@ -167,7 +167,7 @@ test_files:
167
167
  - test/rails_root/config/initializers/new_rails_defaults.rb
168
168
  - test/rails_root/config/initializers/session_store.rb
169
169
  - test/rails_root/config/routes.rb
170
- - test/rails_root/db/migrate/20100406160306_create_census_tables.rb
170
+ - test/rails_root/db/migrate/20100406184714_create_census_tables.rb
171
171
  - test/rails_root/db/schema.rb
172
172
  - test/rails_root/test/factories/census.rb
173
173
  - test/rails_root/test/performance/browsing_test.rb