lib/espresso/model.rb in espresso-0.0.8 vs lib/espresso/model.rb in espresso-0.0.9
- old
+ new
@@ -3,15 +3,11 @@
module Espresso
# @author Alexander Semyonov
module Model
def self.included(model)
model.extend ClassMethods
- model.class_eval do
- include InstanceMethods
-
- name_field(:name)
- end
+ model.send :include, InstanceMethods
end
module ClassMethods
# Paginates search results
#
@@ -39,14 +35,11 @@
end
# «NameField» is a main field, used to represent model in to_s method and in simple queries
# @param [Symbol, String] new_name_field new field name
# @return [Symbol] field name
- def name_field(new_name_field = nil)
- if new_name_field.present?
- @@name_field = new_name_field.to_sym
- end
- @@name_field
+ def name_field
+ :name
end
# Make a slug from object’s NameField
# @param [ActiveRecord::Base] object, which slug is making
# @return [String] slug