Event has_and_belongs_to_many :users
User  has_and_belongs_to_many :events

Im trying to verify that user doesnt signup more than one time


  def signup
    @event = Event.find(params[:id])
  @user = current_user
    respond_to do |format|
      if @event.users.find(@user) != @user.id
    @user.events << @event
        format.html { redirect_to(@event, :notice => 'You where
successfully Signed Up.') }
        format.xml  { head :ok }
      else
        format.html { redirect_to(@event, :notice => 'You where already
Signed Up.') }
        format.xml  { head :ok }
      end
    end
  end

but i think that's no ok, i get this message, when the user havent
signed up:

Couldn't find User with ID=2 [WHERE ("events_users".event_id = 7 )]

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