2013-05-02 1 views
0
나는 RefineryCMS 검색 엔진을 구현하기 위해 노력하고있어

, 나는 사용자 정의 확장에 구현하고 있습니다 그러나, 나는 뭔가를 누락 될 수 있습니다, 가이드 https://github.com/refinery/refinerycms-search#search-plugin-for-refinery-cms의 단계를 따랐다 Application.rb :는 구현 RefineryCMS 검색 엔진

config.to_prepare do 
    Refinery.searchable_models = [Refinery::Doctors::Doctor] 
end 

모델 :

module Refinery 
    module Doctors 
    class Doctor < Refinery::Core::BaseModel 
     self.table_name = 'refinery_doctors' 

     attr_accessible :prefix, :full_name, :bio, :specialty, :branch, :schedule, :location, :position, :dr_img, :dr_img_id 

     acts_as_indexed :fields => [:prefix, :full_name, :bio, :specialty, :branch, :schedule, :location, :dr_img, :dr_img_id] 
     alias_attribute :title, :full_name 

     validates :prefix, :presence => true 
     belongs_to :dr_img, :class_name => '::Refinery::Image' 
     has_many :branches 
    end 
    end 
end 

컨트롤러 :

,691,363 (210)
def show 

    # you can use meta fields from your model instead (e.g. browser_title) 
    # by swapping @page for @doctor in the line below: 
    present(@page) 
    end 

protected 

    def find_all_doctors 
    @doctors = Doctor.order('branch ASC').paginate(:page => params[:page], :per_page => 20) 

    end 

보기 :

<div class="clearfix"> 
<div class="span3 dotted"> 
<% content_for :side_body do %> 
    <aside> 
    <h2>Otros Especialistas<%#= t('.other') %></h2> 

     <% @doctors.each do |doctor| %> 
     <% if @doctor.branch == doctor.branch && @doctor.full_name != doctor.full_name %> 
      <ul id="doctors"> 
      <li> 
       <%= link_to doctor.prefix + ' ' + doctor.full_name, refinery.doctors_doctor_path(doctor) %> 
      </li> 
      </ul> 

     <% end %> 
    <% end %> 
    </aside> 
<% end %> 

</div> 


<div class="clearfix"> 
<% content_for :body do %> 
    <section> 
     <div class="span3"> 
       <p><%= image_fu @doctor.dr_img, '250x250'%></p> 
     </div> 

     <div class="span4"> 
     <h1><%= @doctor.prefix + ' ' + @doctor.full_name %></h1> 
     <h2><%= @doctor.specialty %></h2> 
     <strong>Horario: </strong><%=raw @doctor.schedule %><br> 
     <strong>Consultorio: </strong><%=raw @doctor.location %> 
     <h3>Biografía:</h3> 
     <p> 
      <%=raw @doctor.bio %> 
     </p> 


     </div> 

    </section> 
<% end %> 


<%= render '/refinery/content_page' %> 
</div> 

오류 : https://gist.github.com/jmercedes/5503185

답변

1

@doctor

코드에서 아무 곳이나 정의되어 있지 않습니다. 컨트롤러의 #show 액션에 다음 줄을 추가해야합니다.

@doctor = Doctor.find(params[:id])