Fix conditions for Rails