Hello, I would like to publish a story whenever a user joins a group in my application. As far as I understood, I have to publish a user_action ( http://facebooker.rubyforge.org/classes/Facebooker/Rails/Publisher.html) However, I get an error (Mysql::Error: Table ''app_development.facebook_templates'' doesn''t exist: SHOW FIELDS FROM `facebook_templates`): here is my template and user_action handler: ------------------------------------------------------------------------- def publish_joingroup_action_template one_line_story_template "{*actor*} joined group {*groupname*}" end def publish_joingroup_action(f) send_as :user_action from f story_size ONE_LINE data :groupname => "A Group Name" end in the controller I have the following: ------------------------------------------------------------- FacebookPublisher.register_publish_joingroup_action FacebookPublisher.deliver_publish_joingroup_action(facebook_session.user) If I''m not wrong, that''s the way to register a template and use it... -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/facebooker-talk/attachments/20090312/c54ba8be/attachment.html>
Le 12 mars 09 ? 09:57, Petar Kalpakliev a ?crit :> However, I get an error (Mysql::Error: Table > ''app_development.facebook_templates'' doesn''t exist: SHOW FIELDS FROM > `facebook_templates`):You don''t have the table to save the templates. I presume that you made your Publisher by hand. Comming with Facebooker, ther is a generator for Publishers. It create an appropriate publisher in app/models and a migration in db/migrate wich handle the table creation. Just run $ script/generate facebook_publisher FacebookPublisherName and then $ rake db:migrate If you want, the migration file is : class CreateFacebookTemplates < ActiveRecord::Migration def self.up create_table :facebook_templates, :force => true do |t| t.string :template_name, :null => false t.string :content_hash, :null => false t.string :bundle_id, :null => true end add_index :facebook_templates, :template_name, :unique => true end def self.down remove_index :facebook_templates, :template_name drop_table :facebook_templates end end HTH, -- St?phane Akkaoui http://www.sociabliz.com http://imeuble.info
I''m can''t remember where, but somewhere there is a migration you need to run which generates that table. On Mar 12, 2009, at 1:57 AM, Petar Kalpakliev wrote:> Hello, > > I would like to publish a story whenever a user joins a group in my > application. > As far as I understood, I have to publish a user_action (http://facebooker.rubyforge.org/classes/Facebooker/Rails/Publisher.html > ) > > However, I get an error (Mysql::Error: Table > ''app_development.facebook_templates'' doesn''t exist: SHOW FIELDS FROM > `facebook_templates`): > > here is my template and user_action handler: > ------------------------------------------------------------------------- > def publish_joingroup_action_template > one_line_story_template "{*actor*} joined group {*groupname*}" > end > > def publish_joingroup_action(f) > send_as :user_action > from f > story_size ONE_LINE > data :groupname => "A Group Name" > end > > > in the controller I have the following: > ------------------------------------------------------------- > FacebookPublisher.register_publish_joingroup_action > FacebookPublisher > .deliver_publish_joingroup_action(facebook_session.user) > > > If I''m not wrong, that''s the way to register a template and use it... > > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/facebooker-talk/attachments/20090312/69bcd42b/attachment.html>
Thanks for the replies, guys. Yes, you are right, I had to run: $ script/generate facebook_publisher FacebookPublisherName So now I can publish user_action, but for some reason it is always published on behalf of the user, who is currently logged. def publish_joingroup_action(f, group) send_as :user_action from f story_size ONE_LINE data :groupname => group.name end I expect the user_action to be published on behalf of user f. However, it appears on the wall of the currently logged user with his/her name as *actor* How can I write another *actor* of the user_action to display a story ? Thanks a lot On Thu, Mar 12, 2009 at 11:06 AM, St?phane Akkaoui < stephane.akkaoui at imeuble.info> wrote:> > Le 12 mars 09 ? 09:57, Petar Kalpakliev a ?crit : > >> However, I get an error (Mysql::Error: Table >> ''app_development.facebook_templates'' doesn''t exist: SHOW FIELDS FROM >> `facebook_templates`): >> > > You don''t have the table to save the templates. > I presume that you made your Publisher by hand. > > Comming with Facebooker, ther is a generator for Publishers. It create an > appropriate publisher in app/models and a migration in db/migrate wich > handle the table creation. > > Just run > > $ script/generate facebook_publisher FacebookPublisherName > > and then > > $ rake db:migrate > > If you want, the migration file is : > > class CreateFacebookTemplates < ActiveRecord::Migration > def self.up > create_table :facebook_templates, :force => true do > |t| > t.string :template_name, :null => false > t.string :content_hash, :null => false > t.string :bundle_id, :null => true > end > > add_index :facebook_templates, :template_name, > :unique => true > end > > def self.down > remove_index :facebook_templates, :template_name > drop_table :facebook_templates > end > end > > HTH, > > -- > St?phane Akkaoui > http://www.sociabliz.com > http://imeuble.info-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/facebooker-talk/attachments/20090312/fa843a09/attachment.html>
The from user needs to be a Facebooker::User with a session for that user. You can''t use my session to publish a user action for somebody else. Mike On Mar 12, 2009, at 12:59 PM, Petar Kalpakliev wrote:> Thanks for the replies, guys. > > Yes, you are right, I had to run: > $ script/generate facebook_publisher FacebookPublisherName > > So now I can publish user_action, but for some reason it is always > published on behalf of the user, who is currently logged. > > def publish_joingroup_action(f, group) > send_as :user_action > from f > story_size ONE_LINE > data :groupname => group.name > end > > I expect the user_action to be published on behalf of user f. > However, it appears on the wall of the currently logged user with > his/her name as *actor* > > How can I write another *actor* of the user_action to display a > story ? > > Thanks a lot > > > > > > On Thu, Mar 12, 2009 at 11:06 AM, St?phane Akkaoui <stephane.akkaoui at imeuble.info > > wrote: > > Le 12 mars 09 ? 09:57, Petar Kalpakliev a ?crit : > > However, I get an error (Mysql::Error: Table > ''app_development.facebook_templates'' doesn''t exist: SHOW FIELDS FROM > `facebook_templates`): > > You don''t have the table to save the templates. > I presume that you made your Publisher by hand. > > Comming with Facebooker, ther is a generator for Publishers. It > create an appropriate publisher in app/models and a migration in db/ > migrate wich handle the table creation. > > Just run > > $ script/generate facebook_publisher FacebookPublisherName > > and then > > $ rake db:migrate > > If you want, the migration file is : > > class CreateFacebookTemplates < ActiveRecord::Migration > def self.up > create_table :facebook_templates, :force => > true do |t| > t.string :template_name, :null => false > t.string :content_hash, :null => false > t.string :bundle_id, :null => true > end > > > add_index :facebook_templates, :template_name, :unique => true > end > > def self.down > > remove_index :facebook_templates, :template_name > drop_table :facebook_templates > end > end > > HTH, > > -- > St?phane Akkaoui > http://www.sociabliz.com > http://imeuble.info > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk-- Mike Mangino http://www.elevatedrails.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/facebooker-talk/attachments/20090312/85dcf46f/attachment.html>
Hm I see, So is it possible to somehow achieve the following: 1. A user wants to join a group in my application 2. The admin of the group accepts the request (I keep the request in my local database) 3. After accepting the request, a story/action is published that the user has joined the group (however, currently the holder of the session is the group admin, who accepts the request) I guess this is possible to do only after the user logs in again... Petar On Thu, Mar 12, 2009 at 6:46 PM, Mike Mangino <mmangino at elevatedrails.com>wrote:> The from user needs to be a Facebooker::User with a session for that user. > You can''t use my session to publish a user action for somebody else. > > Mike > > > > On Mar 12, 2009, at 12:59 PM, Petar Kalpakliev wrote: > > Thanks for the replies, guys. > > Yes, you are right, I had to run: > $ script/generate facebook_publisher FacebookPublisherName > > So now I can publish user_action, but for some reason it is always > published on behalf of the user, who is currently logged. > > def publish_joingroup_action(f, group) > send_as :user_action > from f > story_size ONE_LINE > data :groupname => group.name > end > > I expect the user_action to be published on behalf of user f. However, it > appears on the wall of the currently logged user with his/her name as > *actor* > > How can I write another *actor* of the user_action to display a story ? > > Thanks a lot > > > > > > On Thu, Mar 12, 2009 at 11:06 AM, St?phane Akkaoui < > stephane.akkaoui at imeuble.info> wrote: > >> >> Le 12 mars 09 ? 09:57, Petar Kalpakliev a ?crit : >> >>> However, I get an error (Mysql::Error: Table >>> ''app_development.facebook_templates'' doesn''t exist: SHOW FIELDS FROM >>> `facebook_templates`): >>> >> >> You don''t have the table to save the templates. >> I presume that you made your Publisher by hand. >> >> Comming with Facebooker, ther is a generator for Publishers. It create an >> appropriate publisher in app/models and a migration in db/migrate wich >> handle the table creation. >> >> Just run >> >> $ script/generate facebook_publisher FacebookPublisherName >> >> and then >> >> $ rake db:migrate >> >> If you want, the migration file is : >> >> class CreateFacebookTemplates < ActiveRecord::Migration >> def self.up >> create_table :facebook_templates, :force => true do >> |t| >> t.string :template_name, :null => false >> t.string :content_hash, :null => false >> t.string :bundle_id, :null => true >> end >> >> add_index :facebook_templates, :template_name, >> :unique => true >> end >> >> def self.down >> remove_index :facebook_templates, :template_name >> drop_table :facebook_templates >> end >> end >> >> HTH, >> >> -- >> St?phane Akkaoui >> http://www.sociabliz.com >> http://imeuble.info > > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk > > > -- > Mike Mangino > http://www.elevatedrails.com > > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/facebooker-talk/attachments/20090313/597279f1/attachment-0001.html>
Facebook says that user actions should only be published when a user takes an action, that''s why they require the session. You could publish that a user has requested to join a group, and you could post that an admin has approved the joining. Mike On Mar 13, 2009, at 5:01 AM, Petar Kalpakliev wrote:> Hm I see, > > So is it possible to somehow achieve the following: > 1. A user wants to join a group in my application > 2. The admin of the group accepts the request (I keep the request in > my local database) > 3. After accepting the request, a story/action is published that the > user has joined the group (however, currently the holder of the > session is the group admin, who accepts the request) > > I guess this is possible to do only after the user logs in again... > > Petar > > > > On Thu, Mar 12, 2009 at 6:46 PM, Mike Mangino <mmangino at elevatedrails.com > > wrote: > The from user needs to be a Facebooker::User with a session for that > user. You can''t use my session to publish a user action for > somebody else. > > Mike > > > > On Mar 12, 2009, at 12:59 PM, Petar Kalpakliev wrote: > >> Thanks for the replies, guys. >> >> Yes, you are right, I had to run: >> $ script/generate facebook_publisher FacebookPublisherName >> >> So now I can publish user_action, but for some reason it is always >> published on behalf of the user, who is currently logged. >> >> def publish_joingroup_action(f, group) >> send_as :user_action >> from f >> story_size ONE_LINE >> data :groupname => group.name >> end >> >> I expect the user_action to be published on behalf of user f. >> However, it appears on the wall of the currently logged user with >> his/her name as *actor* >> >> How can I write another *actor* of the user_action to display a >> story ? >> >> Thanks a lot >> >> >> >> >> >> On Thu, Mar 12, 2009 at 11:06 AM, St?phane Akkaoui <stephane.akkaoui at imeuble.info >> > wrote: >> >> Le 12 mars 09 ? 09:57, Petar Kalpakliev a ?crit : >> >> However, I get an error (Mysql::Error: Table >> ''app_development.facebook_templates'' doesn''t exist: SHOW FIELDS >> FROM `facebook_templates`): >> >> You don''t have the table to save the templates. >> I presume that you made your Publisher by hand. >> >> Comming with Facebooker, ther is a generator for Publishers. It >> create an appropriate publisher in app/models and a migration in db/ >> migrate wich handle the table creation. >> >> Just run >> >> $ script/generate facebook_publisher FacebookPublisherName >> >> and then >> >> $ rake db:migrate >> >> If you want, the migration file is : >> >> class CreateFacebookTemplates < ActiveRecord::Migration >> def self.up >> create_table :facebook_templates, :force => >> true do |t| >> t.string :template_name, :null => >> false >> t.string :content_hash, :null => false >> t.string :bundle_id, :null => true >> end >> >> >> add_index :facebook_templates, :template_name, :unique => true >> end >> >> def self.down >> >> remove_index :facebook_templates, :template_name >> drop_table :facebook_templates >> end >> end >> >> HTH, >> >> -- >> St?phane Akkaoui >> http://www.sociabliz.com >> http://imeuble.info >> >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk > > -- > Mike Mangino > http://www.elevatedrails.com > > > >-- Mike Mangino http://www.elevatedrails.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/facebooker-talk/attachments/20090313/55a8ed10/attachment.html>