Added backward compatibility.
This commit is contained in:
parent
afa3a34fbf
commit
9a3266b3e4
2 changed files with 6 additions and 8 deletions
|
@ -10,15 +10,15 @@ class RecentView < ApplicationModel
|
||||||
|
|
||||||
# create entry
|
# create entry
|
||||||
record = {
|
record = {
|
||||||
:o_id => o_id,
|
:o_id => o_id,
|
||||||
:object_lookup_id => object_lookup_id.to_i,
|
:recent_view_object_id => object_lookup_id.to_i,
|
||||||
:created_by_id => user.id,
|
:created_by_id => user.id,
|
||||||
}
|
}
|
||||||
RecentView.create(record)
|
RecentView.create(record)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.log_destroy( requested_object, requested_object_id )
|
def self.log_destroy( requested_object, requested_object_id )
|
||||||
RecentView.where( :object_lookup_id => ObjectLookup.by_name( requested_object ) ).
|
RecentView.where( :recent_view_object_id => ObjectLookup.by_name( requested_object ) ).
|
||||||
where( :o_id => requested_object_id ).
|
where( :o_id => requested_object_id ).
|
||||||
destroy_all
|
destroy_all
|
||||||
end
|
end
|
||||||
|
@ -35,8 +35,8 @@ class RecentView < ApplicationModel
|
||||||
list = []
|
list = []
|
||||||
recent_views.each { |item|
|
recent_views.each { |item|
|
||||||
data = item.attributes
|
data = item.attributes
|
||||||
data['object'] = ObjectLookup.by_id( data['object_lookup_id'] )
|
data['object'] = ObjectLookup.by_id( data['recent_view_object_id'] )
|
||||||
data.delete( 'object_lookup_id' )
|
data.delete( 'recent_view_object_id' )
|
||||||
list.push data
|
list.push data
|
||||||
}
|
}
|
||||||
list
|
list
|
||||||
|
|
|
@ -15,9 +15,7 @@ class UpdateRecentViewedCreateObjectLookup < ActiveRecord::Migration
|
||||||
entry.cache_delete
|
entry.cache_delete
|
||||||
}
|
}
|
||||||
|
|
||||||
rename_column :recent_views, :recent_view_object_id, :object_lookup_id
|
|
||||||
drop_table :recent_view_objects
|
drop_table :recent_view_objects
|
||||||
|
|
||||||
Cache.clear
|
Cache.clear
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue