lib/configure_me/base.rb in configure_me-0.6.0 vs lib/configure_me/base.rb in configure_me-0.6.1
- old
+ new
@@ -20,11 +20,10 @@
def to_key
if persisted?
key = parent_config.nil? ? [] : parent_config.to_key
key << self.class.config_name
- key
else
nil
end
end
@@ -34,24 +33,26 @@
else
nil
end
end
- def config_key
- to_param
- end
-
def storage_key(name)
- "#{config_key}-#{name.to_s}"
+ "#{to_param}-#{name.to_s}"
end
class << self
def inherited(subclass)
super
configs << subclass
end
+ def config_key
+ key = parent_config_klass.nil? ? [] : parent_config_klass.config_key
+ key << self.config_name
+ key
+ end
+
def config_name
self.name.demodulize.gsub(/^(.*)Config$/, '\1').underscore
end
#def method_missing(method_sym, *args)
@@ -74,11 +75,10 @@
# super
#end
def find_by_id(id)
configs.each do |config|
- if config.config_key.eql?(id)
- #return config.instance
+ if config.config_name.eql?(id)
return config.new
end
end
nil
end