Build a typical Ruby on Rails Web site (iv)

Source: Internet
Author: User
Tags config ruby on rails

Cache and page display, this is the last part of the, I really did not think a serial actually spent a few hours. Tired...

External links and tracking

If you want to link and track external Web site resources, you can use the following helper method:

Ruby Code

  External_link_to (Text,url)
  external_link_to (Image_tag (image), URL)

These two ways to generate links (one is a text link, one is a graphical link) can be logged on the link. If the $use_external_link_popups parameter in the Environment.rb file is set to true, the outer link will be in the form of a pop-up box. The following parameters can be passed to the URL

Ruby Code

  : New_window=>true or false-determines if link appears in new browser window (defaults to True)
  : Show_only_if_lin K=>true or false-determines if image or text is shown if no URL was supplied (defaults to false)
  : Show_link_icon =>true or false-determines if the external icon image is shown after the link (defaults to true for text links and F Alse for image links)

For graphics, you can pass the following parameters:

Ruby Code

  :alt=> ' value '---Alt tag is set with the value passed
  :title=> ' value '--title tag being set with the value passed

For the moment, there are no reports to track the external links. All link tracking is stored through the "external_link_logs" database.

Partial caching mechanism

Partial caching requires configuration file settings to enable (CONFIG/PRODUCTION.RB) and to open the storage mechanism

As follows:

Ruby Code

   
  Config.cache_store =: Mem_cache_store, ' 10.0.0.1:11211 ', ' 10.0.0.2:11211 '

The cache settings are as follows:

Ruby Code

 Config.action_controller.perform_caching = True

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.