Attached is a diff to fix facebook_form_for for Rails 2.1. It was
crashing because of the new form authenticity token. I slipped in a line
in helper.rb that adds in the token. I also stubbed protect_from_forgery?
out in the rails_integration_test.
Hope that helps,
Richard
-------------- next part --------------
Index: test/rails_integration_test.rb
==================================================================---
test/rails_integration_test.rb (revision 224)
+++ test/rails_integration_test.rb (working copy)
@@ -413,7 +413,9 @@
def fields_for(*args)
""
end
-
+ def protect_against_forgery?
+ false
+ end
end
# used for capturing the contents of some of the helper tests
@@ -806,4 +808,4 @@
end
# rescue LoadError
# $stderr.puts "Couldn''t find action controller.
That''s OK. We''ll skip it."
-end
\ No newline at end of file
+end
Index: lib/facebooker/rails/helpers.rb
==================================================================---
lib/facebooker/rails/helpers.rb (revision 224)
+++ lib/facebooker/rails/helpers.rb (working copy)
@@ -179,6 +179,9 @@
concat(tag("fb:editor",editor_options,true) , proc.binding)
concat(tag(:input,{:type=>"hidden",:name=>:_method,
:value=>method},false), proc.binding) unless method.blank?
+ if(method !=''get'' &&
protect_against_forgery?)
+ concat(tag(:input,{:type=>"hidden",:name=>
request_forgery_protection_token.to_s,
:value=>form_authenticity_token},false),proc.binding)
+ end
fields_for( object_name,*(args << options), &proc)
concat("</fb:editor>",proc.binding)
end
@@ -581,4 +584,4 @@
self[newkey] = self.delete(oldkey) if self.has_key?(oldkey)
self
end
-end
\ No newline at end of file
+end