ç»åãã¡ã¤ã«ã«ãªã³ã¯ãè²¼ãã®ã«3æé
Ruby on Railsã§ã¢ããªã±ã¼ã·ã§ã³ãä½ã£ã¦ããããç»åãã¡ã¤ã«ã¸ã®URLãã©ããã£ã¦æ¸ããããããåãããªãã¦ãæ¶ãè¦ããã§ãã¾ããã
<img src="/images/cleam_clenzer.gif"/>
ã£ã¦æ¸ãã¦ãã¾ãã¨ãã¢ããªã±ã¼ã·ã§ã³ããã¡ã¤ã³ç´ä¸ãããªãURLã«ç½®ããã¨ãã«ãã¡ã«ãªã£ã¦ãã¾ãã
ãã¨ãã£ã¦
<img src="cleam_clenzer.gif"/>
ã£ã¦æ¸ãã¨ãããããªURLããåç
§ã§ããªããªã£ã¦å°ãã
ãimage_tagããã«ãã¼ã¡ã½ãã
2æéã»ã©ã½ã¼ã¹èªãã ã試è¡é¯èª¤ãããæ¤ç´¢ããã絶æããããã¤ã¯ã«éãããããçµæããimage_tagãã£ã¦ãããã«ãã¼ã¡ã½ããããããã¨ãç¥ãã¾ããã
http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html#M001031
<%= image_tag( 'cleam_clenzer.gif' ) %>
ã£ã¦æ¸ãã¨
<img alt="Cleam_clenzer" src="/images/cleam_clenzer.gif?1203782414" />
ãã®ããã«å¤æãããã¿ããã
ï¼ã¤ãã®å¼æ°ã«ã¿ã°ã®å±æ§ãããã·ã¥ã§æ¸¡ãã¨ããã®ã¾ãã¾HTMLã«å¤æãã¦ããã¾ããã
<%= image_tag( 'cleam_clenzer.gif', { :alt => 'ã¯ãªã¼ã ã¯ã¬ã³ã¶ã¼', :border => '0' } ) %>
â
<img alt="ã¯ãªã¼ã ã¯ã¬ã³ã¶ã¼" border="0" src="/images/cleam_clenzer.gif" />
ãlink_toããã«ãã¼ã¡ã½ãã
ç¡äºã«ç»åã表示ãããã¨ãã§ãã¾ãããããã©ã¯ãã®ç»åã«ãªã³ã¯ãã¤ãã¦ããããã¯ãªãã¯ãããä»ã®ãã¼ã¸ã«é·ç§»ããããã«ãããã§ãã
ããã¹ãã«ãªã³ã¯ãè²¼ãã¨ãã¯ããlink_toãã¨ãããã«ãã¼ã¡ã½ããã使ãã¿ããã§ãããããã¥ã¢ã«ãè¦ãéããããã¹ãã¸ã®ãªã³ã¯ããã§ããªããããªæ°ããã¾ãã
http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#M000913
<%= link_to( 'ã¯ãªã¼ã ã¯ã¬ã³ã¶ã¼', { :controller => 'unilever' } ) %>
ãâ
<a href="/unilever">ã¯ãªã¼ã ã¯ã¬ã³ã¶ã¼</a>
ããã¹ããããªãç»åã«ãªã³ã¯è¨å®ããã«ã¯ã©ãããããããã ããã
1æéã»ã©è©¦è¡é¯èª¤ãã¦ä¸æããããªãã¦ã¤ã¤ã«ãªã£ã¦åãã«ãã£ãSBRãèªãã§ãªã³ã´ã©ã®å°è©ã«ã·ããããããæå¥ãlink_toã®å¼æ°ã«image_tagããã®ã¾ãã¾æ¸¡ãã°ããã¨ãããã¨ããããã¾ããã
<%= link_to( image_tag( 'cleam_clenzer.gif' ), { :controller => 'unilever' } ) %>
ãâ
<a href="/unilever"><img alt="Cleam_clenzer" src="/images/cleam_clenzer.gif" /></a>
æã£ããã¨
ä¸è¡æ¸ãã®ã«3æéãããã£ããã¨ã«çµ¶æããã
viewã®ä¸ã§ä½¿ãããã«ãã¼ã¡ã½ããã¯ãActionView::Helpersãããã±ã¼ã¸ã®ä¸ã«ã¾ã¨ã¾ã£ã¦ãããã ã¨æãã
/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/ ãã£ã¬ã¯ããªãè¦ãã°ä½ãããæããããæ´ããããããªããããã