Displaying 20 results from an estimated 100000 matches similar to: "respond_to for unknown type"
2008 Apr 20
1
Why is respond_to always rending the RXML view?
I''m having a problem in Rails 2 where respond_to is always rendering the
RXML view even in the HTML rendering response. Can anyone tell me why
this might be happening? Here''s a code snippet:
respond_to do |accepts|
accepts.html
accepts.xml { render :action => ''show.rxml'', :layout => false}
end
If I change this to the following it works fine:
2007 Jan 20
0
Best way to force a respond_to format
I am playing around with the idea of adding to the HTTP_ACCEPT header
method and trying to utilize WURFL for detecting mobile devices by
USER_AGENT instead. I''m thinking I will set up some kind of
before_filter in my controller, to intercept all requests and compare
the USER_AGENT to some data source.
If I detect that the USER_AGENT is a mobile device, then I''d like to
force a
2007 Nov 26
1
transition form respond_to to provides
I really like the new mime type handler however I was trying to convert some
code and couldn''t figure out how.
My rails action was handle 2 formats, html and xml
respond_to do |format|
format.html # show.html.erb
format.xml do
if @account.active? && @account.valid_referer?(session[:referer])
render :xml => @account.to_xml(:except
2007 Apr 10
0
Change in default xml, rjs respond_to templates that Rails looks for on edge Rails
Not sure if this is the right avenue to discuss this but I couldn''t
find anywhere to ask this question on Rails Trac.
Regarding this latest changeset:
http://dev.rubyonrails.org/changeset/6507 (Change default respond_to
templates for xml and rjs formats.)
Does anyone know the rationale behind it? I can imagine there would be
an announcement in the future about this backward
2006 Jun 28
2
respond_to and Accept headers
After reading:
<http://www.loudthinking.com/arc/000572.html>
I''m trying to experiment with respond_to in order to not repeat myself
and create atom feeds out of a "browse" view.
In application controller I created a before filter that checks for the
extension of the current url and changes the accept header:
[code]
def check_headers
@headers["Accept"]
2008 Jan 16
0
respond_to, mime types and excel
Hello All,
I''m trying to figure out how respond_to actually works, especially with
the increased focus on REST.
After I set a MIME type for Excel
Mime::Type.register "application/vnd.ms-excel", :xls
In my index action''s respond_to block
I have format.xls {
@parts = Part.find(:all)
headers[''Content-Type''] =
2007 Apr 26
2
assert_select with respond_to JS or xhr?
Hi everyone,
I am a bit confused with xhr? and respond_to.
I have the folloing code in my view to update the ''emails'' ID
link_to_remote(image_tag("refresh"), :update => "emails",
:url => { :action => "list_emails" })
in the controller side i have somthing like :
[..]
respond_to do |type|
type.html { render :action
2008 Jul 29
0
handling multiple lookup tables in rails
I''ve got an application that will have a handful of lookup tables. To
be clear by this I mean tables that only have two attributes, id, name
and are used to provide drop-down lists for other tables/forms so that
these fields have "standard" values. I need 5 to 10 of these tables.
I''m a ruby/rails neophyte but I''ve read Agile Web Devel with
Rails, Rails
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
2006 Jun 24
5
request.xhr? vs. respond_to
Searched around this forum, but didn''t find an answer for this question.
Can you help this newbie understand any overlap and/or difference
between request.xhr? and respond_to?
If request.xhr? is true, should I expect it wants.js below?
respond_to do |wants|
wants.html { redirect_to(person_list_url) }
wants.js
wants.xml { render :xml => @person.to_xml(:include
2007 Dec 22
3
collection_select validation problem
I''m trying to assign a parent foreign key value using
collection_select from my child "new" form. The problem I''m having is
if I do not make a selection, I get the following error instead of the
Rails validates_presence_of error:
You have a nil object when you didn''t expect it!
You might have expected an instance of Array.
The error occurred while evaluating
2007 Sep 20
11
Proposed API change for respond_to
Ez (or someone) asked on #merb tonight whether respond_to was the
right API for
what it does. After some discussion and pasties, I offer the
following proposed
API for content negotiation and response format selection:
First, what does respond_to do right now? I see at as performing 3
distinct
operations:
1. parse params[:format] and the accepts header to find out what
format the
2009 Jul 27
3
render syntax has me stumped
Hi,From within an action called manager within a controller called
storedorders, I want to render to the view for the manger action of
controller orders.
It really seems like the following syntax should work:
(within the StoredordersController manager method...)
respond_to do |format|
format.html {render :controller => ''orders'', :action =>
2007 Nov 19
2
Help with controller and view
I have the following models
class Recipe < ActiveRecord::Base
has_many :ingredient_recipes
has_many :ingredients, :through => :ingredient_recipes
end
class IngredientRecipe < ActiveRecord::Base
belongs_to :ingredient
belongs_to :recipe
end
class Ingredient < ActiveRecord::Base
has_many :ingredient_recipes
has_many :recipes, :through => :ingredient_recipes
2006 Jun 08
0
custom mime types for respond_to
Is there a way to add a mime type of my own to respond_to ?
There''s html, xml, js, ical etc ...
But I want to be able to respond_to Excel.
Excel has the following content-type header:
application/vnd.ms-excel
I want to use the new ?format=xml querystring parameters that respond_to
can respond to.
So I want to pass in ?format=xsl or ?format=ms-excel so that I can
return my results
2007 Dec 21
1
Princely - Prince XML PDF Wrapper Plugin
Recently I was implementing PDF generation for a project utilizing the
fantastic library Prince XML (http://www.princexml.com). I came across
a blog article with a basic library and helper set for Prince (http://
sublog.subimage.com/articles/2007/05/29/html-css-to-pdf-using-ruby-on-
rails), which provided a great basis. I wanted to make something a
little more generalized and in-keeping the Rails
2007 Apr 04
0
error occurred while evaluating nil.accepts
I have an index method with a respond_to block that produces this
error:
NoMethodError (You have a nil object when you didn''t expect it!
The error occurred while evaluating nil.accepts):
The show method has the same respond_to block but doesn''t error out.
If I take the respond_to block out of the index method, it works.
If I give index params[:keywords] I get this error:
2008 Jan 18
3
Please help
Hello all,
I have developed a RESTFul webservice in RoR. Here under is the controller
---------------------------------------------------------------------------------------------------------
class PeopleController < ApplicationController
def index
list
render :action => ''list''
end
# GETs should be safe (see
http://www.w3.org/2001/tag/doc/whenToUseGet.html)
2008 Dec 11
1
help needed regaring Acts As Taggable On Steroids
Hello,
In my rails application, I have a book model.
I want to add tags. For that I have installed
acts_as_taggable_on_steroids from this link
http://agilewebdevelopment.com/plugins/acts_as_taggable_on_steroids
and do as the readme file.
This is my Model :
class Book < ActiveRecord::Base
acts_as_taggable
end
Here is my ApplicationHelper :
module
2006 Aug 30
10
respond_to not detecting JS turned on. form_to_remote problem?
I''m trying to use respond_to to redirect visitors who have JS turned off to a different page. The problem I''m having is that respond_to is sending *everybody* there. It''s not recognizing that JS is turned on in the browser. The wanted_html.rhtml file below is rendered whether I''ve got JS turned on or off. I''ve looked at the Accept headers being sent