RailsCasts Pro episodes are now free!

Learn more or hide this

Alexander Zaytsev's Profile

GitHub User: AlexanderZaytsev

Site: https://twitter.com/AlexandrZaytsev

Comments by Alexander Zaytsev


Tip: to check if a value is set on a field, Rails provides you with methods that end with a question mark. So your price_in_dollars method will look like this:

  def price_in_dollars
    price_in_cents.to_d/100 if price_in_cents?

It's a small but neat change.

Also, speaking of prices, there is an excellent gem called money-rails for handling that: https://github.com/RubyMoney/money-rails


Thank you very much, Scott!

I had to add "libmagickwand-dev" as well to make it work.

Rubber seems to be a really great tool :)


Do you have experience with installing RMagick with Rubber on an instance? What is the best way to do it? I can simply ssh to the instance and install it manually, but it doesn't feel right.


You can use it this way:

%div{:data => {"pjax-container" => true}}

It is especially handy when you have several "data-" attributes, this way you don't have to repeat the "data-" part.