I'm hoping someone can enlighten a noob as to the 'Rails Way' of redirecting to a specific survey using the Surveyor gem (1.4.0pre). I've created a separate 'Members' model to capture an email address on landing, and when Submit/Next is clicked, I'd like that email address persisted to the db and the desired survey shown.
MembersController:
def create
@member = Member.new(member_params)
if @member.save
flash[:success] = "Thanks for taking part!"
# This should redirect to the new survey.....
else
render 'new'
end
end
I've read the gem documentation and it states a POST request to surveys/name-of-survey/ is required, but I understand redirect_to issues a GET request and calling a method of one controller (surveys) from within another controller (members) is bad news and not advised.
Any assistance on how to implement the desired behaviour would be greatly appreciated!
Thanks.
Aucun commentaire:
Enregistrer un commentaire