YARD CHEATSHEET http://yardoc.org
cribbed from http://pastebin.com/xgzeAmBn
Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.
# Use a prefix for the index names that Tire uses so that the test suite doesn't | |
# stomp on dev data and you can work on multiple apps with ES, but keep tidy | |
# unadorned names for production. | |
unless Rails.env.production? | |
Tire::Model::Search.index_prefix("#{Rails.application.class.parent_name.downcase}_#{Rails.env}") | |
end |
cribbed from http://pastebin.com/xgzeAmBn
Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.
Let’s see how to use PostgreSQL to import and export CSV files painlessly with the COPY
command.
Import CSV into table t_words
:
COPY t_words FROM '/path/to/file.csv' DELIMITER ',' CSV;
You can tell quote char with QUOTE
and change delimiter with DELIMITER
.
%Plug.Conn{ | |
adapter: {Plug.Adapters.Cowboy.Conn, :...}, | |
assigns: %{ | |
my_assigns: "here" | |
}, | |
before_send: [ | |
#Function<7.125546534/1 in Phoenix.Controller.fetch_flash/2>, | |
#Function<1.127904613/1 in Plug.Session.before_send/2>, | |
#Function<1.43511252/1 in Plug.Logger.call/2>, | |
#Function<0.70322810/1 in Phoenix.LiveReloader.before_send_inject_reloader/1> |
# I submitted a bug report https://github.com/rails/rails/issues/34244 | |
# b/c Rails was not honouring my `rescue_from` block which was causing my API to | |
# be inconsistent. I was told this is expected behaviour. I think it's probably | |
# fine for an HTML app where you control the form inputs. But for an API app, | |
# the API is public facing and very important, so Rails shouldn't have its own | |
# special errors that bypass my app's configuration and make my API inconsistent. | |
# | |
# Decided it shouldn't be too difficult to handle this myself. So, here is my | |
# solution. It contains most of the important lessons I've learned about how to | |
# get a Rails API app setup. It removes Rails' params parsing and adds its own. |