Skip to content

Instantly share code, notes, and snippets.

@glinesbdev
Forked from camkidman/card.rb
Last active April 24, 2017 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glinesbdev/5c1a58edc22bfc4030ba3d330bd5a454 to your computer and use it in GitHub Desktop.
Save glinesbdev/5c1a58edc22bfc4030ba3d330bd5a454 to your computer and use it in GitHub Desktop.
card = Card.first # as an example
card.card_set_id = CardSet.find_by(:name => card.set).id
card.save
# => ActiveRecord::RecordInvalid: Validation failed: Card set must exist
=> #<Card id: 1, card_id: "xy5-15", name: "Shroomish", national_pokedex_number: 285, image_url: "https://images.pokemontcg.io/xy5/15.png", image_url_hi_res: "https://images.pokemontcg.io/xy5/15_hires.png", subtype: "Basic", supertype: "Pokémon", evolves_from: nil, hp: "60", number: "15", artist: "Mizue", rarity: "Common", series: "XY", set: "Primal Clash", set_code: "xy5", text: nil, created_at: "2017-04-24 13:52:01", updated_at: "2017-04-24 13:52:01", card_set_id: nil>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment