Hey ok so im getting this error. no idea why, could you guys help?
Controller action -
def confirm
@title = "Confirm"
if request.post?
confirmation = params[:confirmation]
account = Account.find_by_username_and_confirmation_code(params[:confirmation].username, params[:confirmation].code)
if !account.nil?
account = Account.update_attribute("confirmation_code", "")
if account.save
flash[:success] = "Congratulations you have now confirmed your email!"
redirect_to :action => "index"
end
else
flash[:error] = "Incorrect confirmation code or username."
end
end
end
view -
<% form_for :confirmation do |form| %>
<label for="username">Username:</label>
<%= form.text_field h(:username), :size => 20 %>
<label for="code">Confirmation Code:</label>
<%= form.text_field h(:code), :size => 30 %>
<%= submit_tag "Confirm", :class =>'submit' %>
<% end %>
heres the full error:
NoMethodError in AccountController#confirm
undefined method `username' for {"code"=>"", "username"=>""}:HashWithIndifferentAccess
RAILS_ROOT: /Users/Zack/Desktop/General/Rails/verges
Application Trace | Framework Trace | Full Trace
/Users/Zack/Desktop/General/Rails/verges/app/controllers/account_controller.rb:82:in `confirm'
Request
Parameters:
{"confirmation"=>{"code"=>"",
"username"=>""},
"commit"=>"Confirm",
"authenticity_token"=>"L9+134xxYjYu0qc198BGRQnZ3wBXV2Ktg74pVSotWtk="}
Show session dump
Response
Headers:
{"Content-Type"=>"",
"Cache-Control"=>"no-cache"}
Many thanks,
jakx12