Module ActiveRecord::Acts::Ubervuable::InstanceMethods
In: app/models/acts_as_ubervuable.rb

Methods

Public Instance methods

[Source]

    # File app/models/acts_as_ubervuable.rb, line 33
33:         def after_commit
34:           user_locale = I18n.locale
35:           if self.ubervu_in && self.ubervu_in.length > 0
36:             user_locale = I18n.locale
37:             self.ubervu_in.each do |l|
38:               I18n.locale = l
39:               controller = self.is_a?(News) ? "/documents" : "/#{self.class.to_s.tableize}"
40:               url = ActionController::Integration::Session.new.url_for(:controller => controller, 
41:                   :action => "show", :id => self, :locale => l, :only_path => false, 
42:                   :host => Notifier::SERVICEURL, :protocol => "http")
43: 
44:               ActiveRecord::Base.logger.info "Sending to Ubervu URL: #{url}"
45:               if RAILS_ENV.eql?("production")
46:                 begin
47:                   ubervu = Rubervu::Ubervu.new(Rubervu::Ubervu::API_KEY)
48:                   result = ubervu.resources.create(url)
49:                 rescue => e
50:                   ActiveRecord::Base.logger.info "No se ha podido enviar a Ubervu la noticia #{url}: #{e.inspect}"
51:                 end
52:               end
53:             end
54:           end
55:           I18n.locale = user_locale
56:         end

[Source]

    # File app/models/acts_as_ubervuable.rb, line 22
22:         def set_ubervu_in
23:           @ubervu_in ||= []
24:           if self.published? && self.show_in_irekia # && model.ubervued_at.nil?
25:             self.class::LANGUAGES.each do |l|
26:               if self.send("title_#{l}_changed?") || self.published_at_changed?
27:                 @ubervu_in << l
28:               end
29:             end
30:           end
31:         end

[Validate]