Coder Social home page Coder Social logo

restfulx's People

Contributors

dima avatar elvisfernandes avatar malkomalko avatar rlmattax avatar ronphillips avatar ximus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

restfulx's Issues

rake db:schema:to_yaml with Rails 2.3 - nil object

On a Rails 2.3 project
rake db:schema:to_yaml
breaks with
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.gsub

I fixed it by replacing

schema_to_yaml.rb line number 98

last_in_array_fix = last_in_array_fix.gsub(', ','')

with

last_in_array_fix = last_in_array_fix.gsub(', ','') unless last_in_array_fix.nil?

AMF error serialization

@model.errors.to_amf should produce a result that can be parsed and understood on the client side.

Issues link pointing to restfulx_framework project

The link to the "issues" page is pointing to the restfulx_project issues page.

I would change it and send a pull request, but I wondered if it was intentional to centralize all issues into one project.

[SystemStackError] recursive madness when calling render

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 }
format.amf { render :amf @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)

[NamedScopes] NoMethodError (undefined method `to_amf' for #<Class:0x...>)

It's late for me and I can't test this further.

On the Rails (server) side, AMF seems to work great now except I get:

NoMethodError (undefined method `to_amf' for #Class:0x...)

or

NoMethodError (undefined method `to_fxml' for #Class:0x...)

when I try to render results from a named scope.
I have jumped in with the debugger and:

@results.class ouputs ActiveRecord::NamedScope::Scope

not sure why the error says its an instance of Class and not ActiveRecord::NamedScope::Scope but thats probably a limitation of my knowledge of ruby.

Seems the AMF and FXML foo isn't getting to ActiveRecord::NamedScope::Scope

uninitialized constant RestfulX::ActiveRecord::Serialization

Had a problem loading 1.3.0:

`load_missing_constant': uninitialized constant RestfulX::ActiveRecord::Serialization (NameError)
(...)
from /Users/johnwest/.bundle/ruby/1.8/bundler/gems/restfulx-4c800dcb763416a71965ab45e5fadba4eb9ef01d-master/rails/../lib/restfulx/active_record.rb:6
(...)

The following change did the trick:

lib/restfulx/active_record.rb:6

  • - - class AMFSerializer < ActiveRecord::Serialization::Serializer
    +++class AMFSerializer < ::ActiveRecord::Serialization::Serializer

Running Rails 2.3.5
gems loaded via Bundler
OSX
ruby 1.8.7 (system)

(copy paste from my comment on the google group)

C-based AMF serializer for Rails

In order to speed up Rails response times AMF Serializer should ideally be performance tuned and better still implemented in C.

rails g rx_config error

Bundler could not find compatible versions for gem "activesupport": (Bundler::VersionConflict)
In Gemfile:
restfulx depends on
activesupport (~> 2.3.5)

rails (= 3.0.3) depends on
  activesupport (3.0.3)

[SystemStackError] recursive madness when calling render

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)

Fix tests

The testing suite is currently extremely minimal and partially broken (on restfulx gem side). This needs to be fixed and generally improved.

Enhance GAE backend with partial requests.

Google App Engine is very sensitive to retrievals that take a long time or use too much CPU. In my existing application I'm getting log messages like this: /payments.xml 200 1624ms 3670cpu_ms 2368api_cpu_ms 193kb with a tooltip message that says "This request used a high amount of CPU and may soon exceed its quota."

My request-for-enhancement, then, is a way to request partial amounts of data.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.