Commit 200093aef474374ad2447a74624f6ca18e3dd0a2

Authored by Dhruv Kapadia
1 parent 2a437901

Adding 'user_created' to people requesting choices

app/controllers/choices_controller.rb
... ... @@ -25,7 +25,7 @@ class ChoicesController < InheritedResources::Base
25 25 end
26 26 end
27 27 index! do |format|
28   - format.xml { render :xml => @choices.to_xml(:only => [ :data, :score, :id, :active ])}
  28 + format.xml { render :xml => @choices.to_xml(:only => [ :data, :score, :id, :active], :methods => :user_created)}
29 29 end
30 30  
31 31 end
... ...
app/models/choice.rb
... ... @@ -75,6 +75,11 @@ class Choice < ActiveRecord::Base
75 75 self.score = compute_score
76 76 save!
77 77 end
  78 +
  79 + def user_created
  80 + self.item.creator_id != self.question.creator_id
  81 + end
  82 +
78 83  
79 84 protected
80 85  
... ...
config/environment.rb
... ... @@ -9,8 +9,9 @@ require File.join(File.dirname(__FILE__), 'boot')
9 9 Rails::Initializer.run do |config|
10 10 # Settings in config/environments/* take precedence over those specified here.
11 11  
12   - config.time_zone = 'Eastern Time (US & Canada)'
  12 + #config.time_zone = 'Eastern Time (US & Canada)'
13 13  
  14 + config.active_record.default_timezone = 'Eastern Time (US & Canada)'
14 15 #config.action_mailer.delivery_method = :smtp
15 16 config.action_mailer.delivery_method = :sendmail
16 17  
... ...