similar to: How to save output "render :action=>:any_action" to a file?

Displaying 20 results from an estimated 4000 matches similar to: "How to save output "render :action=>:any_action" to a file?"

2006 Aug 11
5
Why does no one like render_component?
Maybe I''m missing the point? Lets take for example albums of pictures. If I have a scaffold for each, and I''m showing an album, what if I want to list all of the pictures that are in the album? Surely, I''d want to call the List action in the picture controller. render_component would do this perfectly. But we''re told not to use render_component. So
2005 Dec 27
6
avoid multiple render per action
Hello, I have a hash that contains categories, and each category ID is a hash of subcategories. What i want to do is dynamically load that hash, loop thru it, for each category , subcat run a query against the DB, and render a partial. The issue is i put the render:partial in a for loop but you can only render once per action. What is the best way to loop thru all my categories without a
2006 Aug 08
5
off topic: running non-ruby programs through command line
Hi all, Slightly OT, but is there any way to run command-line programs through Ruby? I have a rails web application that performs some database work. After a certain action is performed, the rails app should then call a java program that performs additional work to our mainframe. This is under Win 2003 Server. Any ideas? Thanks, Jin Lee -------------- next part -------------- An HTML attachment
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
2006 Feb 12
3
Invoke render multiple times
I need to invoke render() multiple times. This is not to render a response to the browser but to get the result of render() and put it in files. Is there another way to do it if it''s not possible to do it directly with render()? Btw, what''s the reasoning behind only allowing render() to be called once a request? /Marcus
2006 Aug 09
3
select with country names
Hi, I need to create a list of coutries in a driop down. I''m aware of a function ''country_options_for_select'' however this jsut seems to output a string of all countires. How can I get this list in a drop down? Thanks scott -- Posted via http://www.ruby-forum.com/.
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 Aug 17
11
Can I get RubyOnRails to read and parse an html file off harddrive?
I do this in ASP to read a special html template that I use, then modify in code before spitting out the resulting webpage. Any ideas on how to script this in RUBY? Do I need a special GEM package? D. Bruce Moore -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060817/95cf5da6/attachment.html
2006 Aug 08
11
Newb question- method not working
I know this shouldn''t be in the view but to test the code it is. Anyway if I do just session[user] I get back the user id (the id from the user table) which is good. However this code does not work. <% a = session[:user] %> <% uname = User.find(:first, :conditions => id = a) %> <%= @uname %> TIA Stuart
2006 Aug 10
6
passing hash from controller to view and pluralization?
hi, i have 2 tables (counties and towns). counties has_many towns and towns belong_to counties. now my question: i thought i would need to do is say @counties = Counties.find(:all). should that not return to me all counties in the counties table WITH all towns associated with each county? in my view i was getting error when doing this if(counties.has_towns?) saying undefined has_towns
2006 May 18
4
Can I send rendered .html to somewhere besides the web server?
Is there any way to tell Rails to send the .html file it renders somewhere other than the web server? I need to save a page to the server''s file system instead of sending it to the user''s browser. Thanks! Bill -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060518/facce47e/attachment.html
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
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
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 Jul 11
1
Render to file ?
Hello, I need to render a layout to a text file - How can I do ? Thanks -- Posted via http://www.ruby-forum.com/.
2006 Jun 30
1
How to force redirection after a render on PDF::Writer?
Hi to everyone, In my Rails experimenting, I''ve come to a point where in the application happens what follows. 1. Upon selecting some stuff on a page, the user click on a button. 2. After clicking I need to: 2.1 Produce a PDF with some "Pretty Useful Information(TM)" 2.2 Bring the user to another page The PDF being produced with PDF::Writer requires a "render"
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/.
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
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