I have this code:
<%= @r2_blog_posts = Refinery::Blog::Post.recent(2) %>
<%= link_to(@r2_blog_posts.first) do %>
<%= image_tag(@r2_blog_posts.first.teaser_first_img) %>
<% end %>
I'm getting this error for second line: undefined method `post_path' for #<#:0x0000000841c168> teaser_first_img is returning src attribute of the first image in teaser
I have not used this engine, but I think that the posts - is a nested or namespaced resource. So you need to know at first path for post: rake routes
and then use something like: link_to blog_post_path(@r2_blog_posts.first)
- change blog_post_path
to actual path
You must have defined on your routes something like
resources :posts
or
match 'post/:id' => 'posts#show', :as => :post
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.