Created
January 10, 2012 19:44
-
-
Save renaehodgkins/1590759 to your computer and use it in GitHub Desktop.
_top_footer.html.erb
This file contains hidden or 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
def post_link(post, blog = nil, html_options = {}) | |
method = (html_options.delete(:url) == true ? "url" : "path") | |
# send "blog_post_#{method}", post.published_on.year, post.published_on.month, post.published_on.day, post.slug | |
blog_post_path(post.published_on.year, post.published_on.month, post.published_on.day, post.slug) | |
end |
This file contains hidden or 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
<div id="secondary_content_inner"> | |
<h2>Featured Blog Articles</h2> | |
<div class="two_column_left"> | |
<% Post.published.featured.by_date.limit(1).each do |post| %> | |
<h4><%= link_to(post.title, post_link(post)) %></h4> | |
<p class="meta">by <%= post.user.name %> on <%= post.published_on.strftime("%B %d, %Y").gsub(" 0"," ") %></p> | |
<p><%= post.excerpt %> <%= link_to("Continue reading »", post_link(post)) %></p> | |
<% end %> | |
</div> <!-- / .two_column_left --> | |
<div class="two_column_right"> | |
<% Post.published.by_date.limit(3).each do |post| %> | |
<h4><%= link_to(post.title, post_link(post)) %></h4> | |
<p class="meta recent_post_div"> | |
by <%= post.user.name %> on <%= post.published_on.strftime("%B %d, %Y").gsub(" 0"," ") %> | |
</p> | |
<% end %> | |
</div> <!-- / .two_column_right --> | |
<%#= render :partial => 'where_you_can_find_us' %> | |
<div style="clear:both;"></div> <!-- fixes IE6 float clearing --> | |
</div> <!-- end: #secondary_content_inner --> |
This file contains hidden or 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
ActionView::Template::Error (No route matches {:controller=>"posts", :action=>"show", :year=>2012, :month=>1, :day=>3, :id=>"2012-at-intridea"}): | |
3: <h2>Featured Blog Articles</h2> | |
4: <div class="two_column_left"> | |
5: <% Post.published.featured.by_date.limit(1).each do |post| %> | |
6: <h4><%= link_to(post.title, post_link(post)) %></h4> | |
7: <p class="meta">by <%#= post.user.name %> on <%#= post.published_on.strftime("%B %d, %Y").gsub(" 0"," ") %></p> | |
8: <p><%#= post.excerpt %> <%#= link_to("Continue reading »", post_link(post)) %></p> | |
9: <% end %> --> | |
actionpack (3.1.0) lib/action_dispatch/routing/route_set.rb:464:in `raise_routing_error' | |
actionpack (3.1.0) lib/action_dispatch/routing/route_set.rb:454:in `generate' | |
actionpack (3.1.0) lib/action_dispatch/routing/route_set.rb:493:in `generate' | |
actionpack (3.1.0) lib/action_dispatch/routing/route_set.rb:518:in `url_for' | |
actionpack (3.1.0) lib/action_dispatch/routing/url_for.rb:143:in `url_for' | |
actionpack (3.1.0) lib/action_view/helpers/url_helper.rb:107:in `url_for' | |
actionpack (3.1.0) lib/action_dispatch/routing/route_set.rb:200:in `blog_post_path' | |
app/helpers/blogs_helper.rb:24:in `post_link' | |
app/views/layouts/_top_footer.html.erb:6:in `block in _app_views_layouts__top_footer_html_erb__2050902216389512090_2157761020' | |
activerecord (3.1.0) lib/active_record/relation.rb:15:in `each' | |
activerecord (3.1.0) lib/active_record/relation.rb:15:in `each' | |
app/views/layouts/_top_footer.html.erb:5:in `_app_views_layouts__top_footer_html_erb__2050902216389512090_2157761020' | |
actionpack (3.1.0) lib/action_view/template.rb:144:in `block in render' |
This file contains hidden or 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
default_blog /blog(.:format) {:controller=>"blogs", :action=>"index"} | |
blog /blog:id(.:format) {:controller=>"blogs", :action=>"show"} | |
blog_author /blog/authors/:id(.:format) {:controller=>"authors", :action=>"show"} | |
tag /tag/:id(.:format) {:controller=>"blogs", :action=>"tag"} | |
blog_post /:year/:month/:day/:id(.:format) {:year=>/\d{4}/, :month=>/\d{2}/, :day=>/\d{1,2}/, :controller=>"posts", :action=>"show"} | |
default_blog_feed /blog/feed.xml(.:format) {:controller=>"blogs", :action=>"feed"} | |
blog_feed /blog/:id/feed.xml(.:format) {:controller=>"blogs", :action=>"feed"} | |
posts_by_year /blog/archives/:year(.:format) {:year=>/\d{4}/, :controller=>"posts", :action=>"index"} | |
posts_by_month /blog/archives/:year/:month(.:format) {:year=>/\d{4}/, :month=>/\d{2}/, :controller=>"posts", :action=>"index"} | |
post_by_date /blog/archives/:year/:month/:day(.:format) {:year=>/\d{4}/, :month=>/\d{2}/, :day=>/\d{1,2}/, :controller=>"posts", :action=>"show"} | |
post_by_slug /:year/:month/:day/:id(.:format) {:month=>/\d{1,2}/, :year=>/\d{4}/, :controller=>"posts", :action=>"show"} |
This file contains hidden or 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
# # Blog | |
match '/blog' => "blogs#index", :as => "default_blog" | |
match '/blog:id' => "blogs#show", :as => "blog" | |
match '/blog/authors/:id' => "authors#show", :as => "blog_author" | |
match '/tag/:id' => "blogs#tag", :as => "tag" | |
match '/:year/:month/:day/:id' => "posts#show", :as => "blog_post", | |
:constraints => { :year => /\d{4}/, :month => /\d{2}/, :day => /\d{1,2}/ } | |
match '/blog/feed.xml' => "blogs#feed", :as => "default_blog_feed" | |
match '/blog/:id/feed.xml' => "blogs#feed", :as => "blog_feed" | |
match '/blog/archives/:year' => "posts#index", :as => "posts_by_year", | |
:constraints => { :year => /\d{4}/ } | |
match '/blog/archives/:year/:month' => "posts#index", :as => "posts_by_month", | |
:constraints => { :year => /\d{4}/, :month => /\d{2}/ } | |
match '/blog/archives/:year/:month/:day' => "posts#show", :as => "post_by_date", | |
:constraints => { :year => /\d{4}/, :month => /\d{2}/, :day => /\d{1,2}/ } | |
match '/:year/:month/:day/:id' => "posts#show", :as => "post_by_slug", | |
:constraints => {:month => /\d{1,2}/, :year => /\d{4}/} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment