Thanks for fast response!.
#controller
class AnswersController < ApplicationController
layout "default"
def create
@w1 = rand(9999999)
@w = Digest::SHA1.hexdigest(@w1.to_s)
@token = Token.find_by_token(params[:token])
# params[:token]
@answers=Hash.new
# if request.post?
#@answers = Answer.new(:token=>121,:question_id=>question.id)
questions = Question.find(:all,:conditions=>"enabled=1")
questions.each do |question|
if params["answer_"+question.id.to_s]
@answers[question.id]=params["answer_"+question.id.to_s]
if !
Answer.create(:question_id=>question.id,:token=>"",:text=>params["answer_"+question.id.to_s])
flash[:error]="Can`t create answer!"
end
end
end
if !flash[:error]
redirect_to :action=>"pass"
return false
end
# end
end
def index
@answers=Hash.new
@questions = Question.find(:all,:conditions=>"enabled=1")
#.where(["id = 1"])
end
def pass
flash[:notice]="<span id='ty'>Thank you for your answers!</span>"
render :text=>"", :layout=>"ty"
end
def about
end
end
#############
How i can check tokens?
if @token (from db) == token_url (check the url) ?
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.