Skip to content

Instantly share code, notes, and snippets.

View Kadaaran's full-sized avatar

Kassandre Pedro Kadaaran

View GitHub Profile
@Kadaaran
Kadaaran / Gemfile
Created June 16, 2020 21:05
Bundle parses Gemfile and don't throw a warning for unknown version.
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
ruby '2.6.2'
source 'https://rubygems.org'
gem 'bundler', '2.0.2'
gem 'webpacker', '~> 4.x'
@Kadaaran
Kadaaran / rspec_polymorphic.md
Last active July 3, 2018 16:33
RSPEC polymorphic examples (associations and factories.rb)

I struggled to find examples that match my needs, after a few research here's what I found, hope it can help you too.

Here's an example with three models which have belongs_to and has_many associations with two polymorphic models 🔥

class Quotation < ActiveRecord::Base
  belongs_to :ticket

  has_many :documents, as: :documentable
end

Keybase proof

I hereby claim:

  • I am kadaaran on github.
  • I am kassandre (https://keybase.io/kassandre) on keybase.
  • I have a public key ASAxSofodIYo-x7KTkO1OeDFi6cnInKgjf29xxUVqz3GCQo

To claim this, I am signing this object: