- Timestamp:
- 10/09/07 16:31:51 (5 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/yann/lib/globalize/localization/db_translate.rb
r155 r175 673 673 # REDEFINED to include only untranslated fields. We don't want to overwrite the 674 674 # base translation with other translations. 675 def attributes_with_quotes(include_primary_key = true )675 def attributes_with_quotes(include_primary_key = true, include_readonly_attributes = true) 676 676 if Locale.base? 677 attributes.inject({}) do |quoted, (name, value)|677 quoted = attributes.inject({}) do |quoted, (name, value)| 678 678 if column = column_for_attribute(name) 679 679 quoted[name] = quote_value(value, column) unless !include_primary_key && column.primary … … 682 682 end 683 683 else 684 attributes.inject({}) do |quoted, (name, value)|684 quoted = attributes.inject({}) do |quoted, (name, value)| 685 685 if !self.class.globalize_facets_hash.has_key?(name) && 686 686 column = column_for_attribute(name) … … 690 690 end 691 691 end 692 include_readonly_attributes ? quoted : remove_readonly_attributes(quoted) 692 693 end 693 694 … … 766 767 def find_every(options) 767 768 return globalize_old_find_every(options) if options[:untranslated] 768 769 769 770 # do quick version if base language is active 770 771 if Locale.base? && !options.has_key?(:include_translated) … … 777 778 778 779 options[:conditions] = sanitize_sql(options[:conditions]) if options[:conditions] 779 780 780 781 joins_clause = options[:joins].nil? ? "" : options[:joins].dup 781 782 joins_args = [] 782 783 load_full = options[:translate_all] 783 784 facets = load_full ? globalize_facets : preload_facets 784 785 785 786 if options[:select].nil? || options[:select] = '*' 786 787 surrounding_clause = '%s' … … 791 792 surrounding_clause = surrounding_clause.gsub(re_select, '%s') 792 793 else 793 raise StandardError, 794 raise StandardError, 794 795 "this :select option format is not allowed on translatable models " + 795 796 "(#{options[:select]})" 796 797 end 797 798 end 798 799 799 800 # there will at least be an +id+ field here 800 801 select_clause = untranslated_fields.map {|f| "#{table_name}.#{f}" }.join(", ") 801 802 802 803 if Locale.base? 803 804 select_clause << ', ' << facets.map {|f| "#{table_name}.#{f}" }.join(", ")
