ruby on rails - Implementing RefineryCMS search engine -
i'm trying implement refinerycms
search engine, have followed steps on guide https://github.com/refinery/refinerycms-search#search-plugin-for-refinery-cms, i'm implementing on custom extension, might missing something:
application.rb:
config.to_prepare refinery.searchable_models = [refinery::doctors::doctor] end
model:
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
controller:
def show # can use meta fields model instead (e.g. browser_title) # swapping @page @doctor in line below: present(@page) end protected def find_all_doctors @doctors = doctor.order('branch asc').paginate(:page => params[:page], :per_page => 20) end
view:
<div class="clearfix"> <div class="span3 dotted"> <% content_for :side_body %> <aside> <h2>otros especialistas<%#= t('.other') %></h2> <% @doctors.each |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 %> <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>
error:
@doctor
not defined anywhere in code. need add following line #show action in controller.
@doctor = doctor.find(params[:id])
Comments
Post a Comment