~ubuntu-branches/ubuntu/vivid/ruby-sequel/vivid

« back to all changes in this revision

Viewing changes to lib/sequel/plugins/timestamps.rb

  • Committer: Package Import Robot
  • Author(s): Dmitry Borodaenko, Dmitry Borodaenko, Cédric Boutillier
  • Date: 2013-08-10 18:38:17 UTC
  • mfrom: (1.1.8)
  • Revision ID: package-import@ubuntu.com-20130810183817-iqanz804j32i5myi
Tags: 4.1.1-1
[ Dmitry Borodaenko ]
* New upstream release.
* Standards-Version upgraded to 3.9.4 (no changes).
* Added Build-Depend on ruby-sqlite3.

[ Cédric Boutillier ]
* debian/control: remove obsolete DM-Upload-Allowed flag.
* use canonical URI in Vcs-* fields.
* debian/copyright: use DEP5 copyright-format/1.0 official URL for Format
  field.
* Update debian/watch. Thanks Bart Martens.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
      # * :force - Whether to overwrite an existing create timestamp (default: false)
27
27
      # * :update - The field to hold the update timestamp (default: :updated_at)
28
28
      # * :update_on_create - Whether to set the update timestamp to the create timestamp when creating (default: false)
29
 
      def self.configure(model, opts={})
 
29
      def self.configure(model, opts=OPTS)
30
30
        model.instance_eval do
31
31
          @create_timestamp_field = opts[:create]||:created_at
32
32
          @update_timestamp_field = opts[:update]||:updated_at
47
47
          @create_timestamp_overwrite
48
48
        end
49
49
        
50
 
        # Copy the class instance variables used from the superclass to the subclass
51
 
        def inherited(subclass)
52
 
          super
53
 
          [:@create_timestamp_field, :@update_timestamp_field, :@create_timestamp_overwrite, :@set_update_timestamp_on_create].each do |iv|
54
 
            subclass.instance_variable_set(iv, instance_variable_get(iv))
55
 
          end
56
 
        end
 
50
        Plugins.inherited_instance_variables(self, :@create_timestamp_field=>nil, :@update_timestamp_field=>nil,
 
51
          :@create_timestamp_overwrite=>nil, :@set_update_timestamp_on_create=>nil)
57
52
        
58
53
        # Whether to set the update timestamp to the create timestamp when creating
59
54
        def set_update_timestamp_on_create?