app/models/feature.rb in usman-0.3.33 vs app/models/feature.rb in usman-0.3.34
- old
+ new
@@ -1,27 +1,39 @@
class Feature < Usman::ApplicationRecord
+ # Constants
+ FEATURE_ICONS = {
+ "Dhatu::Product" => "fa-square",
+ "Dhatu::Service" => "fa-glass",
+ "Dhatu::Project" => "fa-rocket",
+ "Dhatu::BlogPost" => "fa-newspaper-o",
+ "Dhatu::Price" => "fa-dollar"
+ }
+
# Including the State Machine Methods
include Publishable
# Associations
has_many :permissions
has_many :users, through: :permissions
- # has_one :feature_image, :as => :imageable, :dependent => :destroy, :class_name => "Image::FeatureImage"
-
+ has_one :cover_image, :as => :imageable, :dependent => :destroy, :class_name => "Image::CoverImage"
+
# Validations
validates :name, presence: true, length: {minimum: 3, maximum: 250}
+
+
+
# ------------------
# Class Methods
# ------------------
# return an active record relation object with the search query in its where clause
# Return the ActiveRecord::Relation object
# == Examples
# >>> feature.search(query)
# => ActiveRecord::Relation object
- scope :search, lambda {|query| where("LOWER(name) LIKE LOWER('%#{query}%')")
+ scope :search, lambda {|query| where("LOWER(name) LIKE LOWER('%#{query.singularize}%')")
}
scope :categorisable, -> { where(categorisable: true) }
def self.save_row_data(hsh)
\ No newline at end of file