-
Archives
- November 2019
- February 2018
- April 2017
- October 2015
- July 2015
- May 2015
- January 2015
- August 2014
- November 2013
- September 2013
- August 2013
- July 2013
- June 2013
- March 2013
- February 2013
- November 2012
- October 2012
- August 2012
- July 2012
- November 2011
- September 2011
- August 2011
- May 2011
- January 2011
- October 2010
- May 2010
- April 2010
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
-
Meta
Category Archives: Ruby
Passenger, RackBaseURI and the public folder
I’ve been installing passenger on my development PC so that I can debug an issue that is only apparent in production (it’s due to the app being hosted in a sub-uri). I don’t tend to use passenger much myself, as … Continue reading
Posted in Ruby
Comments Off on Passenger, RackBaseURI and the public folder
Using __LINE__ in dynamic methods
I’ve been digging into active_support to see how config_accessor was working. This is the code I found: def config_accessor(*names) options = names.extract_options! names.each do |name| … Continue reading
Posted in Ruby
Comments Off on Using __LINE__ in dynamic methods
Securing your api keys
A Rails app often has to connect to other services via an api key. For example, if you want users to be able to log in via their google credentials. One problem this raises is how to secure these api … Continue reading
Posted in Ruby
Comments Off on Securing your api keys
Sorting with has_many :through and acts_as_list
I’m currently working on a questionnaire system which has two main objects: Question and Questionnaire. I had been associating them using has_and_belongs_to_many, but a new requirement means that I now need to be able to define a question order within … Continue reading
Posted in Ruby
Comments Off on Sorting with has_many :through and acts_as_list
Using json data outside the original JavaScript function
I’ve been working on a Reckoner that helps people calculate some figures. I started by hard coding some threshold figures into the JavaScript while I worked on most of the functionality. However, once that was done, I needed to modify … Continue reading
Posted in JavaScript, Ruby
Comments Off on Using json data outside the original JavaScript function
Simple local only mail
I’m working on an application that needs to send notifications via email, and I want to be able to test it in the development environment. In the past, I’ve either been able to set up a small Windows mail server … Continue reading
Posted in Ruby
Comments Off on Simple local only mail
Disclaimer gem
I was chatting with a colleague who has asked me to build an app, and I was struggling to get to the root of what he wanted. After the chat, I had a little think about the problem, and realised … Continue reading
Posted in Ruby
Comments Off on Disclaimer gem
Playing with exceptions
I’ve just been having a little play with exceptions, as a new colleague wanted to understand how different errors could be handled. There is a good description of how they work in the “Exceptions, Catch, and Throw” chapter of the … Continue reading
Posted in Ruby
Comments Off on Playing with exceptions
TreeDecorator
On a couple of my projects, I’ve wanted a dynamic tree representation of a group of objects. acts_as_nested_set and it variants (such as awesome_nested_set) work well for creating the back-end structure. There are plenty of JavaScript libraries that will help … Continue reading
Posted in Ruby
Comments Off on TreeDecorator
Rails database user
Another project, another database connection via root user with no password. This is so sloppy. It is so easy to create a project specific user in any database. If this was done more often, I wouldn’t be for ever changing … Continue reading
Posted in Ruby
Comments Off on Rails database user