CapnRegex
2010-Oct-04 22:36 UTC
problem with ActionController.add_renderer :txt and respond_with
the code.. Mime::Type.register "text/plain", :txt ActionController.add_renderer :txt do |object, options| self.content_type ||= Mime::TXT self.response_body = object.inspect end class Goal < ActiveRecord::Base def to_s name end end class GoalsController < ApplicationController respond_to :html, :xml, :json, :yaml, :txt # GET /goals # GET /goals.xml def index @goals = Goal.all respond_with @goals end # GET /goals/1 # GET /goals/1.xml def show @goal = Goal.find(params[:id]) respond_with @goal end class GoalsController < ApplicationController respond_to :html, :xml, :json, :yaml, :txt def index @goals = Goal.all respond_with @goals end def show @goal = Goal.find(params[:id]) respond_with @goal end ... end results in.. Template is missing Missing template goals/show with {:formats=>[:txt], :handlers=>[:rjs, :rhtml, :rxml, :erb, :builder], :locale=>[:en, :en]} in view paths "/home/rob/machine/app/views", "/home/rob/machine/vendor/ plugins/min_max_attribute/app/views", "/home/rob/machine/vendor/ plugins/map_attribute/app/views", "/home/rob/machine/vendor/plugins/ lib_ifit/app/views", "/home/rob/machine/vendor/plugins/dynamic_form/ app/views", "/home/rob/machine/vendor/plugins/attribute_bitmask/app/ views", "/home/rob/machine/vendor/plugins/acts_as_nested_set/app/ views", "/var/lib/gems/1.8/gems/devise-1.1.2/app/views" so, how do I get this to work? the :yaml example works... -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.