Skip to content

Instantly share code, notes, and snippets.

@rojotek
Created May 26, 2016 05:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rojotek/16c3834e97df6131623bccb10562bc96 to your computer and use it in GitHub Desktop.
Save rojotek/16c3834e97df6131623bccb10562bc96 to your computer and use it in GitHub Desktop.
Trailblazer Operations
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
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
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