similar to: Render partial from model?

Displaying 20 results from an estimated 5000 matches similar to: "Render partial from model?"

2007 Oct 21
4
Making 'expire_fragment' available to a model?
I noticed a lot of repetition across different Sweeper models in my app expiring the same fragments and so have been trying to move all the expire_fragment calls into another model which the sweepers can then use but it''s not working as I''d hoped.. I''ve created a CacheDestroyer model and want to be able to call something to the effect of:
2007 Feb 07
11
Running patched rails
Hi, Does anyone have any tips for running a patched version of rails? I am currently running rails 1.2.2 and would like to keep up to date with any future releases. I also want to run with the following patch: http://dev.rubyonrails.org/ticket/5748 I am unsure how to manage this. Is this something SVN or rake can handle? Any tips/pointers would be very much appreciated. Thanks, GiantCranes
2007 Aug 23
2
Render partial from Backgroundrb worker?
Hi, I have a long running task which generates JavaScript to files and I am hoping to move this to a backgroundrb worker. The javascript is currently generated with call to render_to_string: File.open(File.join(target_folder, ''all.js''), "w") do |file| file.puts(render_to_string :partial => ''partials/shared/javascript/tags'', :locals => {
2007 Jun 21
1
render :partial => :url - is it possible?
Hi, this is my first post to the list. I''m still learning the rails framework, having done most of my previous web development in PHP. I''ve done a bit of googling for the answer to this question, but maybe I''m just lacking the right word to search for. Several parts of my site, such as sidebar components, are self-contained, modularized and re-used in several parts
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 05
6
render partial -- show certain content only if...
i''m working on a _post.rhtml partial, and it displays one blog post. i''m accessing this partial on the list.rhtml and the show.rhtml what i''d like is to only show the "link" link on the list.rhtml and not on the show page. <%= post.title%> <br /> <%= post.body%> <%= link_to
2006 Jul 12
3
Ajax, the Back button, and Sweepers
I''m working on an app that''s basically forms and that makes fairly heavy use of Ajax. As a result of the Ajax usage, if the visitor uses the back button they get the page as it was originally loaded, not as they left it. I''ve looked at the Sweeper documentation and can not tell for sure that it''ll do what I want, which is to force an unconditional reload from
2010 Oct 20
7
How can I render a template outside of a controller in Rails 3?
Hi All, I can''t seem to render a template outside of a controller in my Rails 3 application. The googling I''ve done has been helpful, and I eventually found some useful info at http://www.swombat.com/rails-rendering-templates-outside-of-a-contro. However, this seems to be broken in Rails 3. Does anyone have any ideas how I can fix this method or perhaps know of a better
2005 May 01
5
Example using Builder::XmlMarkup and .rxml files?
Greetings, I''m a newby to both "R"s in RoR. I would like to use Builder::XmlMarkup to generate my pages. If there is a working downloadable example somewhere, that would probably be enough. Otherwise, here''s what I want to do: With the following controller: class AccountsController < ApplicationController layout ''accounts'' model :account
2008 Apr 01
1
"Undefined method merge" when using sweeper
Hi, I''m trying to use sweepers for the first time and got a problem - I get "undefined method `merge'' for "/signature/ f2d7c7c66450b169.html":String". The "/signature/f2d7c7c66450b169.html" part of the error message is the cached page. Here''s my sweeper: class FooSweeper < ActionController::Caching::Sweeper observe Foo def
2006 Jun 27
3
Easy question: Where do I put sweepers?
Trying to implement some sweepers to clean up my caching, but where do I put them? "ruby script/generate sweeeper" does nothing. -- Posted via http://www.ruby-forum.com/.
2006 Apr 27
3
XML output
Hi, Sorry abt the half finished post that I sent out earlier. The idea is to generate an output xml response as such: <?xml version="1.0" encoding="ISO-8859-1" ?> <response status=''NOT_AVAILABLE''> <message>Some text</message> <from>Me</from> </response> I make a request like such
2007 Nov 21
4
Builder::XmlMarkup adds <inspect/> on printing and <clone/> on saving
Hello, I am new in this group. Please give me a short hint, in case this is the wrong place for my posting. I want to create an XML file and store it in "filetransfer". The XML part of the file (the body) sould go to "filetransfer.data". Despite the last line, everything is fine with the code below. With "filetransfer.save" two entries "<clone/>"
2007 Jun 11
2
Builder::XmlMarkup and dashes
Has anyone hacked Builder::XmlMarkup to dasherize underscore tags by default? I know I can use tag!, but I''d like to find a way for it to translate underscores to dashes automatically. In other words: xml.department_manager do "fred end #=> <department-manager>fred</department-manager> I tried hacking Builder::XmlBase.method_missing but got myself all twisted up!
2006 Jul 15
2
Render -> ActionController -> Render -> ...
Hi Guys, ActiveRecord is great for being able to drill down through many tables. I often locate the very "top" record, and have a render :action => "show" display that top record. Often I want to drill down like: @kingdom.phylums.classes.orders.each do |order| render :partial => "order/show" end But, depending on the user who is logged in, they see a
2006 Jul 14
2
how to get builder 2.0 to escape attributes in rxml
I am using rxml to produce opml files and need to escape ampersands in the attributes. builder 2.0 docs found at http://builder.rubyforge.org/ show the following xml = Builder::XmlMarkup.new xml.sample(:escaped=>"This&That", :unescaped=>:"Here&amp;There") xml.target! => <sample escaped="This&amp;That"
2006 Feb 14
22
Teaching Models to Render Themselves in the Controller
I am trying to teach my models how to render themselves, i.e. <%= my_model_object.render() %> Let me explain my reasoning and proposed method before this gets shot down as anti-MVC. Let''s say I am writing a contact-management application. I have a class Contact. I will need to display this class all over the application. My first choice is to use a partial. Now I can
2006 Jan 03
5
Are cache sweepers used?
After drawing many virtual blank stares in the IRC channel and finding zero results on the wiki for ''sweeper'' I''m left to wonder whether these are actually officially supported, or are on their way toward being deprecated. Is there a better way of expiring caches on model saves and deletions? Sincerely, Tom Lieber tom@alltom.com http://AllTom.com/
2007 Feb 14
4
cache sweeper not getting called
Hi, I''ve started to implement page caches but I''ve hit a brick wall getting a sweeper to clear the cache when needed. It seems that any models that I tell it to observe aren''t being observed properly. If I add the sweeper to a controller the initialize method runs, but no matter what I do the after_save/after_update callbacks aren''t running. Also if I try to
2006 Jul 31
2
is it possible to make to_xml use underscore instead of dash?
Hi all, I am getting ActiveRecord to produce XML with render :xml => @user.to_xml However, on the client end it is a bit annoying for me to deal with attributes like first-name. I would much rather have first_name. Is there any way for me to turn off the behavior of converting _ to -? This seems to be done by a call to dasherize inside the to_xml of