put logic into rails app