How do i add a record from the console

I’ve been trying to do it from memory something like this, but it’s not
working it keeps returning rollback and false

a=Admin.create
a=Admin.find(1)
a.email=“[email protected]
a.password=“password”
a.save

If you are using Devise or anything like it, you may need to also have
password_confirmation = “password” in order to get past that
requirement.

Walter

On 6 December 2015 at 22:04, fugee ohu [email protected] wrote:

I’ve been trying to do it from memory something like this, but it’s not
working it keeps returning rollback and false

a=Admin.create
a=Admin.find(1)
a.email=“[email protected]
a.password=“password”
a.save

It is getting rather tedious repeatedly pointing you to where in
railstutorial.org you can find the solution to the questions you ask.
In this case the answer is in section 6.1.3 Creating user objects.

I can only suggest once again that you take a couple of days out and
work right through that tutorial, including doing all the exercises.
Then you would not need to waste your time asking such questions.

Colin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs