Link + Params

Hello!

I have database called "Auth", there are following fields: id, auth, is_active, created_at, updated_at and i have 1 active record:

One way to slice it: In your controller's find action, instead of doing: @auth = Auth.find(params[:id])

You could use: @auth = Auth.find_by_auth(params[:auth])

I'm assuming you have a unique constraint on the auth field...

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

Well I'm entirely sure what you're trying to do but presumably you'll need to grab something out of the params hash (params[:auth] for the url given in your first email) and then verify that a token of that value does indeed exist in your database (and is still active)

Fred