skip to content »

Rails timestamps not updating

(This is typically how you would code a database for a PHP application.) However, things have moved on in the Rails world.The Rails developers came up with a pretty good (not perfect, but pretty good) mechanism for generating databases without the need for SQL: it's called migrations, and is a part of Active Record.

rails timestamps not updating-34rails timestamps not updating-17rails timestamps not updating-1

Active Record is the ORM layer (see the section Connecting Rails to a Database in the previous article) used in Rails.We could even move it into Active Record:: Base if we wanted to, and support per-class configuration with subclass (or instance) constants.What if we want any arbitrary action to be performed without timestamp updating?I ran into an issue where running "annotate -i" removes the not null constraint from timestamps. Hi @greg, I think annotate is reading the development DB.I found this SO article: Seems like maybe the default behavior changed, and if I recreated my development database from migrations, then the file wants to change by having "not null" removed. So what's happened is that maybe the behavior t.timestamps changed, and I rebuilt the DB from the migrations.The name of the database table is, by convention, the pluralized (in the English language), lower-case form of the model's class name.

In the case of our Intranet application, the models are organized as follows: We haven't built any of these yet, but we will shortly.

Say we have a full-text search client that periodically updates the index for every record.

If we had threaded Rails, there is the possibility for a race condition if two record updates are performed at the same time.

I've already cleared cache and all that between changes, so I know that's not the issue. Here's my file (as downloaded from the builder: /** * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben.

In an application we are developing, there are various things and related models that could influence a product's stock.

To get going with our application, we need to generate the tables to store data into, as shown in the previous section.