Displaying 20 results from an estimated 800 matches similar to: "Specs for Helpers that call render"
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,
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
wrong. Does anyone have any experiece with this?
Josh
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
2007 Jul 19
7
NoMethodError in partial driving me mad
Hello,
i simplified have a news model, a news category model and a news
controller.
my _news.rhtml partial renders a single news entry.
in my controller there are the actions show and show_category.
if the "show" action is called, 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
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 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 Jun 08
1
No rhtml, rxml, or delegate template found
hi ,
i''m having a problem with rendering a partial , the partial is in the
apps/view/polls folder with the name : _antwoorden_user.rhtml
in the view i''m rendering it with
<% if @user %>
<%= render :partial => ''polls/antwoorden_user'', :locals => {:poll =>
@poll, :user => @user} %>
<% else %>
....
gives me the error =>
No
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"
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
2006 Mar 05
1
Help with Self-Referential HABTM
With the help of the Rails Recipes have got a self-referential HABTM
relationship working, but I''m really struggling with getting a new entry
from a form accepted. i should say here that the form is also submitting
info for the join table too.
So in my model I have:
class Type < ActiveRecord::Base
has_and_belongs_to_many :subtypes,
:class_name => ''Type'',
2006 Dec 13
4
RSpec and simply_helpful
Hi All
I''m having some problems running my view specs when using
simply_helpful. I have it semi-working via the following:
module SimplyHelpfulHelper
def self.included(base)
base.send :include, SimplyHelpful::RecordIdentificationHelper
base.send :include, SimplyHelpful::RecordTagHelper
end
end
context "The index template" do
setup do
@shift =
2005 Jul 06
2
Composite Views
Hello:
How do you create a composite view? I have a form based on the model
"contacts" which consists the following models:
- organization
- person
- address
I was going to use partials to create the form; e.g:
- organizations/_form.rhtml
- people/_form.rhtml .etc
...and render them with the appropriate tag:
<%= render_partial ''people/form'', @person %>
I
2007 Dec 07
4
strange error on mock proxy
I''m banging my head over this really strange error in a view test when
I run "rake spec". The weird thing is that I don''t get the error when
I run the spec file by itself.
Here is the spec (I know, fixtures are the devil):
describe "/units/new.html.erb here" do
fixtures :units, :accounts, :groups
it_should_behave_like
2010 Sep 22
1
Bundler picking up wrong version of Ruby with Rails 3 ( possible bundler bug )
Hello All,
I am developing a JRuby on Rails 3 application. Standard stuff.
I am facing problems getting autotest to run.
Here''s the trace:
% autotest
loading autotest/rails_rspec2
bundle exec
/Users/manish/Foo/Foo-Server/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.22/bin/rspec
2006 Aug 05
1
form_for and partials
I''m getting an error in the partial when i try
<% form_for :name do |form| %>
<%= render_partial "#{@current_stage}" %>
<% end %>
So I assume that form_for does not have scope in the partial?
If that is the case what are my solutions...
Do I have to stick a <% form_for in every partial, or do i just change all
my inputs back to text_field
2006 May 01
1
Show/Hide with AJAX
I''m trying to implement a show/hide details function.
I have the show part done, but I''m not sure how to get it to hide.
My app looks like this so far:
View:
<%= link_to_remote "Show/Hide", :update => "details", :url => { :action
=> "show", :id => leif } %>
<p id="details"></p>
Action:
def show
@leif =
2006 Apr 05
1
processing code within a partial
I''m doing layouts and I have a question on how to process <%= ... %>
tags within partials.
I have a standard.rhtml file with :
<div id="header"><%= render_partial "layouts/header" %></div>
and my _header.rhtml contains a tag as such:
<link_to "Categories", :controller => "categories", :action=> "list"
2006 Feb 20
4
Obtaining the ID of a newly saved model object
Hi,
I''m struggling with this and I''m not sure if it is obvious or dumb (or both).
I have a basic create method like so:
def creatematerial
@material = Material.new(params[:material])
if @material.save
flash[:notice] = "Material successfully created."
end
Ok so far, but now I want to retrieve that object that was just saved so that it can be used in the
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
2005 Dec 27
1
Rails/Ajax question from a newbie (to both)
I''m trying to get a Rico LiveGrid working, and I am a bit stuck on how to
accomplish this.
I have a page that successfully queries a controller and updates a <div>
containing a table. I have two
versions of the action; one uses the render_partial to return a rendered
version of that table, and the
other returns an XML-RPC document, and this is where I hit a snag.
The Rico LiveGrid