# Passing args to generator

**URL:** <https://www.ruby-forum.com/t/passing-args-to-generator/159307>\
**Category:** Rails\
**Created:** [February 3, 2009, 11:41am UTC](https://www.ruby-forum.com/t/passing-args-to-generator/159307 "2009-02-03T11:41:18Z")\
**Posts on this page:** 2\
**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, 11:41am UTC](https://www.ruby-forum.com/t/passing-args-to-generator/159307/1 "2009-02-03T11:41:18Z")

</div>

I have some default\_options in generator and when I wish to change they  
value with --option\_name I get only logical true instead of string  
…  
default\_options :option\_name =\> “Some string”  
…  
def add\_options!(opt)  
opt.separator ‘’  
opt.separator ‘Options:’  
opt.on("–option\_name",“Some Text”) { |v| options[:option\_name] = v }  
end  
…

---

<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, 2:22pm UTC](https://www.ruby-forum.com/t/passing-args-to-generator/159307/2 "2009-02-03T14:22:35Z")

</div>

Description:  
Generating list,edit,save and show partials for tasks from TrstSysTask  
table, based on ‘exe\_id’ value.  
Convention:  
base\_path /app/views/trst\_sys (change with --controller\_path)  
partial\_path base\_path/xxx/yyy/zzz/\_\*.html.erb with “./script/generate  
task\_partial xxx\_yyy\_zzz”  
or partial\_path base\_path/xxx/yyy/\_zzz.html.erb with  
“./script/generate task\_partial xxx\_yyy\_zzz --single”  
Example:  
“./script/generate task\_partial db\_sys\_menu” =\>  
/app/views/trst\_sys/db/sys/menu/\_list.html.erb, \_edit.html.rb …  
“./script/generate task\_partial db\_sys\_menu --single” =\>  
/app/views/trst\_sys/db/sys/\_menu.html.erb  
“./script/generate task\_partial db\_sys\_menu --single --controller\_path  
“other\_path”” =\>  
/app/views/other\_path/db/sys/\_menu.html.erb

That’s what I need.  
But as I mentioned above using --controller\_path always returns logical  
true

/app/views/…true…/db/sys/\_menu.html.erb

Arghhh
