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:
ruby
defprice_in_dollars
price_in_cents.to_d/100if price_in_cents?
end
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.
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:
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-railsThank 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:
It is especially handy when you have several "data-" attributes, this way you don't have to repeat the "data-" part.