I already see some similar quetions:
How to set the default format for a route in Rails?
Rails 3 respond_to: default format?
Rails 3.1 force .html instead of no extension
But any solution didn't work in rails 4 for me:
in routers.rb
:defaults => { :format => 'html' }
in app/controllers/some_controller.rb
before_filter :set_format
def set_format
request.format = 'html'
end
in config/application.rb
config.default_url_options = { :format => "html" }
Any of there. I tried all it together and each separate.
Here my code:
link_to("Read more", article_path(article, :format => "html"))
# => <a href="/1.html">Read more</a>
What will be if I remove :format => "html"
:
link_to("Read more", article_path(article))
# => <a href="/1">Read more</a>
What I am want:
link_to("Read more", article_path(article))
# => <a href="/1.html">Read more</a>
Share your suggestion for it, please.