Trying to implement an create if not exists else update record in Active Record.
Currently using:
@student = Student.where(:user_id
In Rails 4
Student. find_or_initialize_by(:user_id => current_user.id). update_attributes!(:department => 1)