[katello-devel] update to lazy_accessor
Ivan Nečas
inecas at redhat.com
Wed Jan 4 15:13:03 UTC 2012
On 01/04/2012 03:35 PM, Tom McKay wrote:
> With the assistance of Justin and Partha, I changed several methods in LazyAccessor:
>
> prepopulate now calls self.lazy_attributes instead of self.class.lazy_attributes
> lazy_attributes now calls superclass.lazy_attributes, if it exists
>
> The result is that classes like MarketingProduct, which extends Product, properly get their lazy_accessors defined correctly.
>
Cool. I was just about to merge it with changes around vsphere support.
I've noticed, that there is also need to include IndexedModel into
inherited class and make this change (also commint with my recent
changes soon...):
--- a/src/app/models/indexed_model.rb
+++ b/src/app/models/indexed_model.rb
@@ -6,7 +6,7 @@ module IndexedModel
if !Rails.env.test?
include Tire::Model::Search
include Tire::Model::Callbacks
- index_name AppConfig.elastic_index + '_' + self.name.downcase
+ index_name AppConfig.elastic_index + '_' +
self.base_class.name.downcase
else
#stub mapping
def self.mapping
-- Ivan
> def lazy_attributes
> attrs = (self.class.superclass.respond_to? :lazy_attributes) ? self.class.superclass.lazy_attributes : []
> attrs += (self.class.lazy_attributes || [])
> attrs.uniq
> end
>
> _______________________________________________
> katello-devel mailing list
> katello-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/katello-devel
--
Regards,
Ivan Necas
Red Hat Czech s.r.o. Brno
More information about the katello-devel
mailing list