2012-05-24 2 views
0

현재 보이는 레코드와 비슷한 태그를 가진 모든 레코드를 찾으려고합니다. 내 컨트롤러가있다 : (사람이 어떻게 arrary의 레코드의 순서를 무작위로하는 말해 줄 수 보너스 포인트 경우)acts_as_taggable_on의 tagged_with 메소드로 이상한 동작

def show 
    @tattoo =Tattoo.find(params[:id]) 
    tags = @tattoo.style_list.join(", ") 
    @tattoos = Tattoo.tagged_with(tags, :any => true).limit(6) 
    end 

내보기는 배열을 반복합니다.

어쨌든, 거의 모든 시간을 작동하지만 난 가끔 고장 발견 및 문제 해결 동안 내가 tagged_with("jesse smith", :any => true)를 사용할 때 고장 발견하지만 난 tagged_with("jason stephan", :any => true) 또는

tagged_with("black ink", :any => true) 그래서 각 용어는 공간을 가지고하려고 할 때 그것은 작동 어떤 이유로 든 '제시 스미스'가 행동을 죽인다.

내 콘솔

내가 너무 라우팅 오류가 있음을 보여줍니다

ActionView::Template::Error (No route matches {:action=>"show", :controller=>"tattoos", :member_id=>nil, :id=>#<Tattoo id: 170, description: "", status: "approved", member_id: nil, created_at: "2011-10-25 23:08:17", updated_at: "2011-11-17 16:56:55", file_file_name: "starry-eyed-rabid-squirrelweb.jpg", file_content_type: "image/jpeg", file_file_size: 294782, file_updated_at: "2011-10-25 23:08:17", album_id: nil, position: 116, favorite_count: 0, share_count: 1, file_remote_url: "http://www.jessesmithtattoos.com/wp-content/gallery...">}): 
    22: <ol class="small_tattoos"> 
    23:  <% @tattoos.each do |t| %> 
    24:  <li> 
    25:  <%= link_to image_tag(t.file.url(:tiny),:alt=>"#{t.style_list}, rtattoos, tattoos"), member_tattoo_path(t.member, t) %> 
    26:  </li> 
    27:  <% end %> 
    28: </ol> 
    app/views/index/show.html.erb:25:in `block (2 levels) in _app_views_index_show_html_erb___1839804211534816245_69842632179360__4333294961394575926' 
    app/views/index/show.html.erb:23:in `block in _app_views_index_show_html_erb___1839804211534816245_69842632179360__4333294961394575926' 
    app/views/index/show.html.erb:11:in `_app_views_index_show_html_erb___1839804211534816245_69842632179360__4333294961394575926' 

왜 않는 한 학기 원인 라우팅 오류가 아닌 다른 사람?

:member_id=>nil 

그래서 제시 스미스 태그 문신과 관련하여 해당되지 않았 음을 밝혀 것을 나는 당신의 오류 설명에서 볼

member_tattoo_path(t.member, t) 

:

답변

0

난 당신이 경로 도우미에 문제가있는 것 같아요 name 'member'및 유효한 도우미가 필요한 경로 도우미는 예외를 throw합니다.

+0

아 그거 알아? Im 멍청한 나는 그것을 보았어 야하고 내가 그 생각에 if/else 문을 포함하지 않았다는 것을 깨달았 어. 나는 그것이 휴식의 시간이라고 생각한다. 감사! – rugbert