Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

アプリケーションを作るときに考える25のこと

17,758 views

Published on

Rails Developers Meetup 2019
https://railsdm.github.io/

Published in: Technology
  • Be the first to comment

アプリケーションを作るときに考える25のこと

  1. 1. 
 

  2. 2. 😢
  3. 3. 
 

  4. 4.
  5. 5.
  6. 6. 
 

  7. 7. @pagy, @records = pagy(Product.some_scope) « First ‹ Prev ... 2 3 4 5 6 7 8 9 10 ... Next › Last »
  8. 8. class Article < AR::Base default_scope { Current.organization && where(organization: Current.organization) } end
  9. 9. 
 User.first # SELECT `users`.* FROM `users` ORDER BY `users`.`id` ASC LIMIT 1 User.kept.first # SELECT `users`.* FROM `users` WHERE `users`.`discarded_at` IS NULL
 ORDER BY `users`.`id` ASC LIMIT 1
  10. 10. 1. [http://example.com/](http://example.com/) 2. http://example.com/ 3. <http://example.com/>
  11. 11. 👍
  12. 12.
  13. 13. # (or ) changed? false u = User.create(name: "Taro") u.changed? #=> false # u.name = "Jiro" u.changed? #=> true u.changes #=> {"name"=>["Taro", "Jiro"]} # u.save! u.changed? #=> false u.changes #=> {}
  14. 14. class RequestStore def initialize(app) @app = app end def call(env) before = Thread.current[:_rack_request] Thread.current[:_rack_request] = Rack::Request.new(env) @app.call(env) ensure Thread.current[:_rack_request] = before end end
  15. 15. class User < ApplicationRecord before_save :store_changes def store_changes # Thread.current[:_rack_request] # console job rack end end

×