Rails 4

Updated AR impl for rails 4.1