I'm using Rails 5. I have this controller ...
class MyObjectsController < ApplicationController
def create
my_object = MyService.build(create_params)
I would like to call the create method in the rails console but I get this error ...
irb(main):007:0> MyObjectsController.new.create(:id => "abc")
Traceback (most recent call last):
2: from (irb):7
1: from app/controllers/my_objects_controller.rb:4:in `create'
ArgumentError (wrong number of arguments (given 1, expected 0))
How do I pass parameters to my controller method?
new({id: "abc"})
can be just thisnew(id: "abc")
. Is always better typing less. – Vocalist