Creating a gem in lib folder

Go to lib folder and use bundler to generate main files for a gem:

$ bundle gem test_gem

      create  test_gem/Gemfile
      create  test_gem/Rakefile
      create  test_gem/LICENSE
      create  test_gem/README.md
      create  test_gem/.gitignore
      create  test_gem/test_gem.gemspec
      create  test_gem/lib/test_gem.rb
      create  test_gem/lib/test_gem/version.rb
Initializating git repo in /path/to/webapp/HouseTrip-Web-App/lib/test_gem

cd in to created directory

$ cd test_gem/

Bundle...

ActiveRecord::NamedScopes (2.3.x) obtaining the SQL conditions

It's a good pratice to chain several named scopes like:

Property.listable.for_2_or_more_guests.best_10_properties

Now, to make the lesson more valuable let's assume the following code:

Property.scoped(:conditions => "foo = 2").scoped(:conditions => "foo2 IS NOT NULL")

Next, if you want to be able to fetch the underlying conditions scope generated by ActiveRecord. You must do this:

Property.scoped(:conditions => "foo = 2").scoped(:conditions => "foo2 IS NOT NULL").scope(:find)
# => {:conditions => "(foo = 2) AND (foo2...

Git Branch naming

This is how we name branches :

  • <team>/<story>-<id> (features)
  • fix/<team>/<story>-<id> (bugs)

story is an dash-delimited version of the story name, and id the Pivotal story number.

Examples :

  • supply/belvilla-naming-1234567
  • fix/tripadvisor/property-syncing-3256674
  • integration/geo/boroughs