Open picharras opened 12 years ago
Try app = APN::App.new app.apn_dev_cert = 'yourcert' app.save
Yep that works. Here's my full call:
app = APN::App.new app.apn_dev_cert = 'apple_push_notification_development.pem' app.save device = APN::Device.create device.token = 'my token' device.app_id = 'my app id' notification = APN::Notification.new notification.device = device notification.badge = 5 notification.sound = true notification.alert = "foobar" notification.custom_properties = {:link => "http://www.prx.org"} notification.save
worked great!
Yes above work great thanks.
But "bundle exec rake apn:notifications:deliver --trace" give me the below error..
* Invoke apn:notifications:deliver (first_time)
* Invoke environment (first_time)
* Execute environment
* Execute apn:notifications:deliver
rake aborted!
Unknown primary key for table apn_devices in model APN::Device.
/home/saravanan/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.8/lib/active_record/reflection.rb:366:in primary_key' /home/saravanan/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.8/lib/active_record/reflection.rb:216:in
association_primary_key'
/home/saravanan/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.8/lib/active_record/associations/association_scope.rb:58:in block in add_constraints' /home/saravanan/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.8/lib/active_record/associations/association_scope.rb:39:in
each'
/home/saravanan/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.8/lib/active_record/associations/association_scope.rb:39:in each_with_index' /home/saravanan/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.8/lib/active_record/associations/association_scope.rb:39:in
add_constraints'
/home/saravanan/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.8/lib/active_record/associations/association_scope.rb:31:in `scope'
Please advice!
Also while try "APN::App.first.send_notifications" Thats give below error..
Loading development environment (Rails 3.2.8)
1.9.3p194 :001 > APN::App.first.send_notifications
APN::App Load (0.2ms) SELECT apn_apps
.* FROM apn_apps
LIMIT 1
APN::Device Load (0.6ms) SELECT apn_devices
.* FROM apn_devices
WHERE (app_id = 1) AND (apn_devices
.>= 0) ORDER BY
apn_devices.
ASC LIMIT 1000
Mysql2::Error: Unknown column 'apn_devices.' in 'where clause': SELECT apn_devices
.* FROM apn_devices
WHERE (app_id = 1) AND (apn_devices
.>= 0) ORDER BY
apn_devices.
ASC LIMIT 1000
ActiveRecord::StatementInvalid: Mysql2::Error: Unknown column 'apn_devices.' in 'where clause': SELECT apn_devices
.* FROM apn_devices
WHERE (app_id = 1) AND (apn_devices
.>= 0) ORDER BY
apn_devices.
ASC LIMIT 1000
from /home/saravanan/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in query' from /home/saravanan/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in
block in execute'
Hi, I'm working with Ruby 1.9.2, Rails 3.2.3 and apn_on_rails 0.5.1 to implement push notifications in my application.
When I run:
app = APN::App.create(:apn_dev_cert => "MY_DEV_CERT.pem", :apn_prod_cert => "MY_PROD_CERT.pem")
I get the following error:
ActiveModel :: MassAssignmentSecurity :: Error: Can not mass-assign protected attributes: apn_dev_cert, apn_prod_cert
Does anyone know what does it mean? Thank you.