2017-03-28 23 views
0

可見的Pin list頁面應該是每個人都看得見,但他只對登錄用戶可見,對相同New Pin。這是爲什麼發生?我的代碼有問題嗎?頁面應該是大家

<li><%= link_to 'Home Page' , root_path %></li> 
<li><%= link_to 'about' , home_about_path %></li> 
<li><%= link_to 'Pin list' , pins_path %></li> 

<% if user_signed_in? %> 

<li><%= link_to 'New Pin' , new_pin_path %></li> 

<% else %> 

<li><%= link_to "sign in" , new_user_session_path %></li> 
<li><%= link_to "sign up" , new_user_registration_path %></li> 

編輯:

before_action :set_pin, only: [:show, :edit, :update, :destroy] 
    before_action :authenticate_user!, exept: [:index, :show] 
    before_action :correct_user, only: [:edit, :update, :destroy] 
+0

用'<%除非current_user.blank? %>'和/或驗證'before_filter:authenticate_user!'是否在你的'ApplicationController'中。 –

+0

發佈你的控制器代碼和你的「user_signed_in?」方法。 – bkunzi01

+0

「Pin列表頁面應該對每個人都可見,並且只對登錄的用戶可見」 - 你是什麼意思?那沒有意義。 – max

回答

2

你拼錯 「除」。你有「免除」。這應該夠了吧。

+0

Ruby故障不像Java那樣突出錯誤,謝謝! – forschool

相關問題