A common Ruby/Rails idiom used in views looks like the following: <% if @posts.empty? -%> There are no posts. <% else -%> <ul> <%= render :partial => 'post', :collection => @posts -%> </ul> <% end -%>
In my app a User can create a Business. When they trigger the index action in my BusinessesController I want to check if a Business is related to the current_user.id: If yes: display the business. If no: redirect to the new action. I was trying to use this: if Business.where(:user_id => current_user.id) == nil # no business found end But it always returns true even when the business doesn't exist.
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く