0

RefineryCMS検索エンジンを実装しようとしています。ガイドhttps://github.com/refinery/refinerycms-search#search-plugin-for-refinery-cmsの手順に従いましたが、これを実装しているためカスタム拡張機能、何か不足している可能性があります:

アプリケーション.rb:

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

コントローラ:

  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

4

1 に答える 1

1

@doctorコードのどこにも定義されていません。コントローラーの #show アクションに次の行を追加する必要があります。

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

于 2013-12-15T08:00:53.263 に答える