Last active
August 29, 2015 14:14
-
-
Save baothi/72c63fbb9b8b4675188e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CreateTacos < ActiveRecord::Migration | |
def self.up | |
create_table :tacos do |t| | |
t.string :name | |
t.text :ingredients | |
t.timestamps null: false | |
end | |
end | |
def self.down | |
drop_table :tacos | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bin/spring stop | |
Spring stopped. | |
[Elasticsearch]$ rails c | |
Loading development environment (Rails 4.2.0) | |
2.1.2 :001 > TacosIndex | |
=> TacosIndex | |
2.1.2 :002 > TacosIndex::Taco | |
=> TacosIndex::Taco | |
2.1.2 :003 > TacosIndex::Taco.import(Taco.all) | |
Faraday::ConnectionFailed: Connection refused - connect(2) for "localhost" port 9200 | |
from /home/thinb/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/net/http.rb:879:in `initialize' | |
from /home/thinb/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/net/http.rb:879:in `open' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Taco < ActiveRecord::Base | |
update_index('tacos#taco') { self } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TacosIndex < Chewy::Index | |
define_type Taco do | |
field :name, :ingredients | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment