Displaying 20 results from an estimated 50000 matches similar to: "Globalize, partial, cache"
2012 Nov 29
3
Proposal: faragment cache with :if / :unless conditions
Hi,
I''m wondering if it would be a good idea to have fragment cache to allow
options :if / :unless to determine whether or not to actually perform
caching on the given block.
It would actually be a good idea in my opinion right now, since I''m working
on a piece of code that would benefit by this feature.
The scenario is the following:
I have a partial, which is
2008 May 08
0
stub sub partials when testing partial with rspec
Hello all
I prefer to use many partials. It makes my code more DRY
Also I use rspec, and when I have to test partial with sub partials I
have a problem.
if I stub render, then my partial will not be rendered. If i do not
stub render it tries to render sub partial (and i don''t need this)
Not very long googling did not bring the answer, so I made very dirty
and IMHO dangerous function
2006 Aug 18
1
Fragment Caching
Hello.
I wouldn''t mind getting some feedback about the use of fragment
caching. I''ve got a series of relatively expensive database queries
with their respective partials cached and everything is working fine.
The problem is that do get this to work I''ve had to move the database
queries from the controller into the view layer so as to avoid them
being called if the
2010 May 19
0
render html partial from atom builder
So I have an action that results in atom:
def index
...
respond_to do |format|
...
format.atom { render :layout => false}
end
end
Then I have a builder template to render the atom, called
index.atom.builder.
Inside this builder template, I''d like to render one of my existing html
partials, to put in the atom:content element, perfectly normal atom
thing to do.
2006 Aug 01
2
Partial Naming Madness
Hi, I am having the following issue with a partial. During initial page
load, I am doing a "render_partial_collect ''foo'', @foos", and all goes
well. Each foo partial makes use of a variable inside called ''foo'' (and
can get foo.id etc).
After all the partials are loaded, I need to :update a div corresponding
to one of the partials (ie re-load the
2006 Apr 04
4
checking existence of a partial
Is there a simple way to check for the existence of a partial before
displaying it?
I have some code that creates a dynamic partial depending on the city a
particular object is located in. There are some cities that do NOT have
partials defined for them, but I still want the overall page to
display. Is there a way to either chefck for existence before
displaying (enclosed in an if
2008 Mar 12
2
RSpec view test for :partial with :locals?
I''m currently working on some RSpec view tests and I''m having problems
with expect_render. Most of the expect_render''s work fine, but in one
of my views I have:
<%= render :partial => "user_cloud", :locals => {:user =>
@featured_user} %>
I see that expect_render supports ":object" or ":collection" for the
second
2006 Feb 02
2
multiple ''render :partial'' in a helper ??
Hi all,
I''d like to move some view code to a helper but it doesn''t work because
I need to render two partials each time.
Q: Is it possible to do this with a helper?
Example:
-----------------
Before: In the view:
...
<% case controller.controller_name
when ''member'' %>
<%= render :partial => ''shared/member_menu''
2006 Mar 14
5
Best way to use partial rendering in global layout
I have a global layout in application.rhtml and I''d like to render a
partial template within it.
Currently, I have this:
<%= render (:partial => ''side_nav'') %>
but it seems to be looking in the controller specific view directory.
What is the best way to do handle controller - global partial rendering?
Wes
--
Posted via http://www.ruby-forum.com/.
2006 May 17
3
RJS behave differently than render :partial?
I have a method in my controller like the following (the syntax may not
be correct, I''m doing this from memory - you should be able to get the
idea though) My rhtml page has a DIV with id="country_areas", which
contains a partial that only makes a drop down of country areas for a
specific country. When changing the country in the country drop down, it
uses the
2008 Jul 17
0
render partial vs. render subtemplate?
Can anyone shed any light on the pros/cons of one vs. the other?
Certainly the "render partial" option is advantageous as an
abstraction of one or many objects and what to do with them. But I''m
noticing that my code is starting to have lots of partials and I
wonder where subtemplates fit in?
Are there some best practicies for partials vs. subtemplates?
Thanks!
-Danimal
2006 Nov 04
0
Globalize & caching
Currently only the translated keys are being cached, those that have no
translation are not.
I believe a form of caching should be done for the keys/strings that do not
have (yet) a translation, because right now the application keeps trying to
find a translation that is not there.
A mundane way would be to cache a predefined value for strings that did not
have a translation, and return the
2007 Jul 16
0
Partials vs. Helpers
I have several partials containing dynamic codes (already memcached all
the fragments as best I could), which I reuse ( render :partial =>
"stuff.rhtml" ) a lot within a single action call. For example, I have a
partial which defines how an entry is to be formated in HTML. I have 40
entries on a page, so the partial is rendered 40 times in a single
action.
Not knowing the
2005 Dec 06
1
globalize plugin question
Hi,
I''d like to try and use the Globalize plugin, but I only need a subset
of the features that plugin provides. I''d like to:
- translate text in views
- format date/time/numbers using different locales
I won''t be using stuff like:
Locale.set("en-US")
prod = Product.find(1)
prod.name -> "Meatballs"
Locale.set("es-ES")
prod =
2006 Jan 18
3
Partial Problems
Hey guys,
I''m having a little trouble working out partials.
I have successfully made a partial work in my list.rhtml, but as I see it on
the 15min introductry video. They guy uses one partial on multipul pages.
At the moment I am trying this in my show.rhtml, I write <%= render :partial
=> "journal" %> and I get this.
NoMethodError in Write#show
>
> Showing
2006 Aug 08
3
Rendering partials based on conditions
Hi,
A bit unsure how this gets accomplished - particularly how it might
get set up in the layout.
Currently -
This is my welcome.rthml (what comes up at main page)
<% if @u %>
<%= render :partial => "main/session" %>
<% else %>
<%= render :partial => "main/login" %>
<%= render :partial => "main/register" %>
<% end %>
2006 Mar 28
3
[tip] making cached pages look dynamic
Hey
I just launched a new release of www.strongside.dk based on rails 1.1.
The site is in danish so it wont make any sense to most of you.
However, here at technique I want to share with you.
Some of the pages on that site requires a lot of calculations, but the
data is actually static. So these pages are cached.
However, when a logged on user is viewing a cached page, we still want
to
2012 May 21
4
Rendering partial views with ajax calls in rails 3.1
I''m starting now with rails, and i have simply question i think.
I need to render two partials in one ajax call:
I have the following controller:
# GET /hosts/1
# GET /hosts/1.json
def show
@host = Host.find(params[:id])
respond_to do |format|
format.html #show.html
format.js
format.json { render :json => @host }
end
2006 May 12
3
How to implement a global partial?
Quick question:
Whats the easiest way to implement a global partial? Where I can call
one partial from many different controllers (err controller views)?
--
Posted via http://www.ruby-forum.com/.
2008 Mar 31
2
Rails and Partials
Excuse my ignorance on partials but.....
I am trying to use partials to create a uniform display box built with
html tables. The only way I have thought about accomplishing this is to
create two partials:
_start_box.erb
----------------
<table id="box" width="<%= width %>"><tr><th><%= h(label_text)
%></th></tr><tr><td>