I made a mistake when making my first app. I did not use the:
ruby script/generate model
method for creating my models. I more or less hand crafted each og
them. Is there a way to go back so I get my db migration scripts to
populate?
I made a mistake when making my first app. I did not use the:
ruby script/generate model
method for creating my models. I more or less hand crafted each og
them. Is there a way to go back so I get my db migration scripts to
populate?
“Joe C.” [email protected] wrote in
message news:[email protected]…
I made a mistake when making my first app. I did not use the:
ruby script/generate modelmethod for creating my models. I more or less hand crafted each og
them. Is there a way to go back so I get my db migration scripts to
populate?–
Posted via http://www.ruby-forum.com/.
just run script/generate model . I’m pretty sure the
generator
won’t over-write existing files, so you’ll get test and migration files
generated. Before you do, make a backup/commit your work - just in case
if that doesn’t work, I’d just copy your model files outside of the
models
directory, run script/generate model and then copy the model files back
hth
just run script/generate model . I’m pretty sure the
generator
won’t over-write existing files, so you’ll get test and migration files
generated. Before you do, make a backup/commit your work - just in case
if that doesn’t work, I’d just copy your model files outside of the
models
directory, run script/generate model and then copy the model files backhth
That’s what I was doing, thanks! Just wanted to make sure there wasn’t
a simple® way via rake or something.
Alan F. wrote:
Joe C. wrote:
what I was doing, thanks! Just wanted to make sure there wasn’t
a simple® way via rake or something.You could also leave the models and use ‘script/generate migration’
There doesn’t need to be a one-to-one from model to migration.A.
thanks!
Here’s a follow-up questionon on models and tables:
Should I keep a one for one correspondence of models to tables? For
example, I have a couple of tables that I chose not to model - should I
set up a very small model for those tables as placeholders?
If you want to access a table through ActiveRecord methods, you need to
have a model. So the answer is almost certainly yes.
Mind you, a model doesn’t have to have anything in it. A “blank” model
like
class Widget < ActiveRecord::Base
end
is sufficient to be able to work with all the fields in your table via
ActiveRecord. It is also necessary.
Joe C. wrote:
Alan F. wrote:
Joe C. wrote:
what I was doing, thanks! Just wanted to make sure there wasn’t
a simple® way via rake or something.You could also leave the models and use ‘script/generate migration’
There doesn’t need to be a one-to-one from model to migration.A.
thanks!
Here’s a follow-up questionon on models and tables:
Should I keep a one for one correspondence of models to tables? For
example, I have a couple of tables that I chose not to model - should I
set up a very small model for those tables as placeholders?
Joe C. wrote:
what I was doing, thanks! Just wanted to make sure there wasn’t
a simple® way via rake or something.
You could also leave the models and use ‘script/generate migration’
There doesn’t need to be a one-to-one from model to migration.
A.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs