Skip to content

Instantly share code, notes, and snippets.

5.1 maps to CS169 v13 w6l2s1 (YT) 5.2 (Third-Party Auth) -- maps to CS169 v13 w6l2s3 (YT) 5.3 (Single Sign-On, OAuth) -- maps to CS169 v13 w6l2s5 (YT) 5.3 cont. (Associations & Foreign Keys) -- maps to CS169 v13 w6l2s6 (YT)

I believe these vids are available on YouTube.

Every model has an errors object that tracks errors on your object which is especially useful to see what validations failed and provide helpful messages (notices) to the user -- V5.1,5:00.

V5.1,7:06 Callbacks.

####expect{} vs expect()

I don't really understand procs.

####RSpec tagging Use tags to run only specific tests.

Command line -- bundle exec rspec --tag focus spec/features/tags_spec.rb Test -- note the :focus => true name:value pair. See documentation for details.

  • I'm looking at rake tasks such as rake db:create:all. I have no idea what that does, so I look at the databases.rake active_record file. Should I understand what's going on here? How would you approach trying to understand what this code does. Not only do you need to understand this code, but even more so, you have to dig around into other source code. Not sure where to start.

    • use -w
  • Rspec output

11:42:14 davemox@Daves-MacBook-Pro $ bundle exec rspec
F

Failures:
require 'json'
require 'faraday'
require 'faraday_middleware'
require 'hashie'
require 'pry'
class Github < Hash
include Hashie::Extensions::MethodAccess
end
  • How do I test POST and DELETE methods?
    • It looks like I can be added as an organizer to the meetup api group and test POST calls there?
  • There seems to be a lot of overlap in some of the GET methods (and maybe POST too, but I haven't looked). For instance, the /2/groups, /find/groups, and /recommended/groups have some very common functionality.

Design/Technical Considerations

  • Make comments or something explaining when to use which meetup api methods. Because the methods do overlap in their functionality it can be confusing knowing when to use which one.
  • Add in functionality to allow gem users access to the /batch method.
require 'json'
class RubyMeetup
def initialize(api_request_response)
# clean up the api response and set the @options_hash
@options_hash = prep_api_response(api_request_response)
# generate instance variables based on the hash keys in @options_hash
set_instance_vars(@options_hash)
# generate attr_accessor methods based on the hash keys in @options_hash

rake DB commands

rake db:migrate -- runs the migrations and then dumbs the structure of the database to db/schema.rb. rake db:test:prepare -- load the updated (from above rake db:migrate) schema into the test database.

Because rake db:migrate dumps the db structure into schema.rb, you can quickly restore the db using the rake db:schema:load task instead of running all the migrations all over again on a large project. See p143 of Rails 4 In Action.

rake db:test:prepare is similar to rake db:schema:load. It loads the schema into the test database making the fields available on the dev db also available on the test db.

rake db:test:clone is a combination of rake db:schema:dump and rake db:test:load. See this SO post.

My whole goal with these projects is to have exposure to as many new things as possible, while becoming a better Ruby developer (learning good software development principles and practices). So, I want to have some knowledge in a bunch of areas and much knowledge in Ruby (and secondarily, Rails).

Also, you know much more about what makes a good developer and what I need to know to land a junor dev job. So, if I'm barkin up the wrong tree here, by all means, suggest something else as a way to learn. Heck, maybe just contributing on github is a better idea. I'm all ears here.

And, I have a bunch of other project ideas I could use as learning tools so if the two below are no good, we can go back to the list.

Random thoughts:

  • I think I need to increase the velocity of my projects. Not sure what you think about the pivotal tracker stuff, but regardless, I need to learn to work faster. Not sure if my slow pace is a product of bei
~/Desktop/coding_resources/programs/banana_boat
23:32:27 davemox@Daves-MacBook-Pro $ bundle exec rake spec
/Users/davemox/.rvm/rubies/ruby-2.0.0-p353/bin/ruby -S rspec ./spec/mailers/notifications_spec.rb
Notifications
Email alert for new post
calling new_post_notification()
Date: Wed, 04 Dec 2013 23:32:37 -0500
From: banana-boat.herokuapp.com
To: emily@gmail.com,
require 'spec_helper'
describe Notifications do
describe 'Email alert for new post' do
# use Support folder and Module to define common functionality
# set the ActionMailer::Base.deliveries to [] after each spec.
# See 7:40 for how to include in tests.
before :each do
# use Factory Girl and Faker to create users.