Class: Interchange::DataSetsController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- ApplicationController
- BaseController
- Interchange::DataSetsController
- Defined in:
- app/controllers/interchange/data_sets_controller.rb
Instance Method Summary collapse
-
#initialize ⇒ DataSetsController
constructor
A new instance of DataSetsController.
-
#render_show_template_to_string(data_set, options = {}) ⇒ Object
Returns a DataSet’s JSON representation as a string.
-
#show ⇒ Object
Shows a data set’s JSON representation in the browser.
- #super_render_show_template_to_string ⇒ Object
- #super_show ⇒ Object
Constructor Details
#initialize ⇒ DataSetsController
Returns a new instance of DataSetsController.
7 8 9 10 |
# File 'app/controllers/interchange/data_sets_controller.rb', line 7 def initialize super @model_class = DataSet end |
Instance Method Details
#render_show_template_to_string(data_set, options = {}) ⇒ Object
Returns a DataSet’s JSON representation as a string.
We setup the instance variables that the rendered template would need for the given data set. We then return the result of generating a pretty JSON representation of the data set, by calling our superclass variant of this method.
33 34 35 36 |
# File 'app/controllers/interchange/data_sets_controller.rb', line 33 def render_show_template_to_string(data_set, ={}) @data_set = data_set super_render_show_template_to_string() end |
#show ⇒ Object
Shows a data set’s JSON representation in the browser.
16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/interchange/data_sets_controller.rb', line 16 def show # Find the data set and set the @data_set variable, which the jbuilder template will look for: @data_set = DataSet.find(params[:id]) # Alias the @data_set variable to @model, which our superclass' implementation needs: @model = @data_set # Invoke the superclass implementation to do the rendering work: super_show end |
#super_render_show_template_to_string ⇒ Object
3 |
# File 'app/controllers/interchange/data_sets_controller.rb', line 3 alias :super_render_show_template_to_string :render_show_template_to_string |
#super_show ⇒ Object
4 |
# File 'app/controllers/interchange/data_sets_controller.rb', line 4 alias :super_show :show |