Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SystemStackError] recursive madness when calling render #18

Closed
ximus opened this issue May 4, 2010 · 1 comment
Closed

[SystemStackError] recursive madness when calling render #18

ximus opened this issue May 4, 2010 · 1 comment

Comments

@ximus
Copy link
Contributor

ximus commented May 4, 2010

In 1.3.0 prerelease I get this when I try to render anything:

SystemStackError (stack level too deep):
/Users/johnwest/.bundle/ruby/1.8/bundler/gems/restfulx-4c800dcb763416a71965ab45e5fadba4eb9ef01d-master/rails/./lib/restfulx/action_controller.rb:18:in render_without_fxml' /Users/johnwest/.bundle/ruby/1.8/bundler/gems/restfulx-4c800dcb763416a71965ab45e5fadba4eb9ef01d-master/lib/restfulx/action_controller.rb:31:inrender_without_amf'
(...)

render code is
format.fxml { render :fxml @projects }

The problem is in the render overrides in /lib/restfulx/action_controller.rb, they call themselves, I'm suprised I'm the first to encounter this.

Changing the only two functions to this 1.2.4ish way of doing it solved it:

def render_with_amf(options=nil, extra_options={}, &block)
  if Hash === options and options.key?(:amf)
    object = options.delete(:amf)
    unless String === object
      object = object.to_amf(options, &block) if object.respond_to?(:to_amf)
    end
    response.content_type ||= RestfulX::Types::APPLICATION_AMF
    render_for_text(object)
  else
    render_without_amf(options, extra_options, &block)
  end
end

def render_with_fxml(options=nil, extra_options={}, &block)
  if Hash === options and options.key?(:fxml)
    object = options.delete(:fxml)
    unless String === object
      object = object.to_fxml(options, &block) if object.respond_to?(:to_fxml)
    end
    response.content_type ||= RestfulX::Types::APPLICATION_FXML
    render_for_text(object)
  else
    render_without_fxml(options, extra_options, &block)
  end
end

The sweet spot is:
response.content_type ||= RestfulX::Types::APPLICATION_AMF
render_for_text(object)

@ximus
Copy link
Contributor Author

ximus commented May 4, 2010

This is a duplicate, discard it.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant