Skip to content

Instantly share code, notes, and snippets.

@kdiogenes
Created August 2, 2019 01:23
Show Gist options
  • Save kdiogenes/c019d7c6c4ee2e4cc00f2f0af3e39b7d to your computer and use it in GitHub Desktop.
Save kdiogenes/c019d7c6c4ee2e4cc00f2f0af3e39b7d to your computer and use it in GitHub Desktop.
rails: programmable generators on rails
[2] (pry) main: 0> g = Rails::Generators::ScaffoldControllerGenerator.new
ArgumentError: wrong number of arguments (given 0, expected 1+)
from /home/kadu/.asdf/installs/ruby/2.5.3/lib/ruby/gems/2.5.0/gems/railties-4.2.11.1/lib/rails/generators/model_helpers.rb:14:in `initialize'
[3] (pry) main: 0> g = Rails::Generators::ScaffoldControllerGenerator.new('user')
NoMethodError: undefined method `shift' for "user":String
from /home/kadu/.asdf/installs/ruby/2.5.3/lib/ruby/gems/2.5.0/gems/thor-0.19.4/lib/thor/parser/arguments.rb:73:in `shift'
[4] (pry) main: 0> g = Rails::Generators::ScaffoldControllerGenerator.new(['user'])
=> #<Rails::Generators::ScaffoldControllerGenerator:0x000055b1970a8680
@_initializer=[["user"], {}, {}],
@_invocations={},
@after_bundle_callbacks=[],
@args=[],
@attributes=[],
@behavior=:invoke,
@class_path=[],
@controller_class_path=[],
@controller_file_name="users",
@controller_name="users",
@destination_stack=["/home/kadu/programming/alfacon/alfaconrails-develop"],
@file_name="user",
@in_group=nil,
@inside_template=nil,
@name="user",
@options={"skip_namespace"=>false, "force_plural"=>false, "helper"=>true, "orm"=>false, "template_engine"=>:erb, "test_framework"=>false},
@shell=
#<Thor::Shell::Color:0x000055b19700b060 @always_force=false, @base=#<Rails::Generators::ScaffoldControllerGenerator:0x000055b1970a8680 ...>, @mute=false, @padding=0>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment