Sha256: 14445c7c1703f7cd2e8b9d4075e6127f5d2335676fa39d1e8b6d31648da73b1b
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
module AppFrame::ResourcesHelper def collection? !!collection rescue NameError false end def resource? !!resource rescue NameError, ActiveRecord::RecordNotFound false end def resource_name if resource_class resource_class.model_name.human else controller_name end end def parent? controller.respond_to?(:parent?) && controller.send(:parent?) end def parent_resource_class parent.class end def parent_resource_name parent_resource_class.model_name.human end def namespaced(string) if controller_namespaces.any? File.join(controller_namespaces, string) else string end end def resource_class_path_array result = controller_namespaces result << parent if parent? result << resource_class end def resource_path_array result = controller_namespaces result << parent if parent? result << resource end def parent_collection_url return unless parent? result = controller_namespaces result << parent_resource_name.underscore.pluralize polymorphic_url(result) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
app_frame-0.6.1 | app/helpers/app_frame/resources_helper.rb |