Class: ProjectsController

Inherits:
ActionController::Base show all
Defined in:
lib/vendor/plugins/inherited_resources/test/respond_to_test.rb

Direct Known Subclasses

SuperProjectsController

Instance Attribute Summary

Attributes inherited from ActionController::Base

#formats

Instance Method Summary collapse

Methods inherited from ActionController::Base

clear_respond_to, inherit_resources, respond_to, #respond_to, #respond_with, #responder

Instance Method Details

#indexObject



25
26
27
# File 'lib/vendor/plugins/inherited_resources/test/respond_to_test.rb', line 25

def index
  respond_with(Project.new)
end

#respond_to_skip_default_templateObject

If the user request Mime::ALL and we have a template called action.html.erb, the html template should be rendered unless html is specified inside the block. This tests exactly this case.



48
49
50
51
52
# File 'lib/vendor/plugins/inherited_resources/test/respond_to_test.rb', line 48

def respond_to_skip_default_template
  respond_with(Project.new) do |format|
    format.html { render :text => 'Render HTML' }
  end
end

#respond_with_resourceObject



29
30
31
# File 'lib/vendor/plugins/inherited_resources/test/respond_to_test.rb', line 29

def respond_with_resource
  respond_with(Project.new)
end

#respond_with_resource_and_blocksObject



37
38
39
40
41
42
# File 'lib/vendor/plugins/inherited_resources/test/respond_to_test.rb', line 37

def respond_with_resource_and_blocks
  respond_with(Project.new) do |format|
    format.json { render :text => 'Render JSON' }
    format.rss  { render :text => 'Render RSS' }
  end
end

#respond_with_resource_and_optionsObject



33
34
35
# File 'lib/vendor/plugins/inherited_resources/test/respond_to_test.rb', line 33

def respond_with_resource_and_options
  respond_with(Project.new, :location => 'http://test.host/')
end