diff --git a/lib/gcm_on_rails/app/models/gcm/device.rb b/lib/gcm_on_rails/app/models/gcm/device.rb index 165aeaa..ea604af 100644 --- a/lib/gcm_on_rails/app/models/gcm/device.rb +++ b/lib/gcm_on_rails/app/models/gcm/device.rb @@ -11,8 +11,6 @@ class Gcm::Device < Gcm::Base self.table_name = "gcm_devices" - attr_accessible :registration_id - has_many :notifications, :class_name => 'Gcm::Notification', :dependent => :destroy validates_presence_of :registration_id validates_uniqueness_of :registration_id diff --git a/lib/generators/gcm_migrations_generator.rb b/lib/generators/gcm_migrations_generator.rb index a8d95a3..2424e23 100644 --- a/lib/generators/gcm_migrations_generator.rb +++ b/lib/generators/gcm_migrations_generator.rb @@ -3,30 +3,34 @@ # This should be run upon install and upgrade of the # Gcm on Rails gem. # -# $ ruby script/generate gcm_migrations +# $ ruby script/generate gcm_migrations class GcmMigrationsGenerator < Rails::Generators::Base - include Rails::Generators::Migration - extend ActiveRecord::Generators::Migration + include Rails::Generators::Migration - # Set the current directory as base for the inherited generators. - def self.base_root - File.dirname(__FILE__) - end + # Set the current directory as base for the inherited generators. + def self.base_root + File.dirname(__FILE__) + end - source_root File.expand_path('../templates/gcm_migrations', __FILE__) + source_root File.expand_path('../templates/gcm_migrations', __FILE__) - def create_migrations - templates = { - 'create_gcm_devices.rb' => 'db/migrate/create_gcm_devices.rb', - 'create_gcm_notifications.rb' => 'db/migrate/create_gcm_notifications.rb' - } + def create_migrations + templates = { + 'create_gcm_devices.rb' => 'db/migrate/create_gcm_devices.rb', + 'create_gcm_notifications.rb' => 'db/migrate/create_gcm_notifications.rb' + } + + templates.each_pair do |name, path| + begin + migration_template(name, path) + rescue => err + puts "WARNING: #{err.message}" + end + end + end + + def self.next_migration_number dirname + ActiveRecord::Generators::Base.next_migration_number dirname + end - templates.each_pair do |name, path| - begin - migration_template(name, path) - rescue => err - puts "WARNING: #{err.message}" - end - end - end end # GcmMigrationsGenerator \ No newline at end of file