yoones / rails-has_many-through-view

Rails has_many through multiple models (using SQL View)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

POC goal

This proof-of-concept shows one way to create a has_many through relationship through multiple models.

This answers a question I asked on stackoverflow: (https://stackoverflow.com/questions/49284439/activerecord-has-many-through-two-models/)

Selected solution

Create a UNION SQL view and use it to link projects and investors.

Steps

Rspec

I wrote specs only for Project model to ensure the relationship works properly.

About

Rails has_many through multiple models (using SQL View)

License:MIT License


Languages

Language:Ruby 73.3%Language:HTML 19.8%Language:CSS 3.9%Language:JavaScript 1.8%Language:CoffeeScript 1.3%