# Rails generator bug?

**URL:** <https://www.ruby-forum.com/t/rails-generator-bug/159338>\
**Category:** Rails\
**Created:** [February 3, 2009, 5:47pm UTC](https://www.ruby-forum.com/t/rails-generator-bug/159338 "2009-02-03T17:47:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kfl62](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f05b48/32.png) [@kfl62](https://www.ruby-forum.com/u/kfl62)\
**Post date:** [February 3, 2009, 5:47pm UTC](https://www.ruby-forum.com/t/rails-generator-bug/159338/1 "2009-02-03T17:47:21Z")

</div>

As I mentioned in [Passing args to generator - Rails - Ruby-Forum](http://www.ruby-forum.com/topic/177503) I can’t pass  
arguments to rails generator. After a couple hours I find a dirty hack

def add\_options!(opt)  
…  
opt.on(“–option\_name”,“Some Text”) { |v| options[:option\_name] = arg[0]  
}

but regardless what i do the options hash still 'll contain the logical  
true for defined arguments (def add\_options!(opt)).

Only arg array 'll contain the runtime argument’s value.

Any help is welcome to solve this uggly, dirty … hack

Thanks kfl62

---

<div class="post-metadata">

**Author:** ![kfl62](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f05b48/32.png) [@kfl62](https://www.ruby-forum.com/u/kfl62)\
**Post date:** [February 6, 2009, 4:39am UTC](https://www.ruby-forum.com/t/rails-generator-bug/159338/2 "2009-02-06T04:39:52Z")

</div>

Shame on me  
I used --option\_name and of course was returned a logical true

> opt.on("–option\_name",“Some Text”) { |v| options[:option\_name] = arg[0]}

If I use --option\_name=name returns args value 🙂  
opt.on("–option\_name=name",“Some Text”) { |v| options[:option\_name] =  
v}

---

<div class="post-metadata">

**Author:** ![kfl62](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f05b48/32.png) [@kfl62](https://www.ruby-forum.com/u/kfl62)\
**Post date:** [February 3, 2009, 6:21pm UTC](https://www.ruby-forum.com/t/rails-generator-bug/159338/3 "2009-02-03T18:21:00Z")

</div>

Ferenc-Lorant Kiss wrote:

> As I mentioned in [Passing args to generator - Rails - Ruby-Forum](http://www.ruby-forum.com/topic/177503) I can’t pass  
> arguments to rails generator. After a couple hours I find a dirty hack
> 
> def add\_options!(opt)  
> …  
> opt.on(“–option\_name”,“Some Text”) { |v| options[:option\_name] = arg[0]  
> }
> 
> but regardless what i do the options hash still 'll contain the logical  
> true for defined arguments (def add\_options!(opt)).
> 
> Only arg array 'll contain the runtime argument’s value.
> 
> Any help is welcome to solve this uggly, dirty … hack
> 
> Thanks kfl62

the source, maybe helps …

> **[trst\_sys/lib/generators/task\_partial at master · kfl62/trst\_sys](https://github.com/kfl62/trst_sys/tree/master/lib/generators/task_partial)**
>
> master/lib/generators/task\_partial
