Displaying 20 results from an estimated 8000 matches similar to: "processing code within a partial"
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
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 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
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 May 30
2
ActionView::TemplateError
Hi,
I have a strange problem that only occurs on the production server.
I''ve been banging my head for hours trying to figure it out with no
success. Below is a copy of the error from the production log.
ActionView::TemplateError (Expected /www/rails_apps/scanlan/current/
public/../config/../app/models/image.rb to define Image) on line #6 of
app/views/admin/design/_record.rhtml:
3:
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
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
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 22
3
Rendering partials in ActionMailer?
Hello,
Is anyone out there rendering partials successfully in ActionMailer
templates?
I am having trouble with this, and wasn''t sure if it was my
configuration or something with a version of Rails I''m running.
We''ve got over 15 mailer templates, all working like a charm.
But we have a piece of shared code, that we''d really like to not have to
copy &
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 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,
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)
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
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
2006 Feb 25
2
SSI like function in Rails?
Hey
Im slowly learning ruby and rails... still having some problems with
grasping the basic concepts though.
How do I include a common html snippet in some of my views? (The snippet
exists in two different flavors, I want to include either one depending
on what type of user (admin/others) is requesting the page)
I have tried the normal SSI include tags, but my WEBrick server cant
handle
2010 Sep 03
1
Action Controller Error: undefined local variable or method `current_user'
Newbie learning Rails. I''m currently on Chp9 here:
http://railstutorial.org/chapters/sign-in-sign-out#top
At the end of the tutorial, rails is erroring (see below). being new
to Rails and after having checked the tutorial... How do you resolve
this kind of error. It''s saying current_user is not defined, and it is
supposed to be defined with/Sites/sample_app/app/helpers/
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
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
2006 Jun 26
0
Using a partial multiple times in a view
Hi,
im trying to execute multiple cmds in a method that use the same view
which
has multiple calls to the same partial inside it.
However i cant get it to work correctly, so any help here would be
appreciated
heres the controller code
def index
cmd_df = "df -Ph"
exec_cmd(cmd_df)
cmd_sys = "uname -a"
exec_cmd(cmd_sys)
end
private
def exec_cmd(cmd)
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 =