This is a list of advanced JavaScript learning resources from people who responded to this [Tweet][13] and this [Tweet][20].
-
[You Don't Know JS][3]
-
[Frontend Masters courses by Kyle Simpson][12]
-
[@mpjme][6]'s [YouTube videos][5]
# Set up a param sanitizer to filter parameters using strong_parameters. See | |
# lib/devise/parameter_sanitizer.rb for more info. Override this | |
# method in your application controller to use your own parameter sanitizer. | |
def devise_parameter_sanitizer | |
@devise_parameter_sanitizer ||= Devise::ParameterSanitizer.new(resource_class, resource_name, params) | |
end |
1) see re: increasing shmmax http://stackoverflow.com/a/10629164/1283020 | |
2) add to postgresql.conf: | |
shared_preload_libraries = 'pg_stat_statements' # (change requires restart) | |
136 pg_stat_statements.max = 1000 | |
137 pg_stat_statements.track = all | |
3) restart postgres | |
4) check it out in psql |
user = User.create!(name: 'Akshay') | |
user.image.attach(io: File.open(Rails.root.join("public", "nature.jpeg")), filename: 'nature.jpg' , content_type: "image/jpg") | |
#(0.2ms) BEGIN | |
# SQL (0.4ms) INSERT INTO "active_storage_blobs" ("key", "filename", "content_type", "byte_size", "checksum", "created_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" [["key", "jd7L8dydnt11tXpsWWX9AXbw"], ["filename", "nature.jpg"], ["content_type", "image/jpg"], ["byte_size", 10055], ["checksum", "A5p01Zn3Rq3lG1gU8eji0w=="], ["created_at", "12:17:47.164687"]] | |
# (1.0ms) COMMIT | |
# (0.1ms) BEGIN | |
# SQL (0.3ms) INSERT INTO "active_storage_attachments" ("name", "record_gid", "blob_id", "created_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["name", "image"], ["record_gid", "gid://activestorage-demo/User/1"], ["blob_id", 2], ["created_at", "12:17:47.168074"]] | |
# (0.3ms) COMMIT |
➜ activestorage-demo git:(master) ✗ rails console | |
(erb):11:in `<main>': Cannot load `Rails.config.active_storage.service`: | |
undefined method `[]' for nil:NilClass (NoMethodError) | |
from /Users/akshay/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/erb.rb:896:in `eval' | |
from /Users/akshay/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/erb.rb:896:in `result' | |
from /Users/akshay/.rvm/gems/ruby-2.4.0/gems/activestorage-0.1/lib/active_storage/railtie.rb:37:in `block in <class:Engine>' | |
from /Users/akshay/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.2/lib/active_support/lazy_load_hooks.rb:43:in `execute_hook' |
test: | |
service: Disk | |
root: <%= Rails.root.join("tmp/storage") %> | |
local: | |
service: Disk | |
root: <%= Rails.root.join("storage") %> | |
amazon: | |
service: S3 |
class ActiveStorage::CreateTables < ActiveRecord::Migration[5.1] | |
def change | |
create_table :active_storage_blobs do |t| | |
t.string :key | |
t.string :filename | |
t.string :content_type | |
t.text :metadata | |
t.integer :byte_size | |
t.string :checksum | |
t.time :created_at |
default: &default | |
adapter: postgresql | |
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> | |
timeout: 5000 | |
development: | |
<<: *default | |
database: activestorage-demo-development | |
test: |
class User < ApplicationRecord | |
has_one_attached :image | |
end |
class CreateUsers < ActiveRecord::Migration[5.1] | |
def change | |
create_table :users do |t| | |
t.string :name | |
t.file :image | |
t.timestamps | |
end | |
end | |
end |