문제

I use Refinery CMS blog module to create a simple blog, now I try to customize archive section, I want to add one more param for archive link, default route for archive looks like:

blog_archive_posts GET     /blog/archive/:year(/:month)(.:format)

now my question is how can I call this in rails and how can I provide the params for blog_archive_posts_path?

도움이 되었습니까?

해결책

Try

<%= link_to "archive for #{year}/#{month}", 
            blog_archive_posts_path(year: @year, month: @month) %>

where @year and @month are defined in your controller appropriately

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top