I'm the only certified rails developer in Georgia ™
Only Certified Rails Developer In Georgia is a registered trademark of Brown Web Design, Inc. representing internal standards of quality assessment and
service control. The protocol is not administered by government or
industry regulatory agencies and does not imply regulatory approval of
Brown Web Design Services
Ok wait, I'll explain...
My wife Patty got some kind of free essential oil sample in the mail the
other day. It had some fancy phrases all over the packaging like,
Certified Pure Therapeutic Grade.
Patty didn't know what it was or what it was used for so she starting
Goggling it and came across a website that sort of exposed this
company and their claims. It turns out that Certified Pure Therapeutic
Grade is actually just a registered trademark of the company and has
nothing do with the quality of the product. It's a marketing phrase
I know companies make all kind of false claims and weave the truth
between and around regulations, but this is the first I've heard of
trademarking a phrase in this way.
No wonder social media is such a strong influencer of buying decisions.
People know they cannot trust a company's own claims, so they rely on
someone they know who has experienced the product or service.
So, should I trademark only certified rails developer in Georgia? :)
Today I was working on a client project that was using a has and belongs
to many (habtm) relationship, but there was only 1 model involved. This
part of the application was setup by previous developer and was the
source (I believed) of a bug in our API that was my job to fix. Since I
didn't setup the relationship, I started investigating how it worked and
what I found was pretty interesting so I wanted to share it. I'm going
to change the model name just to avoid explaining the context and give
you an example.
class Product < ActiveRecord::Base
We want to use a join table so we can create related products for a
product. The problem is, habtm is setup to work between two models. For
class Course < ActiveRecord::Base
class Student < ActiveRecord::Base
# join table : courses_students
# fields: course_id | student_id
So what does the join table look like for our tricky one model example?
class Product < ActiveRecord::Base
# join table: products_related_products
# fields: product_id | related_product_id
This looks pretty good so far. Write your table migration and give it a
class CreateProducts < ActiveRecord::Migration
create_table :products do |t|
create_table :products_related_products, id: false do |t|
Fire up the console:
> product = Product.create(name: "ball")
> related_proudct = Product.create(name: "bat")
> product.related_products << related_product
NameError: uninitialized constant Product::RelatedProduct
Ok, you could have probably guessed this wouldn't work. How does rails
know how to relate a related product?
It turns out you can specify the setup of the relationship. Let's give
it some guidelines:
class Product < ActiveRecord::Base
Back to the console:
> product.related_products << related_product
(0.1ms) begin transaction
SQL (0.3ms) INSERT INTO "products_related_products" ("product_id", "related_product_id") VALUES (?, ?) [["product_id", 1], ["related_product_id", 2]]
=> #<ActiveRecord::Associations::CollectionProxy [#<Product id: 2, name: "bat", created_at: "2014-09-18 02:01:17", updated_at: "2014-09-18 02:01:17">]>
Ok, great, it works. But...upon inspection of the sql I got this:
=> "SELECT \"products\".\* FROM \"products\" INNER JOIN
\"products_related_products\" ON \"products\".\"id\" =
\"products_related_products\".\"product_id\" = ?"
Wait, does that look right?
ON products.id =
products_related_products.related_product_id? Shouldn't we be joining
the table on
products.id = products_related_products.product_id
I thought maybe they had the
association_foreign_key reversed at first,
but here's what made it click for me. When you call
what do you want returned? You want
Product objects that are related.
You're returning the related products. So that's why it makes sense
to join on
products.id = products_related_products.related_product_id
This is a pretty specific post, but I hope to help someone needing to
has_and_belongs_to_many on a single model and gets confused
about what is the
foreign_key versus the
With my acutal bug, the keys were reversed. Which you might guess,
doesn't actually matter when when you use rails to call the
relationship. However, our API was using a different sql method to
fetch the related records and it returnd a bad result.
I recently took on a challenge to write a blog post for every day of the
week for 30 straight week days. At the beginning of this year I had a
goal to write more. I started off writing a couple of posts per week,
but eventually faded to 1 per month. I probably don't have 30 blog posts
for the whole year, so how will I ever do 30 straight?
Well, so far I haven't found it too terribly difficult. For this post, I
wanted to briefly explain how I get from idea to published.
Once you know that you have to write that day and you know you need an
idea, they seem to start rolling in left and right. What experience do
you want to share, what did you find interesting, helpful, what problem
did you face, etc. The key is capturing all of these ideas and thoughts
as they arise. I mostly use Evernote to capture these things. I
create a tag called "blog idea" and tag each note with it. Evernote is
good for this because, you can pretty much capture anything: urls,
emails, photos, pdf's, voice memos, and just regular notes. Then once
you capture this media, be sure to jot down exactly what you're thinking
about when you have the idea. I've created plenty of notes that I opened
later and wouldn't have a clue what I was thinking when I wrote it.
Sometimes, if I'm at my computer, I go ahead and start the post, or at
least jot down the outline for it. Voice memos are great for when you
cannot write -- driving down the road, exercising, etc.
I typically take a coffee break at 3.00PM or so each day and while I'm
sipping on my coffee, I do the Pomodor Technique (spend 25 minutes
of extreme focus) to write out a blog post. I usually don't worry too
much about details (spelling, grammar, etc) I just want to get the rough
Review & Publishing
Either later that evening or first thing in the morning I'll review the
post. It's amazing how letting a little time go by and letting the words
sit will bring clarity to the article. I'll usually spend 10-25 more
minutes rearranging and getting it ready to publish.
Once I publish the article, I'll share it through Buffer so it'll
post to all my social accounts. Then I'll try to think of a person,
group, or organization that might benefit from my writing. For example,
if it's a Ruby topic, I'll send it to Ruby Weekly or just
recently my accounting article was shared as a guest post on the
LessAccounting blog. This has been a great way for me to gain so
readers and help folks at the same time.
I hope that helps! Happy Writing!
One of my favorite creative / techonolgy magazines is Offscreen.
They have a feature that I've seen in every issue called A Day In The
It's a collection of several featured artists that describes what a
typical day looks like for them. The artists aren't necessarily popular
or famous, although some of them do work at high profile companies
(Google, Facebook, etc), but for some reason I find it really
interesting to read through. It must also be interesting for others too
since it continues to be in the magazine.
So here, I'm officially submitting my chronicle: A day in the life
of Jess Brown
Independent Web Developer, Monroe, GA
6.00AM -- Things start early here. But, first things first...my wife is
nudging me out of the bed to start coffee.
6.15AM -- I work from home, so a quick walk up the stairs to my office
places me at my desk. I lead a Bible study group once a week, so I
begin the day in prayer, thought, and then begin preparation for the
6.45AM -- I check my email, calendar and moleskin to review the
tasks/projects for the day. I typically come up with an idea of when and
how I'll work on each project.
7.00AM -- Time to wake the kids up for school. I have a 3 and 7 year
old. I get them dressed and fed while mom gets herself ready.
8.00AM -- Mom and kids head off to school, while I head out on my bike.
Today I have planned what's usually a typical ride of around 2hrs.
Exercise is an important part of starting the day off right for me.
10.15AM -- After a shower and a small snack, I'm back at my desk tackling
the plan I laid out earlier that morning. Today I'm monitoring the
relaunch of a client's app. They provide exercise programs for
university courses, and since most universities are on semester systems,
30-40% of annual sales will come in this week. We just upgraded to a new
server environment, so everyone is anxious to see how it handles the
1.00PM -- Aside from a few little tweaks, the new servers are handling
the load just fine. Since things seem under control, I'll grab a bite to
eat with my wife downstairs. We're pretty health conscious about what we
eat, so we end up cooking quite a bit, which means leftovers are usually
the only item on the menu.
1.30PM -- I'm back at my desk and am on a conference call with my
client. We discuss how things are progressing and discuss a few features
to implement that could make ordering a little easier for students. I
also work on set of other features that have been scheduled to be
integrated in the application.
3.30PM -- Time for an afternoon coffee break. Today I'll use my
AreoPress and try out a new recipe I found. While I'm brewing, my
kids get home from school so I get to give them hugs and chat with them
a few minutes before heading back to my office with coffee.
3.45PM -- I like to use my coffee time to either learn something new
(reading a book or article, following a tutorial, etc) or writing. Today
I'll be writing on my blog. Writing, and especially teaching through
writing is really rewarding.
4.15PM -- Back to finish up the latter part of the workday. I'm
completing a few features I started earlier and after all my tests
show passing, I deploy to production.
6.00PM -- I head down stairs to start dinner. There are no church or
school meetings or meetups tonight, so I get to relax spending time with
my family. Cooking, cleanup, and getting the kids in and out of showers
take up the bulk of the evening (kids are hard work :).
8.30PM -- We have story time every night with the kids. Right now, we're
reading our second Sammy Keys book called Sammy Keyes and the Hotel
Thief. The adults even like this one!
9.00PM -- It's lights out for the kids. I sit in my older son's room
while my wife is in the other. I have my laptop out, quietly checking
email and studying up on a new project.
9.30PM -- My wife and I get to spend a little time to ourselves. Tonight
we're watching TV and we're currently in the middle of a really good
Netflix series called The Killing.
10.30PM -- We're heading to bed and I wind down by reading a fiction
novel I'm about halfway through called Battlefield Earth (it's much
better than the movie).
11.00PM -- ZZZ
After hearing about Apple Pay the other day, as a developer who
implements payment services through software, I was curious about what it
might could offer myself and my clients. Here are some questions I had
and what I found about about them.
Who's it for?
Two groups: the consumer and the business.
The consumer, anyone who has and iPhone 6 or Apple Watch. I originally
envisioned Buy buttons on websites, but it's only for people who have
iPhone6 or the Apple Watch.
Businesses who have retail or mobile apps. If a business has a
retail store that already accepts credit cards with the scan and go
technology, then they'll likely be able to accept Apple Pay.
Or, if you're a business with a mobile iOS app, then you can use Apple
Pay to accept payment for any purchases within the app.
How's it work?
On the consumer side, you store credit cards in your passport. When
you're ready to checkout, you choose a card and hit pay.
On the business retail side, Apple makes use of NFC-enabled credit card
readers. Apparently Google Wallet already does this.
On the mobile app side, developers will likely still go through an
existing payment processor like Stripe or Authorize.net.
Apple won't store any of the credit card numbers, but will work with the
payment processors to store tokens and will randomly update them. This
is similar to how Stripe works now with web applications. We send the
credit card number to Stripe, then Stripe sends the appliction back a
token, and then the application can use the token to make
purchases in the future.
When does it get started?
It appears Apple Pay will get started in October. Apple has been working
behind the scenes to preapre the payment processors, build partnerships
with banks and get retail (220k) stores on board.