This gist will collects all issues we solved with Rails 5.2 and Webpacker
# Last few parameters(--skip-* part) is only my habbit not actully required
$ rails new <project_name> --webpack=stimulus --database=postgresql --skip-coffee --skip-test
AllCops: | |
Exclude: | |
- db/schema.rb | |
Style/Documentation: | |
Description: 'Missing top-level class documentation comment.' | |
Enabled: false | |
# confict IfUnlessModifier https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/IfUnlessModifier | |
Style/GuardClause: |
const wechatBrowser = () => { | |
return navigator.userAgent.toLowerCase().includes('micromessenger') | |
} | |
export { wechatBrowser } |
This gist will collects all issues we solved with Rails 5.2 and Webpacker
# Last few parameters(--skip-* part) is only my habbit not actully required
$ rails new <project_name> --webpack=stimulus --database=postgresql --skip-coffee --skip-test
module Arel::Predications | |
def any(right) | |
Arel::Nodes::Any.new(self, quoted_node(right)) | |
end | |
end | |
class Arel::Nodes::Any < Arel::Nodes::Binary | |
def operator | |
:'ANY' | |
end |
# app/config/initializers/arel.rb | |
require 'arel/nodes/binary' | |
require 'arel/predications' | |
require 'arel/visitors/postgresql' | |
module Arel | |
class Nodes::ContainsArray < Arel::Nodes::Binary | |
def operator | |
:"@>" |
I've been doing some work lately with JSON documents in PostgreSQL using jsonb
columns. You can query these documents
using a GIN index in PG, but the syntax can be a little cumbersome
SELECT "events".* FROM "events" WHERE "events"."body" @> '{"shift":{"user_id":2}}'
You have to construct the right side of the query as a JSON string, which is a bit annoying. So I wondered if I could adapt Arel to do the tedious stuff for me.
module Commands | |
module Meeting | |
AcceptSchema = Dry::Validation.Schema do | |
required(:user_id).filled | |
required(:status).value(eql?: :scheduled) | |
end | |
class Accept < Command | |
def call | |
return validate if validate.failure? |
http://www.oreilly.com/programming/free/files/microservices-for-java-developers.pdf
http://www.oreilly.com/programming/free/files/microservices-for-java-developers.epub
http://www.oreilly.com/programming/free/files/microservices-for-java-developers.mobi
http://www.oreilly.com/programming/free/files/modern-java-ee-design-patterns.pdf
http://www.oreilly.com/programming/free/files/modern-java-ee-design-patterns.epub
http://www.oreilly.com/programming/free/files/modern-java-ee-design-patterns.mobi
upstream rails_servers { | |
server unix:///opt/app/www.yoursite.com/shared/sockets/puma.sock fail_timeout=0; | |
} | |
server { | |
server_name www.yoursite.com; | |
location /cable { | |
proxy_redirect off; | |
proxy_set_header Host $host; |
bundle exec puma start -C config/puma.rb |