i have a method in my rails module, this is my module
module Searchable
extend ActiveSupport::Concern
included do
include Elasticsearch::Model
include Elasticsearch::Model::Callbacks
index_name Rails.application.class.parent_name.underscore
puts Rails.application.class.parent_name.underscore
document_type self.name.downcase
# you get an error if this shit run first
module ClassMethods
def setting_index(arguments)
settings index: {number_of_shards: 1} do
... more code ...
btw. when i'am trying to execute this method(setting_index) at first time i got an error.
but then when i'am trying to execute again this error is gone..
can anyone solve this and give me a clear answer... thanks for your concern :)
require 'active_support/concern'
module Callable
extend ActiveSupport::Concern
include Elasticsearch::Model
include Elasticsearch::Model::Callbacks
included do
end
module ClassMethods
def setting_index(arguments)
settings index: {number_of_shards: 1} do
... more code ...
end
end
I think you need to put included module outside included do block.