module Zobi::InstanceMethods
Public Instance Methods
collection()
click to toggle source
# File lib/zobi.rb, line 45 def collection return @collection if @collection c = zobi_resource_class BEHAVIORS.each do |behavior| next unless self.class.behavior_included?(behavior) c = send :"#{behavior}_collection", c end @collection = (c.is_a?(Class) ? c.all : c) end
collection_path()
click to toggle source
# File lib/zobi.rb, line 55 def collection_path url_for controller: zobi_resource_key.pluralize, action: :index end
edit_resource_path(r)
click to toggle source
# File lib/zobi.rb, line 63 def edit_resource_path r url_for controller: zobi_resource_key.pluralize, action: :edit, id: r.id end
new_resource_path()
click to toggle source
# File lib/zobi.rb, line 59 def new_resource_path url_for controller: zobi_resource_key.pluralize, action: :new end
resource_path(r)
click to toggle source
# File lib/zobi.rb, line 67 def resource_path r url_for controller: zobi_resource_key.pluralize, action: :show, id: r.id end
zobi_resource_class()
click to toggle source
# File lib/zobi.rb, line 30 def zobi_resource_class @_zobi_resource_class ||= zobi_resource_name.classify.constantize end
Also aliased as: resource_class
zobi_resource_key()
click to toggle source
# File lib/zobi.rb, line 40 def zobi_resource_key @_zobi_resource_key ||= zobi_resource_name.underscore end
Also aliased as: resource_key
zobi_resource_name()
click to toggle source
# File lib/zobi.rb, line 35 def zobi_resource_name @_zobi_resource_name ||= self.class.to_s.demodulize.gsub(/Controller$/, '').singularize end
Also aliased as: resource_name