connection the whole universe of things we need to know about the user's request (a struct, map with known set of fields)
connection
|> endpoint
|> router
|> browser_pipeline
|> UsersController
file = "#{Rails.root}/tmp/#{Date.current}-cpb-admissions-list.csv" | |
CSV.open(file, 'w') do |csv| | |
csv << ["name", "hubspot_link", "enrollment program", "payment plan", "enrollment status", "salesforce contact link", "admission decision"] | |
CpbApplication.all.joins(:user).order(reviewed_at: :desc).each do |cpb_application| | |
cpb_presenter = CpbApplicationReviewPresenter.new(cpb_application) | |
csv << [cpb_presenter.name, cpb_presenter.hubspot_profile_link, cpb_presenter.enrollment_program, cpb_presenter.enrollment_payment_plan, cpb_presenter.enrollment_status, cpb_presenter.salesforce_contact_link, cpb_application.user.program_admissions.where(program_id: 'community_powered_bootcamp').first.try(:status)] | |
end | |
end |
lol |
phoenix.gen.html
phoenix.gen.json
"At the end of the day, it ends up adding complexity to the framework—and, indirectly, to your application—only to save a few keystrokes every once in a while. " (p.93)
ex) mix phoenix.gen.html Video videos user_id:references:users url:string title:string description:text
This strategy works because Ecto defines something called the queryable protocol. from receives a queryable, and you can use any queryable as a base for a new query.
(p. 112)receive
loopclass DeployCodeChallenge | |
attr_reader :git_source_url, :deployable_task, :deployer, :assignees, :errors | |
attr_accessor :deployed_repo_url | |
def initialize(git_source_url:, deployable_task:, deployer:, assignees:) | |
@git_source_url = git_source_url | |
@deployable_task = deployable_task | |
@deployer = to_deploying_user(deployer) | |
@assignees = to_github_collaborators(assignees) | |
@errors = [] |