I have a simple ajax request that should return a partial, but for some
reason I am continually told that it is not there. I have modified the
partial location to other partials that do work fine elsewhere and it
still tells me that it can’t find those files.
Here is the code:
class Admin::ContentPhotosController < ApplicationController
…
def new
respond_to do |format|
format.js { render :partial => “admin/content_photos/form” }
end
end
…
end
Here is some console output showing that the file exists
$ ls app/views/admin/content_photos/
_form.html.haml index.html.haml new.html.haml
Couldn’t find template file for admin/content_photos/_form
Help is appreciated.
iso … wrote:
Here is the code:
class Admin::ContentPhotosController < ApplicationController
…
def new
respond_to do |format|
format.js { render :partial => “admin/content_photos/form” }
end
end
…
end
format.js { render :partial => “form” }
hth
ilan
Ilan B. wrote:
iso … wrote:
Here is the code:
class Admin::ContentPhotosController < ApplicationController
…
def new
respond_to do |format|
format.js { render :partial => “admin/content_photos/form” }
end
end
…
end
format.js { render :partial => “form” }
hth
ilan
Unfortunately, that doesn’t seem to work either. I get the same error
message:
ActionView::ActionViewError (Couldn’t find template file for
admin/content_photos/_form in
["/Users/chris/Documents/Projects/Rails/cms/app/views"]):
I wasn’t aware that you could render the partials using that path, so
thanks for that
David A. Black wrote:
Hi –
On Tue, 18 Mar 2008, iso … wrote:
format.js { render :partial => "admin/content_photos/form" }
ilan
Unfortunately, that doesn’t seem to work either. I get the same error
message:
Try calling your partial _form.js.haml.
David
I didn’t want to call it _form.js.haml since it is rendered on a normal
http request, but renaming it to _form.haml did the trick, which makes
perfect sense.
Thanks David.
Hi –
On Tue, 18 Mar 2008, iso … wrote:
format.js { render :partial => "admin/content_photos/form" }
ilan
Unfortunately, that doesn’t seem to work either. I get the same error
message:
Try calling your partial _form.js.haml.
David
–
Upcoming Rails training from David A. Black and Ruby Power and Light:
ADVANCING WITH RAILS, April 14-17 2008, New York City
CORE RAILS, June 24-27 2008, London (Skills Matter)
See http://www.rubypal.com for details. Berlin dates coming soon!