Displaying 20 results from an estimated 100000 matches similar to: "How to find current template"
2010 Oct 20
7
How can I render a template outside of a controller in Rails 3?
Hi All,
I can''t seem to render a template outside of a controller in my Rails 3
application. The googling I''ve done has been helpful, and I eventually found
some useful info at
http://www.swombat.com/rails-rendering-templates-outside-of-a-contro.
However, this seems to be broken in Rails 3. Does anyone have any ideas how
I can fix this method or perhaps know of a better
2006 Dec 17
1
Markaby template & layout (can't get them to work together)
Hi all,
I am starting a new rails app with the Markaby plugin (had some issues
installing, but think its working).
First, i created an index.mab file for a controller containing:
h1 "First template"
That rendered fine. Also, I do not have a "def index ..." in the
controller.
Then I created an app/layouts/application.mab file. It didn''t get picked
up until after
2008 Jan 07
3
Rails check for a .js template instead of .rjs?
respond_to do |format|
format.html
format.js { render :template => "login" }
end
Whenever I send an AJAX request to the action that has that code it says
it cant find the template login.js. Why isnt it looking for login.rjs?
Also when I take out the render it serves up the rhtml template instead
of the rjs template. Any idea why this is? I am using edge rails and the
latest
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
2009 Jan 04
3
Missing Template with edge Rails (2.3)
After freezing edge rails, all my controller examples are failing with
MissingTemplate errors.
e.g., "Missing template attachments/create.erb in view path app/views"
Trying to actually render the views gives me the same error.
I noticed I can fix most of them by using respond_do but I usually
never use it. I almost always only need to respond to one format in
one action so I omit
2009 Jan 11
2
Got an error on returning data as json format when the data is nil
Hi there,
One of my app''s actions returns data as a json format.
If the data exists, everything works perfect.
But if the data is nil, I get the following error.
--------------------------------
ActionView::MissingTemplate (Missing template user/show.erb in view
path /var/www/my_app/releases/20090110234348/app/views:):
2008 Mar 13
0
Template being ignored when attaching pdf in e-mail
The following code attaches my pdf with success. However, my e-mail
template is not being rendered in the e-mail. Any idea''s why my
template is ignored?
require ''pdf/writer''
class NotifierRequest < ActionMailer::Base
def inforequest(name, email, notice_request, message)
@subject = ''Notice''
@body = {:name => name, :email
2009 Jan 21
3
Nested serialization with to_json and to_xml with array and hash element
Title: Nested serialization with to_json and to_xml with array and
hash element
class Person < ActiveRecord::Base
has_one :address
has_one :job
def office()
return "Executive_Suite"
end
end
class Address < ActiveRecord::Base
belongs_to :person
end
class Job < ActiveRecord::Base
belongs_to :person
has_one :paygrade
def Title
return "Engineer"
end
end
2012 Jan 15
2
DEPRECATION WARNING: Passing a template handler in the template name is deprecated. (rspec + haml)
I upgraded a small project that I had created on 3.1.3 to 3.2.0.rc2.
Running rspec on it brings about a large amount of these messages:
DEPRECATION WARNING: Passing a template handler in the template name is
deprecated. You can simply remove the handler name or pass render :handlers
=> [:haml] instead. (called from block (2 levels) in <top (required)> at
2008 Nov 22
4
"syntax error, unexpected tIDENTIFIER , expecting kEND" in RJS response
I get a "syntax error, unexpected tIDENTIFIER, expecting kEND" when
the following RJS template is rendered:
page.insert_html :bottom, :requisite_table, :partial =>
"insert_jobrequisite_select", :locals => {:job => @job, :counter =>
@counter}
page.alert("hi")
The same RJS template is rendered without errors as soon as the rjs
file has only one single
2008 Feb 18
3
Displaying a base64-encoded image within an rhtml template
I''m working on generating FedEx labels for quick & easy shipping.
FedEx returns the label as a base64-encoded string. Assuming that
''match'' is the base64 string containing the label data, here is what I
have to display the image:
send_data image, :filename => ''fedex_shipping_label.png'', :type =>
''image/png'', :disposition
2007 Mar 20
0
ActionMailer template issues?
I''m using ActionMailer and it''s working fine when actually sending
mail. I have a TestEmailController whose job it is to render sample
versions of each email we send and show them in a browser for review
by QA & our creative teams.
Currently, I''m using the create_* method in ActionMailer, and then
trying render :text => email.part[1]. When I do this, the
2007 Jun 26
0
Best way to render KML files using RXML templates
I want to produce google maps KML files which are baiscally XML files
with a KML extention. I''m using restful routes and respond_to. The
best way I''ve found is to use
respond_to do |format|
format.kml { render :action => "kml" }
will render a kml.rxml template I have but really I want to have
action.rxml rendered for kml files.
Is there are way to acheive this,
2007 Jan 24
1
Removing empty class attribute from @template.content_tag
Hey all,
I have a quick question regarding the @template.content_tag methos when
creating a custom form builder.
Currently have the following method in my AccessibleBuilder class:
def datetime_select(field, options = {})
required = options.delete :required
label = options.delete :label
@template.content_tag("div",
@template.content_tag( "span", Example Label ) +
2007 Jun 03
5
can I use template to assemble a html page in an controller and redirect to another controller?
Hi,all!
I want to assemble a html page and put it into flash and redirect to
another controller ,for example:
flash[:aaa]="<html><body><div>hi</div></body></html>"
but what I need is to assemble some more complicate html page,so I
want to read the render result of a template before to send it to
browser.
Any thought?
Thanks in advance :-)
2007 Jan 03
0
`ActionController::Base#render :nothing => true` still whines about "missing template"
In FooController, I put method #bar whose only purpose is to run some
logic in the background and return a status 204 [1].
So in order to return only the 204 status code, I put at the end of
#bar:
`render :nothing => true, :status => 204`
But then when surfing to /foo/bar, I get an error about "missing
template bar.rhtml". Is this a bug?
(The solution eventually was `render
2008 Aug 08
2
template.expect_render fails when partial is rendered from a helper
My spec;
describe ''subnav rendering while logged in'' do
before do
template.stub!(:logged_in?).and_return(true)
template.stub!
(:current_profile).at_least(:once).and_return(mock_profile)
end
def do_render
render "/homepages/show.html.erb"
end
it "should render the logged in partial for homepages" do
2010 Jun 24
0
Rails3: render_to_string of a .html.erb when request is a json request raises MissingTemplate error
I''ve the following situation (which actually works in Rails 2.3.8 and
this is a result of the migration of our app to rails3):
I have a partial which is rendered a few times (imagine tr''s in a
table). On the clientside there''s a script that does a json request
for a specific row (jQuery + ajax dataType: ''json'' and type: ''POST'')
In
2008 Dec 14
2
custom REST action - template question
Hallo phorum,
i have custom rest action.
routes.rb:
map.resources :schools, :collection => { :graduations => :get }
SchoolsController:
def graduations
@schools = School.graduation(true)
end
link somewhere in navigation:
<%= link_to ''Schools with graduation'', graduations_schools_path %>
All works OK for me, but Rails needs (of course) a template for
controller
2006 Sep 26
0
Is it possible to render RXML partials in RHTML templates?
I have a RHTML template and I would like the output of a RXML partial to
be embedded within it.
When I do <%= render(:partial => ''list_edit'') %> where there exists a
_list_edit.rmxl file, I get XML parsing errors in the browser - I
believe because the partial is causing the rendered content to be
identified as XML instead of HTML.
Is there any way to