I've encountered information that implies most experienced Rails developers don't use scaffolding. Do most experienced Rails developers even use the generators for Models, Controllers, and Migrations?
For example, as a seasoned Rails developer would I do:
rails g model Post name title content
or
rails g migration Create_Posts
and then modify it with:
def change
create_table :posts do |t|
t.string :name
t.string :title
t.text :content
t.timestamps
end
and also manually create post.rb
Is using generators a best practice within Rails?
I never use the generators. I find that I just end up deleting half the stuff they create until I ultimately need to add those files/methods. In a decent text editor, it takes no time at all to create a new controller, a new model, a new template, a new spec etc.
One exception, however, is the migration generator. It's easier to use the generator in this case, since the migration has to be versioned correctly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With