title: Defining Boolean Method Ruby Beginner
body: <p>Back again with a Boolean method definition question for beginners.   </p>
  
  <p>Here is the method I'd like to write:  </p>
  
  <pre><code>def has_booth?
  end 
  </code></pre>
  
  <p>I'm not quite sure what to pass as the argument.  I want this to return true for users that have created a booth and false for those that haven't.  Booths are associated with a user id and each user can has_one booth. Booths also have a name parameter.    </p>
  
  <p>I tried things like </p>
  
  <pre><code>booth.id.nil?
  </code></pre>
  
  <p>and </p>
  
  <pre><code>booth_id.nil?
  </code></pre>
  
  <p>and</p>
  
  <pre><code>booth.name.nil?
  </code></pre>
  
  <p>and </p>
  
  <pre><code>booth.name != nil
  </code></pre>
  
  <p>and</p>
  
  <pre><code>if current_user
        if session[:booth_id]
  </code></pre>
  
  <p>Can you please guide me as to what I'm doing incorrectly or point me towards some literature?  I have seen a bunch of tutorials for creating simple methods that have simple arguments and return or puts something on a screen, but nothing that seems to help me move the needle.  I'd like to do this as correctly as possible.  </p>
  
  <p>If it is helpful, here is my booths controller:</p>
  
  <pre><code>class BoothsController &lt; ApplicationController
    before_action :logged_in_user
  
    def index
      @booths = Booth.all
    end
  
    def new
      @booth = Booth.new
    end
  
    def create
      @booth = current_user.build_booth(booth_params)
      if @booth.save
        flash[:success] = "Congrats on opening your booth!"
        redirect_to root_url
      else
        render 'new'
      end
    end
  
    def show
      @user = User.find(params[:id])
      @booth = Booth.find(params[:id])
    end
  
    private
  
      def booth_params
        params.require(:booth).permit(:name)
      end
  end
  </code></pre>
  
  <p>I appreciate any help or guidance towards a solution.  Thanks!</p>