Last active
December 31, 2015 14:29
-
-
Save TalkativeTree/8000502 to your computer and use it in GitHub Desktop.
models for an api that returns search results for terms from different search engines/apis.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SearchEngine < ActiveRecord::Base | |
has_and_belongs_to_many :terms | |
has_many :searches, through: :terms | |
end | |
class Term < ActiveRecord::Base | |
has_and_belongs_to_many :searches | |
has_and_belongs_to_many :searche_engines | |
end | |
class Result < ActiveRecord::Base | |
belongs_to :source | |
has_many :rankings | |
has_many :searches, through: :rankings | |
end | |
class Source < ActiveRecord::Base | |
has_many :results | |
end | |
class Ranking < ActiveRecord::Base | |
belongs_to :search | |
belongs_to :result | |
end | |
class Search < ActiveRecord::Base | |
has_many :rankings | |
has_many :results, through: :rankings | |
has_and_belongs_to_many :terms | |
has_many :search_engines, through :terms | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment