Class: Refinery::Resource
- Inherits:
-
Core::BaseModel
- Object
- ActiveRecord::Base
- Core::BaseModel
- Refinery::Resource
- Includes:
- Refinery::Resources::Validators
- Defined in:
- resources/app/models/refinery/resource.rb
Class Method Summary (collapse)
- + (Object) create_resources(params)
-
+ (Object) per_page(dialog = false)
How many resources per page should be displayed?.
Instance Method Summary (collapse)
-
- (Object) title
Returns a titleized version of the filename my_file.pdf returns My File.
-
- (Object) type_of_content
used for searching.
Class Method Details
+ (Object) create_resources(params)
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'resources/app/models/refinery/resource.rb', line 39 def create_resources(params) resources = [] unless params.present? and params[:file].is_a?(Array) resources << create(params) else params[:file].each do |resource| resources << create(:file => resource) end end resources end |
+ (Object) per_page(dialog = false)
How many resources per page should be displayed?
35 36 37 |
# File 'resources/app/models/refinery/resource.rb', line 35 def per_page(dialog = false) dialog ? Resources.pages_per_dialog : Resources.pages_per_admin_index end |
Instance Method Details
- (Object) title
Returns a titleized version of the filename my_file.pdf returns My File
29 30 31 |
# File 'resources/app/models/refinery/resource.rb', line 29 def title CGI::unescape(file_name.to_s).gsub(/\.\w+$/, '').titleize end |
- (Object) type_of_content
used for searching
23 24 25 |
# File 'resources/app/models/refinery/resource.rb', line 23 def type_of_content mime_type.split("/").join(" ") end |