When it comes to working with a mix of values or variables, and I want to treat them as an array, I am in the habit of using the Array(...)
method to make sure I am always working with an array, without having to explicitly check for a nil or non-array values. What this method does is that it tries to call first #to_ary
, then #to_a
on the passed argument.
I recently went about cleaning up some of my earlier “syntax mistakes” in a Ruby project of mine. So what do I mean by syntax mistake? It is a term I use to define something that works perfectly fine, but leaves you with that feeling of “shouldn’t there be a nicer way of writing this?”. I think you know the feeling.
Elastic Beanstalk is great! It is very easy to get a Rails app up and running on AWS quickly. Perfect for an app developer that prefers not to deal directly with sysops but still wants to deploy to and leverage the services on AWS.
When the need arise to SSH into your EB instance and execute a command in your app, you might run into issues. I describe in an earlier post how to trigger a restart of DelayedJob after each deployment. In that particular case, one issue was that the command was not running under the correct ruby installation. Turns out that we can make use of EB’s own support scripts to help us out.
I recently moved one of the Rails applications that I manage, from Engineyard to Elastic Beanstalk on Amazon AWS. All in all, it ended up taking a little bit longer than I expected. To get the webapp up and running was not the big issue, but all the things around it, like third party dependencies and background workers, etc.
I feel like I have been neglecting my own site for far too long. It really was time to change the layout of it to match the expectations of recent web layout standards. For a while now, everyone has been talking about responsive design and mobile first. So I figured it was time to apply it here as well.
This is not gonna be any news for a lot of people out there, but I recently discovered the beauty of the git command stash
. And even though I feel a little embarrassed about the fact that I did not discover it earlier, I decided to post a quick note about it.
One method that I frequently use in Rails is the find_or_create_by_*
method ( If you can call it one method since it comes in so many variations ). As it implies, this method will try to find a record from one or many attributes and create it if it does not find it. But like so many other functions, it has undergone some changes along the way.
I recently wanted to implement a drag and drop browser upload to one of my existing Rails applications. Even though it was not difficult, it felt quite rewarding once it was working (because I don’t like the classic upload forms). So I decided to share the solution for anyone who wants to do something similar.
According to this BBC News article, the online retailer Kogan.com has started with an added tax for the users who are still browsing there site with IE7.
I have been using Vagrant for a while now. Overall I am very satisfied with the simplicity of it and the way it can standardize environments when it comes to collaborating with others. In my bigger projects I usually setup a Vagrantfile.example
with all the default settings that I commit to the git repository and then I add an exception for the Vagrantfile itself to allow for personal customization if that would be needed.
This is a guide on how to get up and running with Node.js on Mac OS X. The purpose of this tutorial is to be a reference post for other tutorials because when you have done it once, then you will probably not need to do it again. So I feel it’s unnecessary to include it all the time. Plus, it’s probably very basic for most of you.
There has been a lot of buzz within the community lately about upcoming releases of Ruby implementations to mobile devices and I am no less excited than anybody else. Anything that would get me away from that freakin’ Objective-C is welcome.
The Node.js module called express has now released its 3.0.0a version. For me, express is one of the packages that I always use in my node projects. It’s so easy to get up and running with it and there are tons of examples and tutorials (many outdated unfortunately) from where you can get answers and inspiration.
I have been playing around with Node.js on and off now for quite some time. And one thing that have bothered me is the simple fact that I had to restart the node server process every time I made the slightest changes to any server side code. Normally I would have given up much earlier and start looking for a way to get around it. But since I never really stuck with Node for any longer period of time, I never got to it.
This release offers some cool updates. It’s clear that everybody is concerned about what happened at GitHub a while back, when someone managed to access everybodys ssh keys by using mass-assignment to change his permission. So it’s nice to see that the Rails community is addressing this. I really like that the auto-generated ActiveRecord models have been updated to show the importance of attr_accessible. Since a lot of people who are using rails can be fairly new to developing. For some it might even be the first thing the try. So unless they understand the risks, they might end up with an application with some serious security risks.
Yehuda Katz has started a KickStarter project were he explains his plans to develop an .app for Mac OS X that will be used to quickly get up and running with Rails. He mentions how it used to be (in the good old days) and goes on to describe what this project will accomplish. The pledge goal for the project is set to $25,000.