Ruby on Rails Monday, August 12, 2013

Please remember to quote the previous message and insert your reply
inline at appropriate points in the previous message. Remember this
is a mailing list not a forum (though you may be accessing it using a
forum-like interface). Thanks.

On 12 August 2013 16:47, Valentin Kotelnitski <lists@ruby-forum.com> wrote:
> thanks for an advise not to change the code in migration tables.
> i could delete it and add new fields by new migrations scripts
> but these migration scripts have an influence only on a database schema,
> not on a table model in app/models catalogue.

No you must not edit or delete an existing migration.

>
> the only thing i want to do is to add database field as a property to an
> existing model by hands, without generating scaffold

A migration is nothing to do with a scaffold. As I said just generate
a new migration to add the database field. That is exactly what
migrations are for.

rails generate migration AddLgToUsers lg:string

Which will even include the add_column for you, though you will have
to add the default yourself before running the migration. Have a look
at the rails guide on migrations.

I guess that you are a beginner with rails and strongly recommend that
you work right through a good tutorial such as railstutorial.org which
will show you the basics of rails.

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLtevyWiBwY0beP1Uyhm%3Dy2cWEKnKnoE4%3DGjMsb0GZrS4A%40mail.gmail.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment