Well you don't exactly have to do it by *hand*. It's pretty easy to write a
script to generate the command for you. Just change table_name to whatever
your model is...
table_name = "Post"
output = [ "rails g scaffold #{table_name} --skip-migration" ]
ignore_columns = [ 'id', 'created_at', 'updated_at' ]
table_name.constantize.columns.each do |c|
output << "#{c.name}:#{c.type}" unless ignore_columns.include?(c.name)
end
puts output.join(" ")
returns: rails g scaffold Post --skip-migration title:string body:text
published_at:datetime
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/q3wXc3R5y8kJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.