Skip to content

Instantly share code, notes, and snippets.

View hugoerg56's full-sized avatar
Working!

Hugo Rincon hugoerg56

Working!
  • Barranquilla, Colombia
View GitHub Profile
@hugoerg56
hugoerg56 / db:schema:load
Created September 18, 2012 15:26
db:schema:load run
Hugo-Rincons-MacBook-Air:FeedMob hugo$ rake db:schema:load
-- create_table("order_statuses", {:force=>true})
NOTICE: CREATE TABLE will create implicit sequence "order_statuses_id_seq" for serial column "order_statuses.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "order_statuses_pkey" for table "order_statuses"
-> 0.0383s
-- create_table("orders", {:force=>true})
NOTICE: CREATE TABLE will create implicit sequence "orders_id_seq" for serial column "orders.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "orders_pkey" for table "orders"
-> 0.0074s
-- create_table("products", {:force=>true})
class User
after_create :create_relation
has_one :empresa
has_one :la_otra
def create_relation
kind == "empresa" ? create_empresa_relation : create_la_otra_relation
end
def create_empresa_relation
list_of_valid_states = ["Alava", "Albacete"....]
class OptionsValidator < ActiveModel::Validator
def validate(record)
unless list_of_valid_states.include?(record.state)
record.errors[:state] << 'This is not a valid state!'
end
end
end