As a Rails developer, you’ll almost certainly need to do some unobtrusive Javascript in your applications - in fact, if you use Rails’ jquery-ujs gem, it’s almost encouraged! Without writing any script yourself at all, you can have a form button that disables itself with a message while the form is submitted by simply constructing your button like so: <%=...
Ransack is one of my go-to Rubygems, especially for admin applications. It provides a really simple interface to building up complex filtering and ‘searching’ of many records. Check out the README for more information about how it all works - this post covers a specific problem case of Ransack. In Rails, we are often subtely educated that the ID of...
This Rails helper allows simple parsing of params that have originated from ActionView’s date_select helper method into a Date or DateTime object in a consistent and clean way.
Last Friday, I headed off to Railscamp NZ with one guy from work, 8 cans of V, and a bag of carrots (my snack food of choice). Today it’s Wednesday, I’ve still got 8 cans of V, a few less carrots, one open-source application that I’m actually happy with (and Travis CI and CodeClimate say is pretty well put together),...
As a web developer, I’ve got a pretty good pick of websites - I know what companies are prepared to stick with tried and tested technologies, and combine it with just enough new stuff to make browsing their site pleasant and easy to do. Every now and then though, I’m forced out of my comfort zone, and need to find...
It’s not at all uncommon to be asked by a client “So, I’d really like to be able to edit that bit of the page just there - can we do that?”. The answer, of course, is yes, but managing content has no end of complexities. Just one of these many is publishing - that is, controlling content, where it...
On the Spot is a pet project that I tend to develop with bleeding-edge features in mind - something a bit more volatile than Latter, which is used heavily enough to justify a more cautious development process. In this post, I’m going to detail how I added HTML5 notifications to On the Spot, the upsides and downsides, and the Coffeescript...
Ever needed to store some secrets in Rails that you don’t want to share with the world? Yeah, same! In this post, I’m going to outline a really simple way to store your application’s secrets in a file called config/secrets.yml. Rails configuration and you First of all, let’s discuss exactly how this is going to work. If you’ve even configured...
I’ll be the first to admit that I’m not that great at design, especially typography and detailed elements. I’m just one of those people who can see what they want in their heads just fine, but something just goes…wrong…between the head and the page. In this post, I’m going to explain some of the lessons I learned while focussing on...
Often in the Rails projects I build, I have a need to store configuration that I don’t really want to have in my code. The most obvious way to do this is to either store the configuration in a YAML file (e.g. config/settings.yml), or in environment variables. Foreman is Heroku’s answer to these types of configuration challenges. It is used...