calonso / rails-push-notifications

Rails iOS, Android and Windows Phone Push Notifications made easy!!
https://rubygems.org/gems/rails-push-notifications
MIT License
138 stars 44 forks source link

Rails 4 support #2

Closed scyros closed 9 years ago

scyros commented 9 years ago

Do you think to provide rails 4 support for this gem?

Recently i tried to include your gem in a project and i got the following trace error when i run

rails g ror_push_notifications:migrations
/Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.7/lib/active_record/dynamic_matchers.rb:26:in `method_missing': undefined method `attr_accessible' for #<Class:0x007fbf2a1461a8> (NoMethodError)
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0/bundler/gems/ror-push-notifications-4aea09c92ffd/lib/ror_push_notifications/app/models/rpn/apns_config.rb:9:in `<class:ApnsConfig>'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0/bundler/gems/ror-push-notifications-4aea09c92ffd/lib/ror_push_notifications/app/models/rpn/apns_config.rb:1:in `<top (required)>'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `block in require'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:232:in `load_dependency'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0/bundler/gems/ror-push-notifications-4aea09c92ffd/lib/ror_push_notifications.rb:2:in `<top (required)>'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.7.13/lib/bundler/runtime.rb:76:in `require'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.7.13/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.7.13/lib/bundler/runtime.rb:72:in `each'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.7.13/lib/bundler/runtime.rb:72:in `block in require'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.7.13/lib/bundler/runtime.rb:61:in `each'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.7.13/lib/bundler/runtime.rb:61:in `require'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.7.13/lib/bundler.rb:134:in `require'
    from /Users/carlosleon/sources/solid-finger/config/application.rb:7:in `<top (required)>'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/spring-1.3.2/lib/spring/application.rb:82:in `require'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/spring-1.3.2/lib/spring/application.rb:82:in `preload'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/spring-1.3.2/lib/spring/application.rb:143:in `serve'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/spring-1.3.2/lib/spring/application.rb:131:in `block in run'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/spring-1.3.2/lib/spring/application.rb:125:in `loop'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/spring-1.3.2/lib/spring/application.rb:125:in `run'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/spring-1.3.2/lib/spring/application/boot.rb:18:in `<top (required)>'
    from /Users/carlosleon/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/carlosleon/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from -e:1:in `<main>'
calonso commented 9 years ago

Mmmm, you're right. I'll do it. Just give me a couple of days please.

calonso commented 9 years ago

I opened https://github.com/calonso/rails-push-notifications/tree/rails4 branch to add rails 4 support. Can you please switch to this branch and let me know if works as expected?

scyros commented 9 years ago

@calonso

I tried the new branch and no migrations were created.

iMac-de-Admin01:solid-finger carlosleon$ rails generate ror_push_notifications:migrations
WARNING: Could not find "create_rpn_configs.rb" in any of your source paths. Your current source paths are: 
/Users/carlosleon/.rvm/gems/ruby-2.2.0/bundler/gems/ror-push-notifications-7c475f6e5569/lib/generators/ror_push_notifications/templates/migrations
WARNING: Could not find "create_rpn_devices.rb" in any of your source paths. Your current source paths are: 
/Users/carlosleon/.rvm/gems/ruby-2.2.0/bundler/gems/ror-push-notifications-7c475f6e5569/lib/generators/ror_push_notifications/templates/migrations
WARNING: Could not find "create_rpn_notifications.rb" in any of your source paths. Your current source paths are: 
/Users/carlosleon/.rvm/gems/ruby-2.2.0/bundler/gems/ror-push-notifications-7c475f6e5569/lib/generators/ror_push_notifications/templates/migrations
calonso commented 9 years ago

Ok, I fixed that one as well. Could you please try again?

scyros commented 9 years ago

Now i have:

iMac-de-Admin01:solid-finger carlosleon$ rails generate ror_push_notifications:migrations
      create  db/migrate/20150220133825_create_rpn_configs.rb
      create  db/migrate/20150220133825_create_rpn_devices.rb
      create  db/migrate/20150220133825_create_rpn_notifications.rb
iMac-de-Admin01:solid-finger carlosleon$ rake db:migrate
rake aborted!
ActiveRecord::DuplicateMigrationVersionError: 

Multiple migrations have the version number 20150220133825

/Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.7/lib/active_record/migration.rb:1013:in `validate'
/Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.7/lib/active_record/migration.rb:916:in `initialize'
/Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.7/lib/active_record/migration.rb:807:in `new'
/Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.7/lib/active_record/migration.rb:807:in `up'
/Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.7/lib/active_record/migration.rb:785:in `migrate'
/Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.7/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
calonso commented 9 years ago

Ok, can you delete the generated files at db/migrate and rerun again? Should be fixed now.

scyros commented 9 years ago

The same results:

iMac-de-Admin01:solid-finger carlosleon$ rails generate ror_push_notifications:migrations
      create  db/migrate/20150220140233_create_rpn_configs.rb
      create  db/migrate/20150220140233_create_rpn_devices.rb
      create  db/migrate/20150220140233_create_rpn_notifications.rb
iMac-de-Admin01:solid-finger carlosleon$ rake db:migrate
rake aborted!
ActiveRecord::DuplicateMigrationVersionError: 

Multiple migrations have the version number 20150220140233

/Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.7/lib/active_record/migration.rb:1013:in `validate'
/Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.7/lib/active_record/migration.rb:916:in `initialize'
/Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.7/lib/active_record/migration.rb:807:in `new'
/Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.7/lib/active_record/migration.rb:807:in `up'
/Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.7/lib/active_record/migration.rb:785:in `migrate'
/Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.7/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
iMac-de-Admin01:solid-finger carlosleon$ rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
rake aborted!
ActiveRecord::DuplicateMigrationVersionError: 

Multiple migrations have the version number 20150220140233

/Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.7/lib/active_record/migration.rb:1013:in `validate'
/Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.7/lib/active_record/migration.rb:916:in `initialize'
/Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.7/lib/active_record/migration.rb:807:in `new'
/Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.7/lib/active_record/migration.rb:807:in `up'
/Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.7/lib/active_record/migration.rb:785:in `migrate'
/Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.7/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
/Users/carlosleon/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:240:in `call'
/Users/carlosleon/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:240:in `block in execute'
/Users/carlosleon/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:235:in `each'
/Users/carlosleon/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:235:in `execute'
/Users/carlosleon/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:179:in `block in invoke_with_call_chain'
/Users/carlosleon/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/Users/carlosleon/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:172:in `invoke_with_call_chain'
/Users/carlosleon/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:165:in `invoke'
/Users/carlosleon/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:150:in `invoke_task'
/Users/carlosleon/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:106:in `block (2 levels) in top_level'
/Users/carlosleon/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:106:in `each'
/Users/carlosleon/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:106:in `block in top_level'
/Users/carlosleon/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:115:in `run_with_threads'
/Users/carlosleon/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:100:in `top_level'
/Users/carlosleon/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:78:in `block in run'
/Users/carlosleon/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:176:in `standard_exception_handling'
/Users/carlosleon/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:75:in `run'
/Users/carlosleon/.rvm/rubies/ruby-2.2.0/bin/rake:33:in `<main>'
Tasks: TOP => db:migrate
calonso commented 9 years ago

Sounds weird...Did you updated the branch? bundle update rails-push-notifications

scyros commented 9 years ago

Works!

Thank you!