I want to take the current Profile that's set under User and move it to the front of the ordered list. Is there a way to do this in a model scope, or even a specific query?
class Profile
belongs_to :profileable, polymorphic: true
end
class User
has_many :profiles, as: :profileable, dependent: :destroy
# current_profile :integer
end
# This is the desired effect
profiles = current_user.profiles.to_a.delete_if {|i| i.id == current_user.current_profile}.unshift Profile.find(current_user.current_profile)