Re: Apn on Rails gem

Amit Kumar
2010-07-11T16:01:55Z

Hi,

Try this, i did it same way


>> device = APN::Device.create(:token => "XXXXXXXX XXXXXXXX
XXXXXXXX
XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX")
 >> notification = APN::Notification.new
>> device.id= ''xxxxxxx''
 >> notification.device = device
 >> notification.badge = 5
 >> notification.sound = true
 >> notification.alert = "foobar"
 >> notification.save
   *
I tried the same way in my console.. See APN: Notifications table and the
device id will be in APN: Device table.
*



On 11 July 2010 17:43, Greg Ma
<lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:

> Hi,
> I''m really not sure someone will be able to help me, but I have a
> problem with apn_on_rails.
> When I follow the exemple on the github page I have an error:
>
> >> device = APN::Device.create(:token => "XXXXXXXX XXXXXXXX
XXXXXXXX
> XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX")
>  >> notification = APN::Notification.new
>  >> notification.device = device
>  >> notification.badge = 5
>  >> notification.sound = true
>  >> notification.alert = "foobar"
>  >> notification.save
>
>
> My error:
> activeRecord::StatementInvalid: Mysql::Error: Column
''device_id'' cannot
> be null: INSERT INTO `apn_notifications` (`custom_properties`,
> `created_at`, `device_language`, `updated_at`, `device_id`, `sent_at`,
> `badge`, `errors_nb`, `sound`, `alert`) VALUES(NULL, ''2010-07-11
> 11:22:36'', NULL, ''2010-07-11 11:22:36'', NULL,
NULL, 5, 0, 1, ''foobar'')
>
> My question is where to I set the device_id ?
> I can''t do: device.device_id = XXXXXXXX
>
> Greg
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
>
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.