Last active
August 29, 2015 14:00
-
-
Save thomasklemm/11166379 to your computer and use it in GitHub Desktop.
ActiveRecord without Rails, e.g. in a script
This file contains hidden or 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
require 'active_record' | |
ActiveRecord::Base.establish_connection( adapter: 'sqlite3', database: ":memory:" ) | |
ActiveRecord::Migration.verbose = false | |
ActiveRecord::Schema.define(version: 1) { create_table(:articles) { |t| t.string :title } } | |
class Article < ActiveRecord::Base; end | |
Article.create title: 'Quick brown fox' | |
Article.create title: 'Fast black dogs' | |
Article.create title: 'Swift green frogs' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Source: https://github.com/elasticsearch/elasticsearch-rails/blob/master/elasticsearch-model/README.md#usage