Search code examples
refinerycms

Display records in refinery page


I need to get the record from database and i want to display that record value on home page. My table name is refierny_about. I have a model. It was created while I generating the engine.

Thanks for your advise.


Solution

  • My guess is "About" is your custom extension do this. The syntax here is: The Refinery Namespace::Your Extension Namespace::Extension Model Name

    so you can use the controller is Refinery::Abouts::About.all

    app\decorators\controllers\refinery\pages_controller_decorator.rb here past this code

    Refinery::PagesController.class_eval do
      def home  
        @posts = Refinery::Abouts::About.all
      end
    end
    

    and its your html code.

    <% @posts.each do |a| %>
    <p><%= link_to about.title, refinery.abouts_about_path(a) %></p>
    <% end %>