-
-
Save jmercedes/c69aa0a62d5936df00e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% @bios.each do |b| %> | |
<p><strong><%= link_to b.title %></strong></p> | |
<%= truncate b.content_for(:body).html_safe, length: 200, :omission => "...", preserve_html_tags: true %> | |
<p> | |
<%= link_to(t('.read_more'), bio_path(:bio), class: "btn btn-primary") %> | |
</p> | |
<hr> | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.9.3-p125 :010 > Refinery::Page.where(:parent_id => 15) | |
Refinery::Page Load (0.6ms) SELECT "refinery_pages".* FROM "refinery_pages" WHERE "refinery_pages"."parent_id" = 15 | |
Refinery::Page::Translation Load (0.3ms) SELECT "refinery_page_translations".* FROM "refinery_page_translations" WHERE "refinery_page_translations"."refinery_page_id" = 20 | |
Refinery::Page::Translation Load (0.4ms) SELECT "refinery_page_translations".* FROM "refinery_page_translations" WHERE "refinery_page_translations"."refinery_page_id" = 21 | |
Refinery::Page::Translation Load (0.2ms) SELECT "refinery_page_translations".* FROM "refinery_page_translations" WHERE "refinery_page_translations"."refinery_page_id" = 22 | |
Refinery::Page::Translation Load (0.2ms) SELECT "refinery_page_translations".* FROM "refinery_page_translations" WHERE "refinery_page_translations"."refinery_page_id" = 24 | |
=> [#<Refinery::Page id: 20, parent_id: 15, path: nil, slug: "dr-jose-natalio-redondo", show_in_menu: true, link_url: "", menu_match: nil, deletable: true, draft: false, skip_to_first_child: false, lft: 7, rgt: 8, depth: 2, view_template: "bio", layout_template: nil, created_at: "2012-12-27 02:50:40", updated_at: "2012-12-27 15:18:27">, #<Refinery::Page id: 21, parent_id: 15, path: nil, slug: "dr-william-redondo", show_in_menu: true, link_url: "", menu_match: nil, deletable: true, draft: false, skip_to_first_child: false, lft: 9, rgt: 10, depth: 2, view_template: "show", layout_template: nil, created_at: "2012-12-27 03:45:54", updated_at: "2012-12-27 14:13:17">, #<Refinery::Page id: 22, parent_id: 15, path: nil, slug: "manuel-carbajo", show_in_menu: true, link_url: "", menu_match: nil, deletable: true, draft: false, skip_to_first_child: false, lft: 11, rgt: 12, depth: 2, view_template: nil, layout_template: nil, created_at: "2012-12-27 03:48:36", updated_at: "2012-12-27 03:48:36">, #<Refinery::Page id: 24, parent_id: 15, path: nil, slug: "charlotte-contreras", show_in_menu: true, link_url: "", menu_match: nil, deletable: true, draft: false, skip_to_first_child: false, lft: 13, rgt: 14, depth: 2, view_template: "bio", layout_template: nil, created_at: "2012-12-27 14:16:10", updated_at: "2012-12-27 14:16:38">] | |
1.9.3-p125 :011 > |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config.view_template_whitelist = ["home", "show", "bios"] | |
config.use_view_templates = true | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Refinery::PagesController.class_eval do | |
def bios | |
@bios = Refinery::Page.where(:parent_id => 15) | |
end | |
def bio | |
@bio = ::Refinery::Page.find(params[:id]) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
match '/bios', :to => 'refinery/pages#bios', :as => :bios | |
match '/bio/:id', :to => 'refinery/pages#bio', :as => :bio |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment