i’m writing my own generator basically a custom scaffolding type
thing to make my life easier when creating new resources.
instead of doing something like script/generate custom_scaffold
MyResource name:string description:string … i decided to store all
the metadata about the tables and fields in the db.
my generator creates the model stub files when given a name that
corresponds to a table that already exists and which has metadata in
the database. i would like to check in my generator code if metadata
exists for the table in the DB before going ahead and creating all the
views, model, controller, etc…
i’m not sure if this is kosher rails coding to have a generator that
depends on the existence of specifc models/tables to work… but this
is just for me and i will make sure they are there whenever i use it…
another question… i have a “m.route_resources file_name.pluralize”
line in my generator manifest… is there anyway i can easily check if
the route already exists? if i run my generator multiple times (which
is gonna happen a lot since its still in the works) it keeps adding
duplicate routes in my routes.rb.
Thanks!! happy coding everyone