Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Can't create AR models with custom updated_xx timestamp.

#1612

When creating ActiveRecord objects with custom date/time for updated_at or updated_on attributes, custom value is ignored and use current time instead. Example:


custom_time = 1.hour.ago.beginning_of_day
forum = Forum.create(:title => "The Colombian Forum", :updated_at => custom_time)

Currently it is possible to create ActiveRecord objects with custom created_at or created_on attributes.

Reported by Luis Hurtado · December 22nd, 2008 @ 12:12 AM

State: resolved
Milestone: 2.x
Assigned to: Pratik Pratik
Importance: none

Activity

  1. Pratik
    Pratik
    • Assigned user set to Pratik
    • State changed from new to incomplete

    Looks good to me. I think it should be possible to make use of existing tables though, instead of creating new tables.

    Thanks.

    December 22nd, 2008 @ 03:47 AM

  2. Luis Hurtado
    Luis Hurtado

    Agree. New diff uses already existent "parrots" table and also groups 4 tests in 1.

    December 22nd, 2008 @ 02:52 PM

  3. Pratik
    Pratik
    • State changed from incomplete to open

    December 22nd, 2008 @ 02:54 PM

  4. Pratik
    Pratik
    • State changed from open to resolved

    December 22nd, 2008 @ 03:57 PM

  5. James B. Byrne
    James B. Byrne

    Q: Is it really intended that the created_at value can be overridden and set to any arbitrary date and time? Does that not negate the entire purpose of the feature in AR? I would think that rather than allowing updated_at to be similarly abused the real fix is to check to see if the current row is new and not whether the attribute created_at is already set.

    January 27th, 2009 @ 12:24 AM