[Facebooker-talk] Facebooker scaffolding errors
Kate Dohe
dohe at hawaii.edu
Sat Nov 1 22:29:07 EDT 2008
Hi everyone,
My development team is using facebooker to develop a simple
questionnaire for distribution via facebook, as part of a research
project we're involved with. In order to store survey responses for
research purposes, we elected to scaffold survey_responses and then
work from there. As part of our setup, we modified routes.rb as follows:
ActionController::Routing::Routes.draw do |map|
map.resources :survey_responses, :conditions => {:canvas => true}
# The priority is based upon order of creation: first created ->
highest priority.
.....
map.root :controller => "survey_responses", :action => 'new'
Once we turned on the server and visited http://apps.facebook.com/stem_survey
two errors surfaced in facebook:
" urlexception unable to parse URL /http://apps.facebooker.com/stem_survey//survey_responses/new
"
and a second error related to fb:editor.
Inside new.fmbl.erb:
<% facebook_form_for(@survey_response) do |f| %>
we changed to
<% facebook_form_for(:survey_response, at survey_response,:url => '/
stem_survey/survey_responses/create', :labelwidth => '75', :width =>
'500') do |f| %>
Which seemed to correct the fb:editor problems, but still caused
incorrect url parsing upon creation of a survey record. To resolve
this, we changed the survey_responses_controller to:
respond_to do |format|
if @survey_response.save
flash[:notice] = 'SurveyResponse was successfully created.'
format.html { redirect_to(@survey_response) }
format.fbml { redirect_to('http://apps.facebook.com/stem_survey/survey_responses/'+@survey_response.id.to_s)
}
format.xml { render :xml => @survey_response, :status
=> :created, :location => @survey_response }
Is there a more elegant solution to using scaffolding in a facebooker-
based application?
Thanks in advance,
=================
Kate Dohe
HNLC Staff
email: dohe at hawaii.edu
cell phone: 417.773.4876
office: POST 309, University of Hawai'i at Manoa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/facebooker-talk/attachments/20081101/f94f2dae/attachment.html>
More information about the Facebooker-talk
mailing list