Last active
July 20, 2019 19:50
-
-
Save edwardloveall/1c87956a8c8761d1f637f54cec51886c to your computer and use it in GitHub Desktop.
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 Groups::Index < BrowserAction | |
route do | |
groups = GroupQuery.new.join_users | |
render Groups::IndexPage, groups: groups | |
end | |
end |
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 Group < BaseModel | |
table :groups do | |
column title : String | |
has_many users : User, through: :memberships | |
end | |
end |
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 Memebership < BaseModel | |
table :memeberships do | |
belongs_to group : Group | |
belongs_to user : User | |
end | |
end |
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 User < BaseModel | |
table :users do | |
# other columns | |
has_many groups : Group, through: :memberships | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment