I recently setup a Rails server on Ubuntu using Nginx and Unicorn and a database running on the same server using Postgres. I also used rbenv and ruby-build for ruby. I had to look up a lot of information to get this all working. I just wanted to consolidate everything I did into one place. Hopefully, all this can help someone else.
Continue reading Deploying A Rails App To Rackspace Cloud Servers On Ubuntu Using Nginx and Unicorn
I’m often thinking about things that I could code up that would make tasks simpler. Generally, that means that I spend a lot of time up front to write a tool that automates a task. Then, I slowly get that time back over time using the tool. But, it’s fun anyways. So, this is what I decided to automate. Continue reading A Simple Site To Automate Sending Texts/Emails
I say the query is less than simple because it’s not really complicated either. In my little application, I really only have one query that is like this and this is the one. This is the query that I wanted to run:
SELECT "envelopes".*, COALESCE(SUM("transactions"."amount"), 0) AS total_amount
FROM "envelopes" LEFT OUTER JOIN "transactions" ON "envelopes"."id" = "transactions"."envelope_id"
WHERE "envelopes"."user_id" = 3
GROUP BY "envelopes"."id", "envelopes"."name", "envelopes"."user_id", "envelopes"."income", "envelopes"."unassigned", "envelopes"."parent_envelope_id", "envelopes"."expense", "envelopes"."created_at", "envelopes"."updated_at"
ORDER BY "envelopes"."name"
Continue reading Constructing A Less Than Simple Query With Rails And ARel
In my last post, I talked about my envelopes budgeting project a little bit. Well, obviously, I need to display numbers as a currency. I found a convenient function in Rails where I could supply a number and it would format it nicely (eg. $50.12). However, I quickly noticed that negative numbers were formatted incorrectly (eg. $-50.12 instead of -$50.12). I did some searching on the internet and found others frustrated with that as well, so I just wrote my own function.
I left it for a while, but then I decided to see if I could contribute my solution to the Ruby on Rails source code. It was a fun process. I had to learn how to use Git a little more. I had to learn more about the way Rails works. But, I was finally able to submit a patch that was accepted and will be incorporated in version 3.0.2 of Rails.
Edit: It is now incorporated into Rails. You can see my change in the documentation here.
Continue reading I Contributed to An Open Source Project!

