nifty-generators
nifty-generators copied to clipboard
Default haml in views
I created a new app and then ran:
rails g nifty:layout --haml
I expected that it should work with haml since then, but everytime I use the nifty:scaffold I've to specify --haml at the end... is there any way to make it default?
AFAIS there are two "issues" with your request:
- nifty:layout and nifty:scaffold are largely independent of each other (with a loose dependency via a helper method that scaffold uses, and that can be generated by layout)
- rails does not provide a standard way for generators to store preferences in a project
If this will be addressed at all, I ask to make the implementation general, and also remember the options for the test framework.
- Oh, okay I didn't know that they were so independent from each other =P.
- I didn't know either that generators could store some preferences. I guess I could try to find another way to include the --haml part :P
Thanks for your answer =)
Rails 3 has a way to specify defaults like this, it would be great if nifty generators could listen for these defaults, I haven't built this into the gem yet though.
cool. In such a case it is nice to be proven wrong. Can you give a pointer on how to store defaults with/for a generator (rails doc, or some starting point in the rails sources ...)?
See the Configuring Generators docs for where to set default behavior.
Ah thanks Ryan. Never noticed that part.