Яuбy / Говнокод #18832 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
class UserCategory < ActiveRecord::Base
   @@unique_id = 0
   ...
 
   def initialize
     @@unique_id += 1
   end

   def self.get_unique_id
    @@unique_id
  end

   def self.send_gcm_to_all(message)
    @@unique_id += 1
    ...
     User.all.each do |user|
       registration_ids = [user.gcm_id]
       options = { data: {id: self.get_unique_id, category: "all", message: "#{message}"}
       response = gcm.send(registration_ids, options)
   end
 
 end

Запостил: DarkSun DarkSun, (Updated )

Комментарии (0) RSS

Добавить комментарий

Семь раз отмерь — один отрежь, guest!

    А не использовать ли нам bbcode?


    8