It only works by accident with older Haml versions and with ERB. form_for's
return value is not meant to be used, and doing so will likely introduce
errors.

If you want to capture it as a string, you can run it in a capture {...}
block.

On Tue, Jun 8, 2010 at 2:49 AM, szimek <[email protected]> wrote:

> The problem is that it somehow magically worked with Haml 2.x and
> (probably) with ERB as well in Rails 2.3.x :)
>
> I guess I should somehow use capture to get string from form_for and
> then concatenate with the other stuff, but I couldn't figure out how
> to do it.
>
> If anyone got any tips how to fix it, it would be great. Meanwhile
> I'll keep trying to fix it myself when I got some free time.
>
> On Jun 8, 9:38 am, Nathan Weizenbaum <[email protected]> wrote:
> > That error message is, in fact, correct. If this plugin is trying to
> > concatenate something onto the result of a form_for, it's either written
> for
> > Rails 3 or buggy and wrong.
> >
> >
> >
> > On Tue, Jun 8, 2010 at 12:10 AM, szimek <[email protected]> wrote:
> > > I'm using Rails 2.3.5 with nzkoz/rails_xss plugin, but I've just
> > > tested it with Rails 2.3.8 with rails/rails_xss and it's the same.
> >
> > > The error is caused by this line in the layout:
> > > = facebook_sign_in_link :user
> >
> > > Here's the application trace:
> > > undefined method `<<' for #<Haml::Helpers::ErrorReturn:
> > > 0x000001081a3c20>
> >
> > > /Users/szimek/.rvm/gems/ruby-1.9.1-p378/gems/
> > > devise_facebook_connectable-0.2.1/lib/devise_facebook_connectable/
> > > view_helpers.rb:73:in `block in facebook_sign_in_link'
> > > /Users/szimek/.rvm/gems/ruby-1.9.1-p378/gems/actionpack-2.3.8/lib/
> > > action_view/helpers/capture_helper.rb:39:in `call'
> > > /Users/szimek/.rvm/gems/ruby-1.9.1-p378/gems/actionpack-2.3.8/lib/
> > > action_view/helpers/capture_helper.rb:39:in `block in capture'
> > > /Users/szimek/.rvm/gems/ruby-1.9.1-p378/gems/actionpack-2.3.8/lib/
> > > action_view/helpers/capture_helper.rb:129:in `with_output_buffer'
> > > /Users/szimek/.rvm/gems/ruby-1.9.1-p378/gems/haml-3.0.10/lib/haml/
> > > helpers/xss_mods.rb:109:in `with_output_buffer_with_haml_xss'
> > > /Users/szimek/Projects/WebApps/secret/vendor/plugins/rails_xss/lib/
> > > rails_xss/action_view.rb:10:in `with_output_buffer'
> > > /Users/szimek/.rvm/gems/ruby-1.9.1-p378/gems/actionpack-2.3.8/lib/
> > > action_view/helpers/capture_helper.rb:39:in `capture'
> > > /Users/szimek/.rvm/gems/ruby-1.9.1-p378/gems/haml-3.0.10/lib/haml/
> > > helpers/action_view_mods.rb:92:in `capture_with_haml'
> > > /Users/szimek/.rvm/gems/ruby-1.9.1-p378/gems/actionpack-2.3.8/lib/
> > > action_view/helpers/tag_helper.rb:71:in `content_tag'
> > > /Users/szimek/.rvm/gems/ruby-1.9.1-p378/gems/haml-3.0.10/lib/haml/
> > > helpers/action_view_mods.rb:110:in `content_tag_with_haml'
> > > /Users/szimek/.rvm/gems/ruby-1.9.1-p378/gems/
> > > devise_facebook_connectable-0.2.1/lib/devise_facebook_connectable/
> > > view_helpers.rb:67:in `facebook_sign_in_link'
> > > /Users/szimek/Projects/WebApps/secret/app/views/shared/
> > > _header_buttons.html.haml:11:in
> >
> > >
> `_run_haml_app47views47shared47_header_buttons46html46haml_locals_header_bu
> ttons_object'
> > > /Users/szimek/Projects/WebApps/secret/app/views/shared/
> > > _actions.html.haml:2:in
> > >
> `_run_haml_app47views47shared47_actions46html46haml_locals_actions_object'
> > > /Users/szimek/Projects/WebApps/secret/app/views/layouts/
> > > application.html.haml:49:in
> > > `_run_haml_app47views47layouts47application46html46haml'
> > > /Users/szimek/Projects/WebApps/secret/app/controllers/
> > > questions_controller.rb:16:in `index'
> >
> > > I was trying to fix it with various concat/capture combinations, but
> > > the only thing that I managed to get was this:
> > > "form_for outputs directly to the Haml template. Disregard its return
> > > value and use the - operator, or use capture_haml to get the value as
> > > a String."
> >
> > > On Jun 8, 1:20 am, Nathan Weizenbaum <[email protected]> wrote:
> > > > What version of Rails are you using? Can you give me a full backtrace
> of
> > > the
> > > > error?
> >
> > > > On Mon, Jun 7, 2010 at 1:49 PM, szimek <[email protected]> wrote:
> > > > > Hey,
> >
> > > > > after updating Haml from 2.x to 3 a helper from
> > > > > devise_facebook_connectable gem (http://github.com/grimen/
> > > > > devise_facebook_connectable) stopped working - it complains about
> > > > > missing << method. Here's the code:
> >
> > > > > def facebook_sign_in_link(*args)
> > > > >  ...
> > > > >  content_tag(:div, :class => 'facebook_connect_link sign_in') do
> > > > >    facebook_connect_form(scope, options.slice(:method)) <<
> > > > >    if options[:button]
> > > > >      fb_login_button('devise.facebook_connectable.sign_in();',
> > > > > options)
> > > > >    else
> > > > >      fb_logout_link(options[:label],
> > > > > 'devise.facebook_connectable.sign_in_with_callback();')
> > > > >    end
> > > > >  end
> > > > > end
> >
> > > > > def facebook_connect_form(scope, options = {})
> > > > >  ...
> > > > >  form_for(scope, :url => url, :html => options) { |f| }
> > > > > end
> >
> > > > > Any tips how to fix this, so it works in both ERB and Haml (it
> would
> > > > > be great if it worked in 2.x and 3.x)?
> >
> > > > > Cheers,
> > > > > Szymon
> >
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > > Groups
> > > > > "Haml" group.
> > > > > To post to this group, send email to [email protected].
> > > > > To unsubscribe from this group, send email to
> > > > > [email protected]<haml%[email protected]>
> <haml%[email protected]<haml%[email protected]>
> ><
> > > haml%[email protected]<haml%[email protected]>
> <haml%[email protected]<haml%[email protected]>
> >
> > > >.
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/haml?hl=en.
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Haml" group.
> > > To post to this group, send email to [email protected].
> > > To unsubscribe from this group, send email to
> > > [email protected]<haml%[email protected]><
> haml%[email protected]<haml%[email protected]>
> >.
> > > For more options, visit this group at
> > >http://groups.google.com/group/haml?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Haml" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected] <haml%[email protected]>.
> For more options, visit this group at
> http://groups.google.com/group/haml?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/haml?hl=en.

Reply via email to