Generic-user-small Joe 4 posts

After watching the video, I implemented the publisher and tried following the work flow of editing and updating registering publishers. The stack trace is below my example publisher. When I register a publisher, edit a publisher, reload! the console find the user again and try to reregister the publisher, it seems that the database is erroring out on a transaction somewhere in the publisher.rb file. I have not been able to track this down. I am using mysql and rails 2.1.2. Any ideas? even though it errors out at the console, if I go to facebook tools, and the registered templates console, I see any re-registration there. How come the console or the code is not working properly but it is registering the template properly?

class NotifyPublisher def publish_action_template one_line_story_template “{actor} did stuff with {friend}.” one_line_story_template “{actor} did stuff.” short_story_template “{actor} has a title {friend}.”, render(:partial=>”pilot/short_body”) short_story_template “{actor} has a title.”, render(:partial=>”pilot/short_body”) full_story_template “{actor} has a title {friend}.”, render(:partial=>”pilot/full_body”) end

def publish_action(user)
  send_as :user_action
  from user.facebook_session.user
  data :friend=>"Mike" 
end
end

At the console I do:

u=User.last
=> #<user 1 id:>
>> NotifyPublisher.register_publish_action
=> #<facebooker::rails::publisher::facebooktemplate 1 id:>
>> NotifyPublisher.deliver_publish_action(u)
=> true
>> reload!
Reloading…
=> true
>> u=User.last
=> #<user 1 id:>
>> NotifyPublisher.register_publish_action
ArgumentError: wrong number of arguments (0 for 1) from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/timestamp.rb:33:in `changed?’ from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/timestamp.rb:33:in `update’ from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/base.rb:2483:in `create_or_update_without_callbacks’ from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/callbacks.rb:207:in `create_or_update’ from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/base.rb:2217:in `save_without_validation!’ from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/validations.rb:921:in `save_without_dirty!’ from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/dirty.rb:83:in `save_without_transactions!’ from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/transactions.rb:110:in `save!’ from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in `transaction’ from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/transactions.rb:79:in `transaction’ from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/transactions.rb:98:in `transaction’ from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/transactions.rb:110:in `save!’ from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/transactions.rb:118:in `rollback_active_record_state!’ from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/transactions.rb:110:in `save!’ from /home/joe/projects/fb_app/vendor/plugins/facebooker/lib/facebooker/rails/publisher.rb:116:in `register’ from /home/joe/projects/fb_app/vendor/plugins/facebooker/lib/facebooker/rails/publisher.rb:423:in `method_missing’ from (irb):6
>> NotifyPublisher.deliver_publish_action(u)
=> true

 
Head_small Mike Mangino 176 posts

Does this only happen when you reload!? I wonder if we have a bug that has problems with class reloading. I’ll take a look at that.

Mike

 
Generic-user-small Joe 4 posts

Hello Mike. This error actually happens whether I reload the console or not. Facebook gets the re-registrations, but the database does not. And in the video, when you register a publisher, your console outputs the bundle_id number such as =>35409812422 as a result of the registration, but as seen above, my output is the actual object such as:

NotifyPublisher.register_publish_action
=> #<facebooker::rails::publisher::facebooktemplate 1 id:>

I’m not sure where the problems are originating from otherwise.

 
Head_small Mike Mangino 176 posts

It was a conflict between the changed? method in Rails 2.1 and a method in our model. Can you update your facebooker and try again?

Mike

 
Generic-user-small Joe 4 posts

Worked like a charm! Thanks for taking a look into this.

5 posts, 2 voices