[Rails] Re: team captain - habtm w/has_one...

Michael Barinek barinek at gmail.com
Wed Jul 26 17:32:54 GMT 2006


i solved the above using the below...

def create
  @team = Team.new(params[:team])
  if @team.save
    flash[:notice] = 'Team was successfully created.'

    Membership.new(:user => @session['user'], :team => @team, 
:is_the_captain => true).save

    User.find(params[:membership][:user_ids]).each do |user|
      Membership.new(:user => user, :team => @team).save
    end


still seems strange...

thoughts/comments?

-- 
Posted via http://www.ruby-forum.com/.


More information about the Rails mailing list