similar to: Background work

Displaying 20 results from an estimated 2000 matches similar to: "Background work"

2007 Nov 30
5
render_to_string in an after filter
I''m using render_to_string in an after_filter, which renders a partial that is sent to a web service. Here''s the code: class MyController < ApplicationController after_filter :post_to_webservice def show # show logic end def post_to_webservice stuff = render_to_string :partial => ''stuff'' webservice_post(stuff) end I get a DoubleRenderError in the
2006 May 26
8
calling render_to_string outside of controller
How can I call render_to_string outside of a controller. I''m stuck on this. I''ve nearly got my plugin finished but I can''t seem to get this to work. The method is in ActionController::Base but it is protected. -- Posted via http://www.ruby-forum.com/.
2008 Dec 16
3
Princely Plugin: get nil.size error
Hi All, I want to generate pdf with css. I am using princely plugin. This is code which I written def pdf prince = Prince.new() html_string = render_to_string(:template => ''/users/paid_invoice.pdf.erb'') send_data( prince.pdf_from_string(html_string), :filename => ''some_document.pdf'', :type =>
2009 Nov 21
1
samba4 + openldap: provisioning isnt working
Wiki seems to be out of date here. The wiki reference's [1] [2] a "setup/provision-backend" script, as well as a "setup/provision" script, yet current git only has a setup/provision executable. Some #samba and #openldap IRC advice was that provision-backend wasnt needed anymore, but based off the errors i'm seeing, there's definitely _something_ missing, I just
2008 Feb 19
3
render_to_string in a controller test?
Hi all, I know that in general, view and controller tests should be isolated, such that controller specs don''t test views etc. However, I think I''ve run into a situation that might be an exception. My controller uses render_to_string to produce a chunk of HTML that it passes to a model to be processed. The controller then redirects the user to a different page. The
2006 Aug 03
5
DRYing up the view
Hello everyone! I have generic views for CRUD operations For example I render(''shared/list'') from controller shared/list.rhtml ... <% for item in @list %> <tr class="<%= cycle ''list-line-odd'', ''list-line-even'' %>"> <%= render :partial => ''item'', :locals => { :item => item } %>
2007 Apr 19
4
render_to_string in a model ?
I have a batch job that will call script/runner, I would like in this call to create html formated email and save it to the database. This is easy enough in a controller with yournewhost.email = render_to_string :action => "email_newhost_ready", :layout => false But render_to_string is only available in controller action pack, is there a easy way to render_to_string in a Model? Or
2006 Feb 19
2
Prototype Ajax + File Uploading-- How?
Good evening! I''m currently trying to submit some data and a file upload through Ajax. I''m using rails & prototype, and somewhere there''s a disconnect. I''m reasonably convinced the file upload isnt being sent at all, or if it is, Rails has absolutely no idea. The form itself heads with: <form onsubmit="new
2007 Nov 25
2
Fwd: Render_to_string from a worker
Hi, I am trying to generate a PDF from within a worker using PDF::Writer. In my controller I use render_to_string to create the pdf file however from what I understand render_to_string can only be used from a controller. Does anybody have any suggestions how I might be able to replicate this functionality in a worker? -- thanks, Felix -------------- next part -------------- An HTML attachment
2012 May 28
1
rendering a partial inside another using render_to_string and (:formats) in controller
I want to clean my code by moving the duplicated lines : partial = render_to_string( :partial => "#{file}", :formats => [:html] ) to the pagination_partials function. ================================================= WORKING CODE: ================================================= def render_format_search_partial(file, options={}) # TODO remove this line to use the one
2006 Jul 11
1
Aggregate Controllers
Hi, I''m developing a dashboard like page and basically want to combine the result of multiple actions on a page. I''ve done this so far: def index r1 = render_to_string :action => "action1" r2 = render_to_string :action => "action2" render :text => r1+r2 end This works, but now I want to render from other controllers and this is where
2010 Mar 17
3
rails+prawnto: setting :type to :prawn in a #render_to_string call not working
Hello, my question is rails related though it is also somewhat specific to the prawnto plugin (installed latest version as of 2010-03-15). I would ask on a prawnto forum/list if I knew where one was. Anyhow, I''m using rails 2.3.5 (with ruby 1.8.6 patchlevel 111) in an app that is successfully using the prawnto gem (with the prawn gem version 0.7.1). I''ve got a a
2011 Mar 06
2
render_views and render_to_string
Hey guys. One of my controller actions uses #render_to_string to send back a JSON response. When I try to spec this, Ruby raises a NoMethodError, saying that #render_to_string doesn''t exist in my controller action. Here''s the controller action, spec, and output: http://pastie.org/1640962 Any idea what I''m doing wrong? Thanks, Nick -------------- next part
2006 Feb 07
2
Question about Classes.
I have the attached class that I''m writing. The problem that I''m running into is that I can not access the options from the createArray function which get called after the ajax request gets done. I want to move the values of the xml file to an array and story it in the options variable. Can someone explain what I''m doing wrong? var LeaderInfo = Class.create();
2006 Mar 13
2
how do I render a partial view into a string from inside a view ?
I want to pass the partial to a Javascript function ( which uses the data for for creating an iframe) render_to_string is not accessible form a view thanks in advance -- Roberto Saccon - http://rsaccon.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060313/8165bcec/attachment.html
2008 Jan 10
3
A best practices question
Hey everyone. I''ve got a best practices question. How are you guys rendering newsfeeds? We have a couple of apps where we send newsfeed items from a backend process. As such, we aren''t in the context of a controller and can''t use the rails template rendering. We''ve tried about 3 different ways to make that bearable, but aren''t having much
2006 Jun 09
4
View into a String?
I''ve got a nice XML view of my data that works just fine when I call it from the browser. Now I''d like a different controller method to take that XML and write it to the file system. Since the XML view lives in an RXML file, is there a trick to telling the controller "Get your output into a string" instead of writing it back to the browser? After writing it out
2011 May 17
1
rails render_to_string problem
Hi I`m trying to test my controller with rspec and always get an error. The error is in the render_to_string method call (without it test works fine). So could u please help me with that? users_controller.rb: def update @user.update_attributes!(params[:user]) redirect_to @user, :status => 202, :text => render_to_string(:partial => "users/show", :type =>
2006 Feb 12
6
Including another helper
I need to include another helper module apart from the normal two (ApplicationHelper and [controllername]Helper). The inclusion needs to be dynamic and based on external parameters (ie what helper that get included differ from request to request). Is it possible? How? /Marcus
2006 Mar 17
2
How to let the layout be more OO?
I am confused about the @content_for_layout.''cause it will display all the views in the layout.Do I have any methods to let the layout be more OO? I mean that for example,the app currently have more than one views to be displayed,but only some of them to be displayed at the same time at different <div></div> units. I hope there exists a kind of way that: <%= if