From 6aa016fdfa45ff560d5debfbf0bf0a26a1472ea8 Mon Sep 17 00:00:00 2001 From: Dhruv Kapadia Date: Sat, 13 Feb 2010 15:41:39 -0500 Subject: [PATCH] Changes to support exporting data --- app/controllers/questions_controller.rb | 4 ++-- app/models/question.rb | 1 + config/routes.rb | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/questions_controller.rb b/app/controllers/questions_controller.rb index 21bb912..248dad1 100644 --- a/app/controllers/questions_controller.rb +++ b/app/controllers/questions_controller.rb @@ -4,7 +4,6 @@ class QuestionsController < InheritedResources::Base respond_to :xml, :json respond_to :csv, :only => :export #leave the option for xml export here belongs_to :site, :optional => true - #has_scope :voted_on_by def show @question = Question.find(params[:id]) @@ -69,7 +68,8 @@ class QuestionsController < InheritedResources::Base end def export - + authenticate + type = params[:type] if type == 'votes' diff --git a/app/models/question.rb b/app/models/question.rb index fcec587..571f700 100644 --- a/app/models/question.rb +++ b/app/models/question.rb @@ -8,6 +8,7 @@ class Question < ActiveRecord::Base has_many :choices, :order => 'score DESC' has_many :prompts do def pick(algorithm = nil) + logger.info( "inside Question#prompts#pick - never called?") if algorithm algorithm.pick_from(self) #todo else diff --git a/config/routes.rb b/config/routes.rb index c030cdc..94af3ce 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,6 @@ ActionController::Routing::Routes.draw do |map| map.resources :clicks - map.resources :questions, :member => { :export => :get, :set_autoactivate_ideas_from_abroad => :put, :activate => :put, :suspend => :put} do |question| + map.resources :questions, :member => { :export => :post, :set_autoactivate_ideas_from_abroad => :put, :activate => :put, :suspend => :put} do |question| question.resources :items question.resources :prompts, :member => {:vote_left => :post, :vote_right => :post, :skip => :post, :vote => :post}, :collection => {:single => :get, :index => :get} -- libgit2 0.21.2