The prefix used in render “foo” shortcuts.
# File lib/abstract_controller/rendering.rb, line 118 118: def _prefix 119: controller_path 120: end
Normalize arguments, options and then delegates render_to_body and sticks the result in self.response_body.
# File lib/abstract_controller/rendering.rb, line 91 91: def render(*args, &block) 92: self.response_body = render_to_string(*args, &block) 93: end
Raw rendering of a template to a Rack-compatible body. :api: plugin
# File lib/abstract_controller/rendering.rb, line 106 106: def render_to_body(options = {}) 107: _process_options(options) 108: _render_template(options) 109: end
Raw rendering of a template to a string. Just convert the results of render_to_body into a String. :api: plugin
# File lib/abstract_controller/rendering.rb, line 98 98: def render_to_string(*args, &block) 99: options = _normalize_args(*args, &block) 100: _normalize_options(options) 101: render_to_body(options) 102: end
An instance of a view class. The default view class is ActionView::Base
The view class must have the following methods: View.new[lookup_context, assigns, controller]
Create a new ActionView instance for a controller
View#render[options]
Returns String with the rendered template
Override this method in a module to change the default behavior.
# File lib/abstract_controller/rendering.rb, line 85 85: def view_context 86: view_context_class.new(lookup_context, view_assigns, self) 87: end
Normalize options by converting render “foo” to render :action => “foo” and render “foo/bar“ to render :file => “foo/bar“.
# File lib/abstract_controller/rendering.rb, line 137 137: def _normalize_args(action=nil, options={}) 138: case action 139: when NilClass 140: when Hash 141: options, action = action, nil 142: when String, Symbol 143: action = action.to_s 144: key = action.include?(//) ? :file : :action 145: options[key] = action 146: else 147: options.merge!(:partial => action) 148: end 149: 150: options 151: end
# File lib/abstract_controller/rendering.rb, line 153 153: def _normalize_options(options) 154: if options[:partial] == true 155: options[:partial] = action_name 156: end 157: 158: if (options.keys & [:partial, :file, :template]).empty? 159: options[:prefix] ||= _prefix 160: end 161: 162: options[:template] ||= (options[:action] || action_name).to_s 163: options 164: end
# File lib/abstract_controller/rendering.rb, line 166 166: def _process_options(options) 167: end
This method should return a hash with assigns. You can overwrite this configuration per controller. :api: public
# File lib/abstract_controller/rendering.rb, line 127 127: def view_assigns 128: hash = {} 129: variables = instance_variable_names 130: variables -= protected_instance_variables if respond_to?(:protected_instance_variables) 131: variables.each { |name| hash[name.to_s[1..1]] = instance_variable_get(name) } 132: hash 133: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.