Iterate over a .yml file's contents
07/01/17 Public, Rails General, Ruby General
Let's assume that the .yml
file (i.e. code_school.yml
) is located in this directory:
config/code_schools.yml
You'll grab the path to the file, and load its contents:
config = Rails.root + 'config/code_schools.yml'
...
1 vote - harrylevine
Comparing Different Ways to Set Attributes in ActiveRecord (Rails 4)
06/27/17 Public, Rails General
http://www.davidverhasselt.com/set-attributes-in-activerecord/
1 vote - harrylevine
Nested Rails Params Hash in a Form
06/11/17 Public, Rails General
When implementing a form object approach, you'll want to create a params
hash with nested areas for attributes for two different models.
Note the `manager...
1 vote - harrylevine
Creating form objects with ActiveModel
06/11/17 Public, Rails General
https://revs.runtime-revolution.com/creating-form-objects-with-activemodel-346e6c2abbf3
A superior alternative to `accepts_nested_attr...
1 vote - harrylevine
Sublime text - jump to top of tree
05/07/17 Public, Shortcuts
control + 0
focuses on the treecmd + up-arrow
jumps to the top of the tree1 vote - harrylevine
Shortened, one line version of a spec
04/25/17 Public, Testing / TDD
Here is the full syntax version of a spec:
it "returns no results" do
expect(results).to be_nil
end
Here is the same spec, in the shortened, one line version:
it { expect(results).to be_nil }
1 vote - harrylevine
Disable an ES lint rule - inline
04/24/17 Public, Other Languages
http://eslint.org/docs/user-guide/configuring#disabling-rules-with-inline-comments
The linting error I was receiving was:
Do not mutate state directly. Use setState()
Here is an example of applying the inline disabling of the r...
1 vote - harrylevine
Expand out html tags in React jsx files using Emmet
02/18/17 Public, Shortcuts
control + e
turns span.blah
into <span className="blah"></span>
1 vote - harrylevine
Shortcut for bringing up mission control in a Mac
01/16/17 Public, Shortcuts
control + up arrow
https://support.apple.com/en-us/HT204100
1 vote - harrylevine