Displaying 9 results from an estimated 9 matches for "response_body".
2012 Mar 29
2
Rails 3.2 and Streaming using response_body
I am working on a streaming download (CSV) from Rails 3.2 and am coming up
against an issue of the initial page request taking a long time. The
following controller code illustrates my issue:
self.response_body = Enumerator.new do |y|
10_000_000.times do
y << "Hello World"
end
end
With the above, the response does seem like its streaming (from a server
than can support it... Unicorn, in my case). That said, before it starts
streaming it hangs for a much...
2012 Sep 18
4
multiple modules defining same method included into a class
...le named Rendering in the ActionController namespace, since
that is the namesapce that Base is defined in???
Well, ActionController module does define a module named Rendering:
module ActionController
module Rendering
def render(*args)
raise ::AbstractController::DoubleRenderError if response_body
super
self.content_type ||= Mime[lookup_context.rendered_format].to_s
response_body
end
So now the method render(*args) is included in the Base class as an
instance method. So when we call, for example, (hypothetically)
ActionView::Base.new.render :action => "my_acti...
2009 Sep 13
0
regrex_crawler -- a crawler which uses regular expression to catch data from website
...''body''],
:save_method => Proc.new do |result, page|
puts ''=============================''
puts page·
puts result[:title]
puts result[:description]
puts result[:body][0..100] + "..."
end,·
:need_parse => Proc.new do |page, response_body|
page =~ %r{http://github.com/flyerhzm/\w+} && !response_body.index
(/Fork of.*?<a href=".*?">/)
end)·
crawler.start
The results are as follows:
=============================
http://github.com/flyerhzm/bullet/tree/master
bullet
A rails plugin/gem to kill N+1 queries...
2011 May 17
1
rails render_to_string problem
...te
@user.update_attributes!(params[:user])
redirect_to @user, :status => 202, :text =>
render_to_string(:partial => "users/show", :type => "json", :locals =>
{:user => @user})
#notice, that redirect_to was reinitialized and :text is a
parameter for response_body
end
_show.tokamak
user {
id user.id
email user.email
username user.username
}
spec file
it "should NOT update user username" do
username = @user.username
put ''update'', :id => @user.id, :user => {:username => username
+"abc"}, :format...
2010 Sep 27
3
streaming response body to client?
So I''d like to stream my response body to the client.
At least under Rails2, it looks like you can pass a Proc to render
:text, to do that.
I am in a Rails2 app right now, but will upgrade to Rails3 sometime in
the next couple months, so don''t want to set myself up for failure.
Anyone know the status of streaming responses in Rails3? Is it
possible? Is there a different API
2007 Jan 03
0
0.7.5 Doesn''t Let My Tests Run
...ctiverecord/
lib/../../activesupport/lib/active_support/dependencies.rb:349:in
`const_missing'': uninitialized constant
Spec::RailsPlugin::ResponseBody::TagExpectations (NameError)
from /Users/minime/rails/voodoo_work/vendor/plugins/vendor/
plugins/rspec/lib/spec/rails_plugin/response_body.rb:4
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:27:in `gem_original_require''
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:27:in `require''
from /Users/minime/rails/voodoo_work/config/../vendor/rails/
active...
2011 Sep 15
0
streaming with rails 3.1 and ruby 1.8.7
Hey!
I''m working with an app where migrating to ruby 1.9.2 is currently not an
option, so I can not use Rails 3.1 streaming.
One of the features is sending large XML and CSV files. In Rails 3.0 I used
the self.response_body {} hack which worked pretty OK.
This stopped working in Rails 3.1.
How can I do streaming with Rails 3.1 and ruby 1.8.7?
-m.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://group...
2013 Feb 01
0
Add a customer renderer but I get missing template
...msgpack-ruby> in
Rails 3.2 but when I try to return a mpac response, I get an error
concerning a missing template.
My renderer:
Mime::Type.register ''application/x-mpac'', :mpac
ActionController::Renderers.add :mpac do |mpac, options|
self.content_type ||= Mime::MPAC
self.response_body = mpac.respond_to?(:to_msgpack) ? mpac.to_msgpack : mpac
end
My controller:
class UsersController < ApplicationController
respond_to :mpac, :json
def show
respond_with({ hello: ''world'' })
end
end
And my serializer:
require ''msgpack''
module Act...
2013 Oct 09
0
getting selenium working with jruby/sinatra/cucumber/webrat on windows
...config.mode = :selenium
config.application_port = 4567
config.application_framework = :sinatra
end
class WebratMixinExample
include Rack::Test::Methods
include Webrat::Methods
include Webrat::Matchers
Webrat::Methods.delegate_to_session :response_code, :response_body
def app
# Sinatra::Application
Main
end
end
World{WebratMixinExample.new}
====================================
> When I run cucumber I get
>unrecognized argument &:
Usage: java -jar selenium-server.jar [-interactive] [options]
-port <...