module Bhf::ActiveRecord::Base::ClassMethods
Public Instance Methods
bhf_attribute_method?(column_name)
click to toggle source
# File lib/bhf/active_record/base.rb, line 44 def bhf_attribute_method?(column_name) column_names.include?(column_name) end
bhf_default_search(search_params)
click to toggle source
# File lib/bhf/active_record/base.rb, line 26 def bhf_default_search(search_params) return where([]) if (search_term = search_params['text']).blank? where_statement = [] columns_hash.each_pair do |name, props| is_number = search_term.to_i.to_s == search_term || search_term.to_f.to_s == search_term if props.type == :string || props.type == :text where_statement << "LOWER(#{name}) LIKE LOWER('%#{search_term}%')" elsif props.type == :integer && is_number where_statement << "#{name} = #{search_term.to_i}" elsif props.type == :float && is_number where_statement << "#{name} = #{search_term.to_f}" end end where(where_statement.join(' OR ')) end
bhf_embedded?()
click to toggle source
# File lib/bhf/active_record/base.rb, line 52 def bhf_embedded? false end
bhf_primary_key()
click to toggle source
# File lib/bhf/active_record/base.rb, line 48 def bhf_primary_key primary_key end