ixtlan-core 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,7 +29,7 @@
29
29
  <%% if allowed?(:<%= table_name %>, :destroy) %>
30
30
  <% end -%>
31
31
  <td><% if options[:optimistic] && options[:timestamps] -%>
32
- <%%= link_to 'Destroy', <%= singular_table_name %>_path(<%= singular_table_name %>) + "?<%= singular_table_name %>[updated_at]=#{<%= singular_table_name %>.updated_at.utc.strftime('%Y-%m-%d %H:%M:%S.%N')}", :confirm => 'Are you sure?', :method => :delete %><% else -%><%%= link_to 'Destroy', <%= singular_table_name %>, :confirm => 'Are you sure?', :method => :delete %>
32
+ <%%= link_to 'Destroy', <%= singular_table_name %>_path(<%= singular_table_name %>) + "?<%= singular_table_name %>[updated_at]=#{<%= singular_table_name %>.updated_at.utc.strftime('%Y-%m-%d %H:%M:%S') + ("%06d" % <%= singular_table_name %>.updated_at.utc)}", :confirm => 'Are you sure?', :method => :delete %><% else -%><%%= link_to 'Destroy', <%= singular_table_name %>, :confirm => 'Are you sure?', :method => :delete %>
33
33
  <% end -%></td>
34
34
  <% if defined? ::Ixtlan::Guard -%>
35
35
  <%% end %>
@@ -7,7 +7,8 @@ module Ixtlan
7
7
  def self.optimistic_find(updated_at, *args)
8
8
  updated_at_date = new(:updated_at => updated_at).updated_at
9
9
  # try different ways to use the date
10
- first(:conditions => ["id = ? and updated_at = ?", args[0], updated_at_date]) || first(:conditions => ["id = ? and updated_at = ?", args[0], updated_at])
10
+ # TODO maybe there is a nicer way ??
11
+ first(:conditions => ["id = ? and updated_at <= ? and updated_at >= ?", args[0], updated_at, updated_at_date - 0.001]) || first(:conditions => ["id = ? and updated_at <= ? and updated_at >= ?", args[0], updated_at_date, updated_at_date - 0.001])
11
12
  # TODO make it work with different PKs
12
13
  end
13
14
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ixtlan-core
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.4.0
5
+ version: 0.4.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - mkristian
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-07-23 00:00:00 +05:30
13
+ date: 2011-07-24 00:00:00 +05:30
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency