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
loopCode: https://github.com/talum/99bottles/commit/3120ccc3aa7d7227bc6fb1513bc770e4652aeb5d
Summary: "This chapter explores what it means to model abstractions and rely on messages; it considers the consequences of mutation and the perils of premature performance optimization." Sandi Metz, Katrina Owen. 99 Bottles of OOP (Kindle Locations 5107-5108).
On refactoring and chapter 4 changes: "The truth about refactoring is that it sometimes makes things worse, in which case your efforts serve gallantly to disprove an idea." Sandi Metz, Katrina Owen. 99 Bottles of OOP (Kindle Locations 5096-5097).