Commit 8ac44129a3ca6d0cbdb48ae7f274ed4af56b1881

Authored by Antonio Terceiro
1 parent 6ae35704

ActionItem830: no useless calls on initialization

app/models/article.rb
... ... @@ -7,7 +7,7 @@ class Article < ActiveRecord::Base
7 7 validates_presence_of :profile_id, :name
8 8 validates_presence_of :slug, :path, :if => lambda { |article| !article.name.blank? }
9 9  
10   - validates_uniqueness_of :slug, :scope => ['profile_id', 'parent_id'], :message => _('%{fn} (the code generated from the article name) is already being used by another article.'), :if => lambda { |article| !article.slug.blank? }
  10 + validates_uniqueness_of :slug, :scope => ['profile_id', 'parent_id'], :message => N_('%{fn} (the code generated from the article name) is already being used by another article.'), :if => lambda { |article| !article.slug.blank? }
11 11  
12 12 belongs_to :last_changed_by, :class_name => 'Person', :foreign_key => 'last_changed_by_id'
13 13  
... ...
app/models/domain.rb
... ... @@ -10,7 +10,7 @@ class Domain < ActiveRecord::Base
10 10  
11 11 # <tt>name</tt> must be a sequence of word characters (a to z, plus 0 to 9,
12 12 # plus '_'). Letters must be lowercase
13   - validates_format_of :name, :with => /^([a-z0-9_]+\.)+[a-z0-9_]+$/, :message => _('%{fn} must be composed only of lowercase latters (a to z), numbers (0 to 9) and "_"')
  13 + validates_format_of :name, :with => /^([a-z0-9_]+\.)+[a-z0-9_]+$/, :message => N_('%{fn} must be composed only of lowercase latters (a to z), numbers (0 to 9) and "_"')
14 14  
15 15 # checks validations that could not be expressed using Rails' predefined
16 16 # validations. In particular:
... ...
app/models/environment.rb
... ... @@ -381,7 +381,7 @@ class Environment &lt; ActiveRecord::Base
381 381 validates_presence_of :name
382 382  
383 383 # only one environment can be the default one
384   - validates_uniqueness_of :is_default, :if => (lambda do |environment| environment.is_default? end), :message => _('Only one Virtual Community can be the default one')
  384 + validates_uniqueness_of :is_default, :if => (lambda do |environment| environment.is_default? end), :message => N_('Only one Virtual Community can be the default one')
385 385  
386 386 validates_format_of :contact_email, :with => Noosfero::Constants::EMAIL_FORMAT, :if => (lambda { |record| ! record.contact_email.blank? })
387 387  
... ...
app/models/uploaded_file.rb
... ... @@ -19,7 +19,7 @@ class UploadedFile &lt; Article
19 19 UploadedFile.attachment_options[:max_size]
20 20 end
21 21  
22   - validates_attachment :size => _("The file you uploaded was larger than the maximum size of %s") % UploadedFile.max_size.to_humanreadable
  22 + validates_attachment :size => N_("The file you uploaded was larger than the maximum size of %s") % UploadedFile.max_size.to_humanreadable
23 23  
24 24 def icon_name
25 25 self.image? ? public_filename(:icon) : self.content_type.gsub('/', '-')
... ...