$ rails g model User
belongs_to
has_one
stylus: | |
compress: true | |
path: ./path/to/styl |
# Migration generator shortcuts. | |
# rails generate migration MyNewMigration | |
# rails generate migration add_fieldname_to_tablename fieldname:string | |
# rails generate model Product name:string description:text | |
# The set of available column types [:string, :text, :integer, :float, :decimal, :datetime, :timestamp, :time, :date, :binary, :boolean] | |
# A migration is a subclass of ActiveRecord::Migration. You must implement the "up" and "down" (revert) methods. | |
# These are the handy methods available to a Migration: |
Originally published in June 2008
When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.
To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.
Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.
defmodule XmlNode do | |
require Record | |
Record.defrecord :xmlAttribute, Record.extract(:xmlAttribute, from_lib: "xmerl/include/xmerl.hrl") | |
Record.defrecord :xmlText, Record.extract(:xmlText, from_lib: "xmerl/include/xmerl.hrl") | |
def from_string(xml_string, options \\ [quiet: true]) do | |
{doc, []} = | |
xml_string | |
|> :binary.bin_to_list | |
|> :xmerl_scan.string(options) |
class Api::UploadsController < ApiController | |
def create | |
@upload = Upload.new(upload_params) | |
ensure | |
clean_tempfile | |
end | |
private |
See https://github.com/romainl/vim-rnb for an up-to-date version.
gem 'rails', '4.2.1' # prob works on others, too, but this is the one I figured it out on | |
require "rails" | |
require 'active_record' | |
require 'action_controller/railtie' | |
require 'action_view/railtie' | |
# ===== Configuration ===== | |
Rails.logger = ActiveRecord::Base.logger = Logger.new $stdout | |
ActiveSupport::LogSubscriber.colorize_logging = false |
module Shopify.Product.Model where | |
type alias Product = | |
{ created_at : String, | |
id : Int, | |
product_type : String, | |
published_at : String, | |
published_scope : String, | |
title : String, | |
updated_at : String, |
;; Enable ligatures without prettify-symbols | |
(provide 'add-pragmatapro-symbol-keywords) | |
(defconst pragmatapro-fontlock-keywords-alist | |
(mapcar (lambda (regex-char-pair) | |
`(,(car regex-char-pair) | |
(0 (prog1 () | |
(compose-region (match-beginning 1) | |
(match-end 1) |