diff --git a/app/models/bandango.rb b/app/models/bandango.rb index 3d750e8..04a2b42 100644 --- a/app/models/bandango.rb +++ b/app/models/bandango.rb @@ -20,5 +20,6 @@ class Bandango < ActiveRecord::Base # relationships belongs_to :business has_many :transacciones + has_many :connections, class_name: BandangoConnection end diff --git a/app/models/bandango_connection.rb b/app/models/bandango_connection.rb new file mode 100644 index 0000000..b9be5ec --- /dev/null +++ b/app/models/bandango_connection.rb @@ -0,0 +1,19 @@ +# == Schema Information +# +# Table name: bandango_connections +# +# id :integer not null, primary key +# bandango_id :integer not null +# transacciones_sent :text +# created_at :datetime +# + +class BandangoConnection < ActiveRecord::Base + +# relationships + belongs_to :bandango + +# serializations + serialize :transacciones_sent, Array + +end diff --git a/db/migrate/20140115175237_create_bandango_connections.rb b/db/migrate/20140115175237_create_bandango_connections.rb new file mode 100644 index 0000000..d70162b --- /dev/null +++ b/db/migrate/20140115175237_create_bandango_connections.rb @@ -0,0 +1,10 @@ +class CreateBandangoConnections < ActiveRecord::Migration + def change + create_table :bandango_connections do |t| + t.references :bandango, null: false + t.text :transacciones_sent + t.datetime :created_at + end + add_index :bandango_connections, :bandango_id + end +end diff --git a/db/schema.rb b/db/schema.rb index 604f350..437d399 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,15 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140114054938) do +ActiveRecord::Schema.define(version: 20140115175237) do + + create_table "bandango_connections", force: true do |t| + t.integer "bandango_id", null: false + t.text "transacciones_sent" + t.datetime "created_at" + end + + add_index "bandango_connections", ["bandango_id"], name: "index_bandango_connections_on_bandango_id", using: :btree create_table "bandangos", force: true do |t| t.integer "business_id", null: false