When you run haml from command line, it has no knowledge about your controller. set_input method was never called and therefore @images instance variable was never set (so it's nil). It looks like you are trying to use HAML in Rails context sou you should actually perform a request to you local server that will call the controller, which will set @images variable and then render HAML view.