RipTheJacker/survey-gizmo-ruby — Issue #1: Adding response object
Author: rant93
Created: 2011-11-11 07:12:39+00:00
State: open

Can you explain how I would add a Survey Response object? I have tried installing as a gem and using an initializer to path the library and also as a plugin and just adding the response.rb file to the api directory and always the same result. I can retrieve the survey and page objects, but trying to access the response object always throws "NameError (uninitialized constant SurveyGizmo::API::Response):"

I have put logging in and I am certain that response.rb gets loaded by 'require "survey_gizmo/api/response"'

module SurveyGizmo; module API
class Response
include SurveyGizmo::Resource

attribute :id, Integer
attribute :survey_id, Integer

route '/survey/:survey_id/surveyresponse/:id', :via => [:get, :update, :delete]
route '/survey/:survey_id/surveyresponse', :via => :create

def to_param_options
{:id => self.id, :survey_id => self.survey_id}
end
end
end; end

I also added a line "collection :responses" in api/survey.rb just in case.

@pages = SurveyGizmo::API::Page.all(:survey_id => 123456) # works
@responses = SurveyGizmo::API::Response.all(:survey_id => 123456) # fails

Do you have any advice?

Thanks