Category Archives: Development

Ruby on Rails error – “Missing helper file”

We came across an odd error today and managed to find a fix for it so we thought it best to share the solution!

Later updates of Ruby on Rails will probably fix this as there’s a bug in the current versions. We think this is just an issue with Mac OSX but may be wrong.

We’re currently running OSX Yosemite with Ruby version 2.2.1p85 on Rails 4.2.1.

The issue first came up when running some RSPEC tests – it was saying that there was a missing helper file:

Missing helper file helpers//users/***/***/**/App_name/app/helpers/application_helper.rb_helper.rb (AbstractController::Helpers::MissingHelperError)

Very strange!

Anyway, we found the cause was how the capitalisation in the file path was handled in Ruby. Changing the above App_name from a capitalised initial to a lower case app_name fixed the error. Hopefully, the Ruby guys n’ gals will follow suit and fix the bug soon! There’s a thread on Github too.

Deprecated iOS methods

I had a bit of a problem today designing a nice tabbed UI for iPhone.

I wanted to manipulate the existing image on the tab bar to change its colour and to prevent iOS from changing its shading when selected/deselected. I was using an old stack of code from the ‘appearance’ delegate of UITabBarItem.

The solution was to generate a local variable for the existing icon image and to set the rendering mode:

UIImage *inboxImage = [[UIImage imageNamed:@"inbox"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

Then simply use this image on the TabBar after getting hold of it via the root controller:

UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
UITabBar *tabBar = tabBarController.tabBar;
UITabBarItem *tabInbox = [tabBar.items objectAtIndex:0];
[tabInbox setImage:inboxImage];

I hate coming across deprecated methods as the help documentation isn’t too hot. Stack Overflow is usually pretty good, though.