Refactoring Rails into Service Objects

One of the things that I dislike about Rails is how some actions feel untestable. Take, for example, the act of grabbing the current user. This is bog-standard code that you’d see in a lot of Rails tutorials and people’s codebases. What I don’t like about it is that the current_user method is not easily testable. Heck, which test file do you put the tests in? ...

October 28, 2013 · 3 min · 529 words · Scott Brown

Adding Font Awesome to your project manually instead of via a gem

Font Awesome is truly a work of art. Those guys should be charging for this product, but I am grateful that they are not. Today was the day that I finally got fed up using the font-awesome-rails gem. On Rails 3 it was excellent and it was just a bundle install away, but with Rails 4 it just stopped working. Others have had issues with it and their response was that it was a sass-rails problem, and not theirs. Every time I used their gem with a Rails 4 project I would manually patch their gem to make it a proper SCSS file font-awesome.css.scss instead of using the old style font-awesome.css.erb that they use. However, whenever they release a new version of their gem mine stopped working until I patched it again. ...

August 6, 2013 · 2 min · 335 words · Scott Brown