dima / restfulx Goto Github PK
View Code? Open in Web Editor NEWRestfulX Framework Code Generation Engine / Rails 2.1+ Integration Support
Home Page: http://restfulx.github.com
RestfulX Framework Code Generation Engine / Rails 2.1+ Integration Support
Home Page: http://restfulx.github.com
This doesn't work as expected, investigate
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?
@model.errors.to_amf should produce a result that can be parsed and understood on the client side.
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.
It would be useful if RxAutoComplete had a flag to indicate if it should search the typed word in cache before trying to hit the server or always ask the server, without to consider the cached objects.
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:in
render_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)
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
The following works:
@projects.to_amf(:include => [:sprints])
However, the following is broken:
@project.to_amf(:include => {:sprints => {:include => [:tasks]}})
Needs to be investigated.
Should be possible to compare-contrast various serialization options available with RestfulX
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
Running Rails 2.3.5
gems loaded via Bundler
OSX
ruby 1.8.7 (system)
(copy paste from my comment on the google group)
In order to speed up Rails response times AMF Serializer should ideally be performance tuned and better still implemented in C.
This seems to be broken
Some of the generators will need to be rewritten for Rails 3
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)
Needs to be tested/investigated.
We should be able to at least send ids over the client and attempt to merge with whatever is currently in the cache for that model.
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:in
render_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)
This can be post-processed on the client-side or embedded on the server-side
Should have a better testing suite and performance tests for:
fXML, JSON, pure AMF, native AMF
The testing suite is currently extremely minimal and partially broken (on restfulx gem side). This needs to be fixed and generally improved.
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.
Generated can be updated to produce code for Flex 4 and Flex 3.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.