Script to create a User - error on undefined method `reset_password='

Hi all,
I’m try to create new users via rb scripts, using gitlab-rails runner.

From Documentation I found “Either password or reset_password should be specified (reset_password takes priority).”

My code is:
# create new user
newuser = User.new({ “email”=>email, “username”=>username, “name”=>name, “admin”=>false})
newuser.can_create_group = false
newuser.reset_password = true
newuser.projects_limit = 5
newuser.save!

But I got the following error:
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/activemodel-4.2.8/lib/active_model/attribute_methods.rb:433:in method_missing': undefined method reset_password=’ for #User:0x007f4e5c3bbc88 (NoMethodError)
Did you mean? reset_password
from /opt/admin/rails_create_user.rb:54:in <top (required)>' from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/commands/runner.rb:60:in load’
from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/commands/runner.rb:60:in <top (required)>' from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:123:in require’
from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:123:in require_command!' from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:90:in runner’
from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:39:in run_command!' from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/commands.rb:17:in <top (required)>’
from bin/rails:9:in require' from bin/rails:9:in

Any idea?

Thank you,
Alberto

Did you solve that issue? I’m interested :slight_smile:

Not solved. No more used the script…

Sorry

For posterity: I believe I have solved this issue.