Я не могу аутентифицировать Transaction_Id
, где это первичный ключ моей таблицы транзакций, в то время как я могу сделать это с email
. в чем может быть проблема? Помогите. спасибо.
вот моя модель / транзакция:
def self.authenticate(email, transaction_id)
user = Transaction.find_by_email(email)
if user && user.Transaction_Id
return user
else
return false
end
end
вот мой контроллер / модификации:
def attempt_login
user = Transaction.authenticate(params[:email], params[:Transaction_Id])
if user
session[:user_id] = user.id
session[:email] = user.email
flash[:notice] = "You are now logged in!"
redirect_to :action => "modify"
else
flash[:notice] = "Invalid username/password combination."
redirect_to :action => "login"
end
end
и вот мой взгляд / логин:
<div class="login">
<%= form_tag :action => "attempt_login" do %>
<%= label_tag :email, "Email Address:" %>
<%= text_field_tag :email %>
<%= label_tag :Transaction_Id, "Transaction Id:" %>
<%= text_field_tag :Transaction_Id %>
<%= submit_tag "Log In"%>
<% end %>
</div>