0

I have a method to generate a password in models in Users.rb file. In my view i have a form where only email address filed is there and I want to to add the password to the User attribute before saving it. I have a create method where I create a new user and save it in controller. How do I call the generate password method in the controller?

1
  • Note that models should have a singular filename, ie. user.rb. Commented Feb 15, 2012 at 23:30

1 Answer 1

2

Is it a class method? Call it using User.generate_password. Is it an instance method? Call it using @user.generate_password, or whatever the instance variable is named.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.