i know that it's a bad idea to fetch the current_user in a model. I also know that there is a way to do it (with Thread). But, i don't want to do it this way(it's certainly a bad idea), so i would like to have an opinion on achieving this a different way.
A user can create a clan, and upon creating it, he has to be the leader. The Clan model is :
class Clan < ActiveRecord::Base
after_create :assign_leader
# the person who created the clan is the leader
def assign_leader
self.clan_memberships << ClanMembership.new(:user_id => ???, :role => 'leader')
end
end
I know i can just create the membership in the controller. However, i like that filters act as transactions and i would very much prefer a filter for this. But, is there really a correct, non 'hackerish' way of doing that here ?