Created
May 26, 2016 05:51
-
-
Save rojotek/16c3834e97df6131623bccb10562bc96 to your computer and use it in GitHub Desktop.
Trailblazer Operations
This file contains hidden or 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 Member::Index < Trailblazer::Operation | |
attr_reader :members | |
def process(params) | |
office = Office::Show.(params.merge(id: params[:office_id])).office | |
@members = office.office_members | |
end | |
end | |
# more stuff that extends from Member::Index |
This file contains hidden or 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 Office::Index < Trailblazer::Operation | |
attr_reader :offices | |
def process(params) | |
@offices = Office.for_member(params[:member_id]) | |
end | |
end | |
# couple of extra simple operations |
This file contains hidden or 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
require 'member/operation' | |
class Testimonial::Index < Member::Show | |
attr_reader :testimonials | |
def process(params) | |
super(params.merge(id: params[:member_id])) | |
@testimonials = Testimonial.all_for_member_office(member.memberid, params[:office_id]) | |
end | |
end | |
# couple of extra simple operations |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment