Search code examples
ruby-on-railsruby-on-rails-4rubygemsruby-on-rails-4.2ruby-on-rails-5.1

How do i record a user information such as email in RubyOnRails?


I am creating a post request for Forgot Password request. So I generated a controller using:

rake generate controller post forgot_password

Now since I want to record a user email on my form so defined them as follows:

def forgot_password
  @password = params[:forgot_password]
  if @password  
    then @record = Email.create({:email => @email})
  end        
end

Is it correct?

I am very new to ruby on rails.

What are your views in doing this task?


Solution

  • an easier way to do this is by using the devise gem. it comes with all of the features you will need for password reset, change, unlocking account and so on... try reading reading its documentation, you will get it. luck!