Update model.rb for Rails 4