cleaning a little bit

This commit is contained in:
did 2011-08-18 11:02:55 +02:00
parent e1c2687681
commit e9c1c1d98f
2 changed files with 4 additions and 11 deletions

View File

@ -27,12 +27,15 @@ BOARD:
x nav
(- link_to (new)
- others ?) -
- theme_assets
- other problems to solve:
x If you create a new page it shall always be created in the default_language, not depending on the used language in the backend.
- set the page slug for all the site locales
- default site locale even if the i18n feature is disabled (the disable procedure is missing btw)
- redirect for the default site locale if urls like /<default_site_locale>/....
- inline editing
- with_scope is broken
- refactor
BACKLOG:

View File

@ -99,12 +99,6 @@ module Mongoid
protected
def localized_field?(name)
# puts "options[:type] = #{options[:type].inspect} / #{(options[:type] == LocalizedField).inspect}"
# return true if options[:type] == LocalizedField
# puts "self.localized_fields_list = #{self.localized_fields_list.inspect} / #{meth.inspect}"
(self.localized_fields_list || []).any? do |rule|
case rule
when String, Symbol then name.to_s == rule.to_s
@ -121,7 +115,7 @@ module Mongoid
def create_accessors(name, meth, options = {})
if options[:type] == LocalizedField
if options[:use_default_if_empty] != false # nil or true
if options[:use_default_if_empty] != false # neither nil nor true
define_method(meth) do
value = read_attribute(name)
if value.is_a?(Hash)
@ -141,14 +135,10 @@ module Mongoid
end
end
define_method("#{meth}=") do |value|
# debugger
# puts "@attributes[name].present? = #{@attributes[name].present?.inspect} / !@attributes[name].is_a?(Hash) #{(!@attributes[name].is_a?(Hash)).inspect}"
if !@attributes[name].nil? && !@attributes[name].is_a?(Hash)
@attributes[name] = { ::I18n.default_site_locale.to_s => @attributes[name] }
end
# puts "value = #{value.inspect} / #{meth}"
value = if value.is_a?(Hash)
(@attributes[name] || {}).merge(value)
else