$ rails g model User
belongs_to
has_one
module RenderingHelper | |
# Override Rails' #render helper to fix an issue with it not honoring objects | |
# with #to_partial_path definitions that return absolute paths, which is | |
# problematic when rendering partials within a namespaced controller. | |
def render(options={}, locals={}, &block) | |
return super unless options.respond_to?(:to_partial_path) | |
object = options | |
path = object.to_partial_path |
class MoveAttachmentsToNewLocation < ActiveRecord::Migration | |
def initialize(name = self.class.name, version = nil) | |
access_key = Rails.application.secrets.g3_access_key_id | |
secret_key = Rails.application.secrets.g3_secret_access_key | |
storage = Fog::Storage::Google.new google_storage_access_key_id: access_key, | |
google_storage_secret_access_key: secret_key | |
@bucket_name = Rails.application.secrets.g3_bucket | |
@bucket = storage.directories.get(@bucket_name) | |
super(name, version) |
After automatically updating Postgres to 9.6.1 via Homebrew, the pg_ctl start command didn't work. | |
The error was something like "database files are incompatible with server". | |
Database files have to be updated before starting the server, here are the steps that had to be followed: | |
# need to have both 9.6.1 and latest 9.5.x installed, and keep 9.6.1 as default | |
brew unlink postgresql | |
brew install postgresql95 | |
brew unlink postgresql95 | |
brew link postgresql |
- Make sure you have configured git tools: see configuring tools.
- Make sure you have updated git aliases: see how to register aliases.
After each commit in our branch, in order to be up-to-date with the integration branch.
*.md diff=markdown |
This is a tool to find association paths between different models in a rails app.
Example output - the paths from Job to Invoice:
[3] pry(main)> G.from(Job).to(Invoice)
Job.active_fleet_managed_invoice_from_swoop -- Invoice
Job.invoice >- Invoice
Job.owning_company >- Company.fleet_managed_clients -- FleetCompany.end_user_invoices -< Invoice