Skip to content

Instantly share code, notes, and snippets.

View danielolivaresd's full-sized avatar

Daniel Olivares danielolivaresd

View GitHub Profile
class Device
belongs_to :car
end
class Car
has_one :device
end
# Rails adds foreign key constraints automatically, so sometimes (not sure when exactly),
# when you try to +destroy+ a Car, it will complain with a PG::ForeignKeyViolation: ERROR: ...
@danielolivaresd
danielolivaresd / es.yml
Last active September 9, 2016 19:41
Rails i18n for accepts_nested_attributes_for (with has_many) using anchors
# Singular. This works for the following
# form_for @tree do |f|
# We can use an anchor (&tree) to have the values available
tree: &tree
name: Nombre
age: Edad
# Plural. This works for the following
# # forest.rb
# class Forest < ApplicationRecord
@danielolivaresd
danielolivaresd / gist:fbf0c05742870ee21810d55e7ba0b9c4
Last active July 16, 2017 03:11
Ionic Native new plugin testing workflow
npm i -g npm-install-peers
# in your local ionic-native fork
cd ionic-native
npm run build
cp -r dist/@ionic-native/plugin-name ../my-app/node_modules/@ionic-native/
cd dist/@ionic-native/plugin-name
npm-install-peers
npm link