Firstly, somehow you are starting a new thread (as I view it in gmail
at least) for every reply.  I don't use ruby-forum so I don't know
what you are doing wrong but something is not right.  Have you
considered signing up to the mailing list, then life will be much
simpler.

On 12 August 2013 17:38, Valentin Kotelnitski <li...@ruby-forum.com> wrote:
> Thank you, Colin!
>
> Colin Law wrote in post #1118501:
>> 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.
>
> OK
>
>> No you must not edit or delete an existing migration.
>
> OK
>
>>> 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.
>
> I know.
> But the model should contain database fields definitions.

Why?  Models do not normally need to contain field definitions, rails
picks them up automatically by interrogating the database.

>
>> 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 think I should try with an add_column expression.
> Starting to search available online documentation.
>
>> 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
>
> Yes, I'm a beginner with rails and trying to understand how it works.
> Although I do not much trust generated code and prefer hand-written, it
> is possible it will work fine in special circumstances.

It is best to use the generator to create a migration rb file so that
the timestamp will be included in the file name.  You can use the
generator to create an empty migration then fill it in by hand if you
prefer.

You definitely need to work right through a good tutorial.

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+unsubscr...@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%3D0gLsSXWNo3PvO9krXUGjMcsvQMT%3DEFHA4i%2B-n-g6qdnQZkQ%40mail.gmail.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to