Displaying 20 results from an estimated 80 matches for "render_partial".
2005 Apr 13
2
render_partial & RXML
Does render_partial work within a RXML file? I am attempting the following:
xml.users do
for user in @users
render_partial ''user'', user
end
end
All that is output is:
<user>
</user>
Without any exception or anything to indicate that I''m doing something
wron...
2005 Jun 29
2
Complex helper with block help
Hi everyone,
I am writing a helper function that takes a parameter and block and
wraps some HTML around it. e.g.
def box_with_caption(caption, &block)
data = capture(&block)
buffer = render_partial("helpers/box_caption", :caption =>
caption)
buffer << render_partial("helpers/box_data", :data => data)
buffer
end
however, when I attempt the following, it doesn''t work.
<%= box_with_caption("Caption here") do %>
HTML for the box in here...
2007 Nov 03
1
Specs for Helpers that call render
The helper spec I am writing tests a helper method that calls render.
##
module HelperHelper
def render_partial
render :partial => ''partial''
end
end
##
The helper spec.
##
describe HelperHelper do
it "should render partial" do
render_partial.should_not == nil
end
end
##
The output generated
##
$ spec spec/helpers/home_helper_spec.rb
.F
1)
NoMethodError i...
2006 Jul 26
1
ajax render_partial
Hi,
i was hoping someone could reffer me to a doc or an explination (i
haven''t found anything) for rendering a partial via an ajax request - -
i know i could probably do it via
link_to :action => x
and then
def x
render_partial ''y''
end
but i was hoping ther was something simpler, and more rails-like caller
such as
render_ajaxed_partial ''y''
or something simpler.
is there?
thanks in advance,
shai
--
Posted via http://www.ruby-forum.com/.
2007 Jul 19
7
NoMethodError in partial driving me mad
...alled, a single news item is rendered through
my partial with no errors.
if the "show_category" action is called, i get a NoMethodError while
displaying my news through the partial.
news_controller.rb:
---------------------------------
def show
@news = News.find(params[:id])
render_partial ''news''
end
def show_category
@news = NewsCategory.find(params[:id]).news
render_partial ''news'', :collection => @news
end
_news.rhtml:
---------------------------------
<div>
<h1><%=h news.title %> - Kategory: <%= news.news...
2005 Apr 06
6
Mimic something like layout on a smaller scale?
I need to add various header and footer dressings around groups of form
fields for GUI goodness, and am wondering if there''s already something out
there that will suit my needs. These headers/footers have special properties
for display(title, help links, etc...). I want to be able to easily take
advantage of the existing HTML helper methods provided for controllers, in a
mini-layout type
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 partial in t...
2006 Feb 14
22
Teaching Models to Render Themselves in the Controller
...ing 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 render my Contact with:
<% render_partial ''contact_view'', :contact => my_contact %>
However, I start doing some ajax things, where I need to render a
contact and return it with an AJAX call. So, I simply render the
partial from my controller. Not too bad, as long as I can keep
straight what partial to call an...
2006 Jul 16
3
RJS problem
I have an odd problem while trying to use a simple rjs.
_test.rjs : page.alert "test"
test.rhtml: <script><%=render_partial(''test'')%></script>
When I am attempting to view controller/test the page comes as if it was a
text file.
So i am actually seeing:
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"...
2006 Jun 26
0
Using a partial multiple times in a view
...exec_cmd(cmd_df)
cmd_sys = "uname -a"
exec_cmd(cmd_sys)
end
private
def exec_cmd(cmd)
r=IO.popen(cmd, "r")
@result = r.readlines($/)
r.close_read
return @result
end
heres the index view
<div class="body_top">
<%= render_partial ''shared/page_header_image'', ''image'' =>
''/images/system.gif'' %>
<%= render_partial ''shared/page_menu'' %>
</div> <!-- body_top -->
<div class="body_content">
<h1>Overview</h1...
2007 May 05
0
integration with movtable
...<title>Movtable - List</title>
<%= stylesheet_link_tag ''movtable'' %>
<%= sort_generateJS %>
</head>
<body onload="sortableInit()" onmousemove="mouseMove(event)"
onmouseup="mouseUp(event)">
<%= render_partial ''../../lib/movtable/table'' %>
<%= render_partial ''../../lib/movtable/navigation'' %>
<%= render_partial ''../../lib/movtable/filter'' %>
</body>
</html>
I want to use my own application.rhtml layout, but leavin...
2006 Jun 08
1
No rhtml, rxml, or delegate template found
...n''
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/base.rb:195:in
`render_file''
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/base.rb:220:in
`render''
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/partials.rb:58:in
`render_partial''
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/partials.rb:57:in
`benchmark''
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/benchmarking.rb:29:in
`measure''
c:/ruby/lib/ruby/1.8/benchmark.rb:307:in `realtime''
c:/ruby/li...
2005 Aug 19
3
accessing DB result in template
hello,
I have the following in my controller
def totalmembers
@total = User.find_by_sql "SELECT COUNT(*) as count FROM users "
end
now inside my template how do i access the field "count" from the
query so i can print out the number of members ?
I tried everythign like <%= @total.count %> but nothing works.
thanks
adam
2006 Dec 13
4
RSpec and simply_helpful
...ould_have_tag ''div'', :attributes => { :id => ''shift_1'' }
end
end
My template just makes a call like this:
<%= render :partial => @shifts %>
I''ve done some experimentation, and it seems that RSpec''s
implementation of ''render_partial'' is rewriting the partial path
trying to be smart about it but breaking things. The partial_path,
once it reaches render_partial_with_record_identification, ends up
being "/shifts//#<Spec::Mocks::Mock:0x28450cc>". This is caused by
the method being overwritten in
rspec_on...
2008 Mar 23
6
Locals do not appear in partial unless collection is explici
Maybe I''m misunderstanding something but it appears as if
<%= render :partial => @items, @locals => { :this => ''that'' } %>
does not give the local variable this but this one does:
<%= render :partial => ''items/item'', :collection => @items, @locals => {
:this => ''that'' } %>
Shouldn''t they mean
2005 Nov 17
7
render :partial in mail template
Hi,
Is it possible to render a partial template from within a mail template?
I get the following error
undefined method `controller_path'' for SupportMailer:Class
Extracted source (around line #8):
5:
6: <%= @url %>
7:
8: <%= render_partial ''sig_admin'' %>
Jeroen
2006 Mar 05
1
Help with Self-Referential HABTM
...is called by a link "create a new subtype from
this type". NB each type can have many subtypes and belong to many types
to -- hence needs to be many-many rather than a tree structure):
<%= start_form_tag :action => ''createsubtype'', :id => @type %>
<%= render_partial ''form'' %> # Gets all the info for the Type fields
<%#= hidden_field(''type'', ''subtype_id'', "value" => @subtype.id) %>
<%= hidden_field(''subtypes'', ''id'', "value" => @subtype...
2007 Dec 07
4
strange error on mock proxy
...n_view.rb:18:in
`render_file''
vendor/rails/actionpack/lib/action_view/base.rb:331:in
`orig_render''
vendor/plugins/rspec_on_rails/lib/spec/rails/extensions/
action_view/base.rb:22:in `render''
vendor/rails/actionpack/lib/action_view/partials.rb:117:in
`render_partial''
vendor/rails/actionpack/lib/action_controller/benchmarking.rb:
26:in `benchmark''
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/1.8/benchmark.rb:293:in `measure''
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/...
2006 Mar 01
2
Method Calling Problems
Hi all! I am attemping to call a method inside of my
LeviUserController named show_userland from my
LeviInterfaceController class. No matter how I do it,
I keep getting some type of error. If I make the method
a class method, then my render_partial inside of
show_userland can''t be found. If i call it using
@luser = LeviUserController.new;
@luser.show_userland;
I get an error with a nil object exception.
Y''all have any ideas? I would greatly appreciate the help.
--
Topher Fangio
fangiotophia@gmail.com
http://www.fangiotop...
2008 May 03
4
silly partial qu
hi all,
i''m just trying to check a partial has been rendered, by using:
response.template.should_receive(:render).with(:partial => "tasks/list")
this passes, even if I put something bogus in the partial name, such as:
response.template.should_receive(:render).with(:partial =>
"___tassdfsdfks/list")
does anyone know why this doesn''t fail?
is this the