A (more) complete cheatsheet for Arel, including NamedFunction functions, raw SQL and window functions.
posts = Arel::Table.new(:posts)
posts = Post.arel_table # ActiveRecord
This gist will collect 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
This list is based on aliases_spec.rb.
You can see also Module: RSpec::Matchers API.
matcher | aliased to | description |
---|---|---|
a_truthy_value | be_truthy | a truthy value |
a_falsey_value | be_falsey | a falsey value |
be_falsy | be_falsey | be falsy |
a_falsy_value | be_falsey | a falsy value |
wget https://storage.googleapis.com/golang/go1.10.1.linux-armv6l.tar.gz | |
sudo tar -C /usr/local -xvf go1.10.1.linux-armv6l.tar.gz | |
cat >> ~/.bashrc << 'EOF' | |
export GOPATH=$HOME/go | |
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin | |
EOF | |
source ~/.bashrc |
require 'aws/s3' # gem name is 'aws-sdk' | |
class BucketSyncService | |
attr_reader :from_bucket, :to_bucket, :logger | |
attr_accessor :debug | |
DEFAULT_ACL = :public_read | |
# from_credentials and to_credentials are both hashes with these keys: | |
# * :aws_access_key_id |
defmodule MyApp.Auth do | |
import Comeonin.Bcrypt, only: [checkpw: 2, dummy_checkpw: 0] | |
alias MyApp.Accounts.User | |
alias MyApp.Repo | |
def login(conn, user) do | |
conn | |
|> Guardian.Plug.sign_in(user) | |
end |
rabbitmqctl add_user test test | |
rabbitmqctl set_user_tags test administrator | |
rabbitmqctl set_permissions -p / test ".*" ".*" ".*" |
1. Change rails version in Gemfile | |
> gem 'rails', '~> 5.1', '>= 5.1.4' | |
2. Remove Gemfile.lock | |
> git rm Gemfile.lock | |
3. Run bundle install command | |
> bundle install --jobs=5 | |
4. Run rails' app update to apply changes to app |
require 'cucumber' | |
require 'selenium-webdriver' | |
# require 'cukehub' # optional, but recommended. See cukehub.com for more details | |
caps = Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions: { binary: "/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary", | |
args: [ "--headless" ]}) | |
Before do | |
@browser = Selenium::WebDriver.for :chrome, desired_capabilities: caps | |
end |
require 'cucumber' | |
require 'selenium-webdriver' | |
# require 'cukehub' # optional, but recommended. See cukehub.com for more details | |
caps = Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions: { binary: "/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary", | |
args: [ "--headless" ]}) | |
Before do | |
@browser = Selenium::WebDriver.for :chrome, desired_capabilities: caps | |
end |