锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产精品大片wwwwww,日本一区二区免费高清,欧美日韩国产色视频http://www.aygfsteel.com/xiaoqiu369/zh-cnSun, 06 Jul 2025 19:44:22 GMTSun, 06 Jul 2025 19:44:22 GMT60ruby+will_pagination+ferret鍒嗛〉鐨勫疄鐜?/title><link>http://www.aygfsteel.com/xiaoqiu369/archive/2009/03/04/257868.html</link><dc:creator>bobqiu</dc:creator><author>bobqiu</author><pubDate>Wed, 04 Mar 2009 12:00:00 GMT</pubDate><guid>http://www.aygfsteel.com/xiaoqiu369/archive/2009/03/04/257868.html</guid><wfw:comment>http://www.aygfsteel.com/xiaoqiu369/comments/257868.html</wfw:comment><comments>http://www.aygfsteel.com/xiaoqiu369/archive/2009/03/04/257868.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.aygfsteel.com/xiaoqiu369/comments/commentRss/257868.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/xiaoqiu369/services/trackbacks/257868.html</trackback:ping><description><![CDATA[<p style="color: red"><strong style="color: #000000">娉?rails鐨勭増鏈槸2.0浠ヤ笂.<br /> <br /> 1.鍦╝pplication.rb閲屾坊鍔犲垎欏典俊鎭柟娉?<br /> </p> <div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><span style="color: #008080">1</span> <span style="color: #000000">def page_for(result,options</span><span style="color: #000000">=</span><span style="color: #000000">{})<br /> </span><span style="color: #008080">2</span> <span style="color: #000000"><br /> </span><span style="color: #008080">3</span> <span style="color: #000000">      default_options </span><span style="color: #000000">=</span><span style="color: #000000"> {:per_page </span><span style="color: #000000">=></span><span style="color: #000000"> </span><span style="color: #000000">10</span><span style="color: #000000">}   <br /> </span><span style="color: #008080">4</span> <span style="color: #000000">       options </span><span style="color: #000000">=</span><span style="color: #000000"> default_options.merge options   <br /> </span><span style="color: #008080">5</span> <span style="color: #000000">       pages </span><span style="color: #000000">=</span><span style="color: #000000"> WillPaginate::Collection.</span><span style="color: #0000ff">new</span><span style="color: #000000">(options[:page],options[:per_page],result.total_hits)   <br /> </span><span style="color: #008080">6</span> <span style="color: #000000">        </span><span style="color: #0000ff">return</span><span style="color: #000000"> pages<br /> </span><span style="color: #008080">7</span> <span style="color: #000000">    <br /> </span><span style="color: #008080">8</span> <span style="color: #000000">    end</span></div> </strong>2.users_controller.rb閲屾坊鍔爏earch鏂規(guī)硶:<br /> <div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><span style="color: #008080"> 1</span> <span style="color: #000000">  def search<br /> </span><span style="color: #008080"> 2</span> <span style="color: #000000">    <br /> </span><span style="color: #008080"> 3</span> <span style="color: #000000">    @keyWord</span><span style="color: #000000">=</span><span style="color: #000000">params[:keyWord]<br /> </span><span style="color: #008080"> 4</span> <span style="color: #000000">    </span><span style="color: #0000ff">if</span><span style="color: #000000"> params[:page]</span><span style="color: #000000">==</span><span style="color: #000000">nil</span><span style="color: #000000">||</span><span style="color: #000000">params[:page]</span><span style="color: #000000">==</span><span style="color: #000000">""</span><span style="color: #000000"><br /> </span><span style="color: #008080"> 5</span> <span style="color: #000000">      @page</span><span style="color: #000000">=</span><span style="color: #000000">1</span><span style="color: #000000"><br /> </span><span style="color: #008080"> 6</span> <span style="color: #000000">    </span><span style="color: #0000ff">else</span><span style="color: #000000"><br /> </span><span style="color: #008080"> 7</span> <span style="color: #000000">      @page</span><span style="color: #000000">=</span><span style="color: #000000">params[:page]<br /> </span><span style="color: #008080"> 8</span> <span style="color: #000000">    end<br /> </span><span style="color: #008080"> 9</span> <span style="color: #000000">    @users</span><span style="color: #000000">=</span><span style="color: #000000">User.find_by_contents(@keyWord,:per_page</span><span style="color: #000000">=></span><span style="color: #000000">2</span><span style="color: #000000">,:page</span><span style="color: #000000">=></span><span style="color: #000000">@page)<br /> </span><span style="color: #008080">10</span> <span style="color: #000000">    @pages</span><span style="color: #000000">=</span><span style="color: #000000">page_for(@users,:page</span><span style="color: #000000">=></span><span style="color: #000000">@page,:per_page</span><span style="color: #000000">=></span><span style="color: #000000">2</span><span style="color: #000000">)<br /> </span><span style="color: #008080">11</span> <span style="color: #000000">  end</span></div> 3.view欏甸潰:<br /> <div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><span style="color: #008080"> 1</span> <span style="color: #000000"><%</span><span style="color: #000000">@users.each </span><span style="color: #0000ff">do</span><span style="color: #000000"> </span><span style="color: #000000">|</span><span style="color: #000000">user</span><span style="color: #000000">|%></span><span style="color: #000000"><br /> </span><span style="color: #008080"> 2</span> <span style="color: #000000"><</span><span style="color: #000000">br</span><span style="color: #000000">></span><span style="color: #000000"><br /> </span><span style="color: #008080"> 3</span> <span style="color: #000000">   username: </span><span style="color: #000000"><%=</span><span style="color: #000000">user.highlight(@keyWord,:field</span><span style="color: #000000">=></span><span style="color: #000000">:user_name,:num_excerpts</span><span style="color: #000000">=></span><span style="color: #000000">1</span><span style="color: #000000">,:pre_tag</span><span style="color: #000000">=></span><span style="color: #000000">'</span><span style="color: #000000"><strong></span><span style="color: #000000">'</span><span style="color: #000000">,:post_tag</span><span style="color: #000000">=></span><span style="color: #000000">'</span><span style="color: #000000"></strong></span><span style="color: #000000">'</span><span style="color: #000000">)</span><span style="color: #000000">%><</span><span style="color: #000000">br</span><span style="color: #000000">></span><span style="color: #000000"> <br /> </span><span style="color: #008080"> 4</span> <span style="color: #000000">   鍦板潃:</span><span style="color: #000000"><%=</span><span style="color: #000000">user.highlight(@keyWord,:field</span><span style="color: #000000">=></span><span style="color: #000000">:introduce,:num_excerpts</span><span style="color: #000000">=></span><span style="color: #000000">1</span><span style="color: #000000">,:pre_tag</span><span style="color: #000000">=></span><span style="color: #000000">'</span><span style="color: #000000"><strong></span><span style="color: #000000">'</span><span style="color: #000000">,:post_tag</span><span style="color: #000000">=></span><span style="color: #000000">'</span><span style="color: #000000"></strong></span><span style="color: #000000">'</span><span style="color: #000000">)</span><span style="color: #000000">%></span><span style="color: #000000"><br /> </span><span style="color: #008080"> 5</span> <span style="color: #000000">==================================================================================</span><span style="color: #000000"><br /> </span><span style="color: #008080"> 6</span> <span style="color: #000000"><%</span><span style="color: #000000">end</span><span style="color: #000000">%></span><span style="color: #000000"><br /> </span><span style="color: #008080"> 7</span> <span style="color: #000000"><</span><span style="color: #000000">p</span><span style="color: #000000">></span><span style="color: #000000"><br /> </span><span style="color: #008080"> 8</span> <span style="color: #000000">  鍏?/span><span style="color: #000000"><%=</span><span style="color: #000000">@users.total_hits</span><span style="color: #000000">%></span><span style="color: #000000">鏉¤褰?br /> </span><span style="color: #008080"> 9</span> <span style="color: #000000"></</span><span style="color: #000000">p</span><span style="color: #000000">></span><span style="color: #000000"><br /> </span><span style="color: #008080">10</span> <span style="color: #000000"><</span><span style="color: #000000">p</span><span style="color: #000000">></span><span style="color: #000000"><br /> </span><span style="color: #008080">11</span> <span style="color: #000000">  </span><span style="color: #000000"><%=</span><span style="color: #000000">link_to </span><span style="color: #000000">"</span><span style="color: #000000">涓婁竴欏?/span><span style="color: #000000">"</span><span style="color: #000000">,{:page</span><span style="color: #000000">=></span><span style="color: #000000">@pages.previous_page,:keyWord</span><span style="color: #000000">=></span><span style="color: #000000">@keyWord} </span><span style="color: #000000">%></span><span style="color: #000000"><br /> </span><span style="color: #008080">12</span> <span style="color: #000000"><%=</span><span style="color: #000000">link_to </span><span style="color: #000000">"</span><span style="color: #000000">涓嬩竴欏?/span><span style="color: #000000">"</span><span style="color: #000000">,{:page</span><span style="color: #000000">=></span><span style="color: #000000">@pages.next_page,:keyWord</span><span style="color: #000000">=></span><span style="color: #000000">@keyWord} </span><span style="color: #000000">%></span><span style="color: #000000"><br /> </span><span style="color: #008080">13</span> <span style="color: #000000"><</span><span style="color: #000000">br</span><span style="color: #000000">/></span><span style="color: #000000"><br /> </span><span style="color: #008080">14</span> <span style="color: #000000"><%=</span><span style="color: #000000">will_paginate @users</span><span style="color: #000000">%></span><span style="color: #000000"><br /> </span><span style="color: #008080">15</span> <span style="color: #000000"></</span><span style="color: #000000">p</span><span style="color: #000000">></span></div><img src ="http://www.aygfsteel.com/xiaoqiu369/aggbug/257868.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/xiaoqiu369/" target="_blank">bobqiu</a> 2009-03-04 20:00 <a href="http://www.aygfsteel.com/xiaoqiu369/archive/2009/03/04/257868.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>瀹夎f(xié)errethttp://www.aygfsteel.com/xiaoqiu369/archive/2009/02/20/255895.htmlbobqiubobqiuFri, 20 Feb 2009 14:31:00 GMThttp://www.aygfsteel.com/xiaoqiu369/archive/2009/02/20/255895.htmlhttp://www.aygfsteel.com/xiaoqiu369/comments/255895.htmlhttp://www.aygfsteel.com/xiaoqiu369/archive/2009/02/20/255895.html#Feedback0http://www.aygfsteel.com/xiaoqiu369/comments/commentRss/255895.htmlhttp://www.aygfsteel.com/xiaoqiu369/services/trackbacks/255895.html鎸夌収緗戜笂浼犵粺鐨勬柟娉曞畨瑁呭嚑嬈¢兘娌℃湁鎴愬姛.鏈鍚庡彧鏈変笅杞絞em鏂囦歡瀹夎
1.涓嬭澆ferret-0.11.6-mswin32.gem鏂囦歡
2.鐢╣em 瀹夎:gem install ferret-0.11.6-mswin32 --local
3.gem install acts_as_ferret
4.浠庣綉涓婁笅杞絝errect_ext.so鏂囦歡,copy鍒?ferret-0.11.5-x86-mswin32\lib鐩綍錛堣窡ferret.rb鍚屼竴鐩綍錛?br />
濡傛灉鐩存帴涓嬭澆婧愮爜瀹夎榪愯ruby setup.rb.浼?xì)鍑虹?the c extensions could not be installed"鐨勯敊璇?br />

鎵嬪姩瀹夎plugins

灝嗕笅杞界殑婧愭枃浠舵斁鍒皏endor/plugins閲岄潰,榪涘叆璇ョ洰褰?榪愯ruby install.rb

鍑虹幇鐨勯棶棰?

=> Booting WEBrick...

c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:442:in `load_missing_constant': uninitialized constant Ferret::Analysis::Analyzer (NameError)

        from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:77:in `const_missing'

        from E:/rorapp/demo/vendor/plugins/acts_as_ferret/lib/ferret_extensions.rb:17

        from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'

        from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'

        from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:155:in `require'

        from E:/rorapp/demo/vendor/plugins/acts_as_ferret/lib/acts_as_ferret.rb:28

        from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'

        from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'

         ... 25 levels...

        from c:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/server.rb:49

        from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'

        from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'

        from script/server:3

 瑙e喅鍔炴硶灝辨槸鎶婁笂闈㈠畨瑁呭畬鎴恌erret鍚庣殑鏂囦歡閲屾壘鍒癴errect_ext.so灝嗚繖涓枃浠舵斁鍒發(fā)ib閲岄潰.榪欎釜鏄?00澶欿,鑰屼粠緗戜笂涓嬭澆鐨勬墠30K.瀵艱嚧涓婇潰鐨勯棶棰?



bobqiu 2009-02-20 22:31 鍙戣〃璇勮
]]>
ror涓湁鐢ㄧ殑鎻掍歡http://www.aygfsteel.com/xiaoqiu369/archive/2009/02/07/253696.htmlbobqiubobqiuSat, 07 Feb 2009 06:57:00 GMThttp://www.aygfsteel.com/xiaoqiu369/archive/2009/02/07/253696.html gem install --source http://www.loonsoft.com/recaptcha/pkg/ recaptcha

2.鎼滅儲(chǔ):acts_as_searchable鏄竴涓猂ails鎻掍歡錛屽畠渚濊禆浜嶩yper Estraier榪欎釜鐙珛鐨勬悳绱㈠紩鎿庢墍鎻愪緵鐨勭儲(chǔ)寮曞拰鎼滅儲(chǔ)鏈嶅姟 
            ferret gem install ferret -v=0.11.5 --platform mswin32  
3.pdf:
gem install pdf-writer  

4.嫻嬭瘯:
RSpec+Mocha

5.妗岄潰搴旂敤
gem install anvil



bobqiu 2009-02-07 14:57 鍙戣〃璇勮
]]>
[杞琞ROR鐨勫姩鎬佹潯浠跺垎欏?/title><link>http://www.aygfsteel.com/xiaoqiu369/archive/2009/01/19/251861.html</link><dc:creator>bobqiu</dc:creator><author>bobqiu</author><pubDate>Mon, 19 Jan 2009 03:23:00 GMT</pubDate><guid>http://www.aygfsteel.com/xiaoqiu369/archive/2009/01/19/251861.html</guid><wfw:comment>http://www.aygfsteel.com/xiaoqiu369/comments/251861.html</wfw:comment><comments>http://www.aygfsteel.com/xiaoqiu369/archive/2009/01/19/251861.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/xiaoqiu369/comments/commentRss/251861.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/xiaoqiu369/services/trackbacks/251861.html</trackback:ping><description><![CDATA[<p _counted="undefined">浣跨敤鎻掍歡</p> <p _counted="undefined">1/ will_paginate</p> <p _counted="undefined">    <a _counted="undefined">http://groups.google.com/group/will_paginate</a></p> <p _counted="undefined"> </p> <p _counted="undefined">榪欎釜璧勬枡寰堝錛屼笉澶氳</p> <p _counted="undefined"> </p> <p _counted="undefined">2/ squirrel</p> <p _counted="undefined">    涓嬭澆錛?a _counted="undefined">http://github.com/thoughtbot/squirrel/tree/master</a></p> <p _counted="undefined"> </p> <p _counted="undefined">涓昏瀹炵幇 鍔ㄦ佹潯浠剁殑鏌ヨ錛屾墿灞旳ctiveScaffold find鏂規(guī)硶銆傛敮鎸佽法Model鏌ヨ錛屽叿浣撹</p> <p _counted="undefined">    璇存槑錛?a _counted="undefined">http://thoughtbot.com/projects/squirrel</a></p> <p _counted="undefined"> </p> <p _counted="undefined">璐存涓昏瀹炵幇浠g爜</p> <p _counted="undefined">#controller:</p> <p _counted="undefined">def index</p> <p _counted="undefined">#######################################################</p> <p _counted="undefined">#涓嬮潰浠g爜鍙互鎸夊疄闄呮儏鍐墊彁鍙栧埌Model鎴栧叾浠栧湴鏂癸紱鏂逛究嫻嬭瘯鎴戠洿鎺ユ斁鍦╥ndex涓?/p> <p _counted="undefined">#######################################################<br _counted="undefined" />     @permissions = Permission.find(:all) do<br _counted="undefined" />       paginate :page => params[:page]||1,:per_page=>5<br _counted="undefined" />       any do<br _counted="undefined" />         name == params[:permission][:name] unless params[:permission].nil?<br _counted="undefined" />         code == params[:permission][:code] unless params[:permission].nil?<br _counted="undefined" />         permit_date == params[:permission][:permit_date] unless params[:permission].nil?<br _counted="undefined" />         contact.company == params[:contact][:company] unless params[:contact].nil?<br _counted="undefined" />       end<br _counted="undefined" />     end<br _counted="undefined" />  #######################################################<br _counted="undefined" />     respond_to do |format|<br _counted="undefined" />       format.html # index.rhtml<br _counted="undefined" />       format.xml  { render :xml => @permissions.to_xml }<br _counted="undefined" />     end<br _counted="undefined" />   end</p> <p _counted="undefined"> </p> <p _counted="undefined"> </p> <p _counted="undefined">#index--view</p> <p _counted="undefined"> </p> <p _counted="undefined"><% field_set_tag do %><br _counted="undefined" />   <% form_for :permission, :url=>permissions_url,:method=>:get,:html=>{:method=>:get} do |f| %><br _counted="undefined" />     鍏徃鍚嶇О :<%= text_field_with_auto_complete :contact, :company,{},{:method=>:get}%>  <br><br _counted="undefined" />     璇佷功綾誨瀷 :<%= text_field_with_auto_complete :permission, :name,{},{:method=>:get}%>  <br><br _counted="undefined" />     璇佷功緙栧彿 :<%= text_field_with_auto_complete :permission, :code,{},{:method=>:get}%>  <br><br _counted="undefined" />     鎺堜笌鏃ユ湡 :<%= text_field_with_auto_complete :permission, :permit_date,{},{:method=>:get}%>  <br><br _counted="undefined" />     <%= submit_tag '鏌ヨ'  %><br _counted="undefined" />    <% end %><br _counted="undefined" /> <%  end %></p> <p _counted="undefined"> </p> <p _counted="undefined">...</p> <p _counted="undefined"> </p> <p _counted="undefined"><div class="digg_pagination"><br _counted="undefined" />   <div clas="page_info"><br _counted="undefined" />     <%= page_entries_info @permissions %><br _counted="undefined" />   </div><br _counted="undefined" />   <%= will_paginate @permissions, :container => false %><br _counted="undefined" /> </div></p><img src ="http://www.aygfsteel.com/xiaoqiu369/aggbug/251861.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/xiaoqiu369/" target="_blank">bobqiu</a> 2009-01-19 11:23 <a href="http://www.aygfsteel.com/xiaoqiu369/archive/2009/01/19/251861.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>ror鎵ц嫻佺▼http://www.aygfsteel.com/xiaoqiu369/archive/2009/01/05/249937.htmlbobqiubobqiuMon, 05 Jan 2009 08:18:00 GMThttp://www.aygfsteel.com/xiaoqiu369/archive/2009/01/05/249937.htmlhttp://www.aygfsteel.com/xiaoqiu369/comments/249937.htmlhttp://www.aygfsteel.com/xiaoqiu369/archive/2009/01/05/249937.html#Feedback0http://www.aygfsteel.com/xiaoqiu369/comments/commentRss/249937.htmlhttp://www.aygfsteel.com/xiaoqiu369/services/trackbacks/249937.html     2.Rails routes this request to a controller for processing.
    3.Our controller interacts with the models in our application to gather the necessary data
    4.Our model may retrive or insert data to our database
    5.Once our models have generated or retrived correct information,they return the data back to the collection
    6.The controller collects all of the data it's received from models and selects a view template to render
    7.The view template is rendered using  the data that the collection gathered and handed to  the web server
    8.An html page is returned to the user.

bobqiu 2009-01-05 16:18 鍙戣〃璇勮
]]>
ROR絎竴璇?hello worldhttp://www.aygfsteel.com/xiaoqiu369/archive/2008/12/23/247935.htmlbobqiubobqiuTue, 23 Dec 2008 08:46:00 GMThttp://www.aygfsteel.com/xiaoqiu369/archive/2008/12/23/247935.htmlhttp://www.aygfsteel.com/xiaoqiu369/comments/247935.htmlhttp://www.aygfsteel.com/xiaoqiu369/archive/2008/12/23/247935.html#Feedback0http://www.aygfsteel.com/xiaoqiu369/comments/commentRss/247935.htmlhttp://www.aygfsteel.com/xiaoqiu369/services/trackbacks/247935.html
/app/controllers/stories_controllers.rb:

class StoriesController<ActionControllers::Base
    def index
        @varies="hello world"
    end
end


/views/stories/index.html.erb:

<%=@varies%>

/config/routes.rb

ActionController::Routing::Routes.draw do |map|
    map 'stories',:controller=>'stories',:action=>'index'
end

鍚姩鏈嶅姟鍦↖E涓墦寮:
http://localhost:3000/stories
OK


bobqiu 2008-12-23 16:46 鍙戣〃璇勮
]]>
鏈鐞嗙殑 NetStatusEventhttp://www.aygfsteel.com/xiaoqiu369/archive/2008/12/22/247826.htmlbobqiubobqiuMon, 22 Dec 2008 13:39:00 GMThttp://www.aygfsteel.com/xiaoqiu369/archive/2008/12/22/247826.htmlhttp://www.aygfsteel.com/xiaoqiu369/comments/247826.htmlhttp://www.aygfsteel.com/xiaoqiu369/archive/2008/12/22/247826.html#Feedback1http://www.aygfsteel.com/xiaoqiu369/comments/commentRss/247826.htmlhttp://www.aygfsteel.com/xiaoqiu369/services/trackbacks/247826.html 瑙e帇緙╁悗瀛楄妭鏁頒負(fù) [SWF] E:\eclipse3.1.2\workspace\red51\fla\test51.swf - 2703
Error #2044: 鏈鐞嗙殑 NetStatusEvent:銆?level=error, code=NetConnection.Connect.Failed
 at test51_fla::MainTimeline/test51_fla::frame1()[test51_fla.MainTimeline::frame1:1]


瑙e喅鍔炴硶 :娣誨姞綰㈤鑹查儴鍒嗕唬鐮?

var nc:NetConnection=new NetConnection();
nc.connect("rtmp://localhost/red51");
nc.objectEncoding=ObjectEncoding.AMF0;
var so:SharedObject=SharedObject.getRemote("mo",nc.uri,false);
nc.addEventListener(NetStatusEvent.NET_STATUS,netStatusEventHandle);

function netStatusEventHandle(e:NetStatusEvent):void {
     trace(e.toString);
}



bobqiu 2008-12-22 21:39 鍙戣〃璇勮
]]>
as2.0+red5+spring jdbchttp://www.aygfsteel.com/xiaoqiu369/archive/2008/12/21/247657.htmlbobqiubobqiuSun, 21 Dec 2008 14:12:00 GMThttp://www.aygfsteel.com/xiaoqiu369/archive/2008/12/21/247657.htmlhttp://www.aygfsteel.com/xiaoqiu369/comments/247657.htmlhttp://www.aygfsteel.com/xiaoqiu369/archive/2008/12/21/247657.html#Feedback0http://www.aygfsteel.com/xiaoqiu369/comments/commentRss/247657.htmlhttp://www.aygfsteel.com/xiaoqiu369/services/trackbacks/247657.html闃呰鍏ㄦ枃

bobqiu 2008-12-21 22:12 鍙戣〃璇勮
]]>
Rails Routing from the Outside Inhttp://www.aygfsteel.com/xiaoqiu369/archive/2008/12/19/247327.htmlbobqiubobqiuFri, 19 Dec 2008 06:12:00 GMThttp://www.aygfsteel.com/xiaoqiu369/archive/2008/12/19/247327.htmlhttp://www.aygfsteel.com/xiaoqiu369/comments/247327.htmlhttp://www.aygfsteel.com/xiaoqiu369/archive/2008/12/19/247327.html#Feedback0http://www.aygfsteel.com/xiaoqiu369/comments/commentRss/247327.htmlhttp://www.aygfsteel.com/xiaoqiu369/services/trackbacks/247327.htmlRails Routing from the Outside In
http://guides.rails.info/routing_outside_in.html
榪欑瘒鏂囩珷灝嗕粙緇峈ails routing閽堝鐢ㄦ埛鏂歸潰鐨勪竴浜涚壒鎬?鍙傝冭繖綃囨枃绔?浣犲皢浼?xì)瀛﹀堫C互涓嬬煡璇?
a.鐞嗚Вrouting鐨勪綔鐢?br /> b.鐮磋Вroutes.rb鍐呯殑浠g爜
c.鏋勫緩浣犺嚜宸辯殑routes,鍙互鐢╟lassic hash鏍峰紡鎴栫幇鍦ㄦ祦琛岀殑RESTful鏍峰紡.
d.璇嗗埆route鎬庢牱涓巆ontroller鍜宎ction鏄犲皠.

1.The Dual Purpose of Routing

Rails routing 鏈変袱縐嶆満鍒?浣犲彲浠ュ皢trees杞崲涓簆ager,鎴栨妸paper杞崲鍥瀟rees.鍏蜂綋鍦拌,瀹冨彲浠ヨ繛鎺ユ敹鍒扮殑璇鋒眰涓庝綘搴旂敤紼嬪簭鐨勬帶鍒跺櫒鐨勪唬鐮佸拰甯綘鐢熸垚URLs,鑰屼笉鐢ㄥ仛涓轟竴涓瓧絎︿覆紜紪鐮?

1.1connecting URLs to Code;
褰撲綘鐨勫簲鐢ㄧ▼搴忔敹鍒扮殑璇鋒眰涓?
GET /patients/17
Rails閲岀殑璺敱寮曟搸灝辨槸涓孌靛垎鍙戣繖涓姹傚埌搴旂敤紼嬪簭鍚堥傜殑浣嶇疆榪涜澶勭悊鐨勪竴孌典唬鐮?鍦ㄨ繖涓渚嬩腑,榪欎釜搴旂敤紼嬪簭寰堝彲鑳戒互榪愯patients鎺у埗鍣ㄩ噷鐨剆how緇撴潫.鏄劇ずpatients ID涓?7鐨勮緇嗕俊鎭?

1.2 Generateing URLs from Code
Routing 涔熷彲浠ュ弽榪囨潵榪愯,濡傛灉浣犵殑搴旂敤紼嬪簭涓寘鍚繖鏍風(fēng)殑浠g爜:

@patient=Patient.find(17)
<%= link_to "Patient Record",patient_path(@patient)%>

榪欐椂璺敱寮曟搸杞崲榪欎釜閾炬帴鍒頒竴涓猆RL:http://example.com/patients/17.浠ヨ繖縐嶆柟寮忎綘鍙互闄嶄綆搴旂敤紼嬪簭鐨勮剢寮辨?浣夸綘鐨勪唬鐮佹洿鍔犲鏄撻槄璇誨拰鐞嗚В.

Patient 蹇呴』浣滀負(fù)涓涓猺esource琚0鏄庝負(fù)涓涓祫婧?閫氳繃named route鏉ヨ漿鎹?

2.Quick Tour of Routes.rb

鍦≧ails涓璻outing鏈変袱縐嶇粍浠?routing engine鏈韓,瀹冨仛涓篟ails鐨勪竴閮ㄥ垎,config/routes.rb鏂囦歡,瀹冨寘鍚疄闄呯殑鍙敤鍦ㄥ簲鐢ㄧ▼搴忎腑鐨剅outes.

2.1 Processing the File
鍦ㄥ艦寮忎笂,Routes.rb鏂囦歡涔熷氨鏄竴涓ぇ澶х殑block,浼?xì)琚攽謪ctionController::Routing::Routes.draw.
鍦ㄨ繖涓枃浠朵腑鏈変簲縐嶄富瑕佺殑鏍峰紡:
RESTful Routes
Named Routes
Nested Routes
Regular Routes
Default Routes

2.2 RESTful Routes
RESTful Routes 鍒╃敤rails宓屽叆寮廟EST鏂規(guī)硶鏉ュ皢routing鐨勬墍鏈変俊鎭寘瑁呬負(fù)涓涓崟鐙殑澹版槑.eg: map.resource :books

2.3 named Routes
named routes 鍦ㄤ綘鐨勪唬鐮佷腑緇欎綘寰堝彲璇葷殑閾炬帴,涔熷彲浠ュ鐞嗘敹鍒扮殑璇鋒眰

map.login '/login' ,:controller=>'session',:action=>'new'

2.4 Nested routes

Nested routes鍙互鍦ㄤ竴涓祫婧愰噷澹版槑鍙︿竴涓祫婧?

map.resources :assemblies do |assemblies|
 assemblies.resources :parts
end

2.5 Regular Routes
map.connect 'parts/:number',:controller=>'inventory',:action=>'show'

2.6 Default Routes
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'



bobqiu 2008-12-19 14:12 鍙戣〃璇勮
]]>
Routeshttp://www.aygfsteel.com/xiaoqiu369/archive/2008/12/16/246553.htmlbobqiubobqiuTue, 16 Dec 2008 01:58:00 GMThttp://www.aygfsteel.com/xiaoqiu369/archive/2008/12/16/246553.htmlhttp://www.aygfsteel.com/xiaoqiu369/comments/246553.htmlhttp://www.aygfsteel.com/xiaoqiu369/archive/2008/12/16/246553.html#Feedback0http://www.aygfsteel.com/xiaoqiu369/comments/commentRss/246553.htmlhttp://www.aygfsteel.com/xiaoqiu369/services/trackbacks/246553.htmlroutes:

routes鐨勫懡鍚嶅厑璁鎬綘鍑忓皯閲嶅鐨勪唬鐮?閫氳繃鍒嗛厤涓涓牴鎹敓鎴愪竴涓皝瑁卹outes rule hash鐨勬柟娉曠殑璺緞瑙勫垯鍚嶇О鏉ュ疄鐜?
浣犲彲浠ュ畾涔変竴涓懡鍚嶈礬寰?浣犲彲浠ヨ皟鐢ㄥ畠鍦ㄤ綘鐨剅outes.rb鏂囦歡涓潵浠f浛connect鏂規(guī)硶.
渚嬪:
map.home '',:controller=>'main',:action=>'start'
榪欏彧鏄負(fù)浣犲仛浜?jiǎn)寰垶畱鐨勪竴鐐逛簨.棣栧厛,瀹冨垱寤轟竴涓悕涓篽ome_url鐨勬柟娉?鍥犳涓婇潰鐨勫懡鍚嶈鍒?鍓嶆湡鐨勮姹備負(fù):
 redirect_to :controller=>'main',:action=>'start' 鐜板湪涓?
 redirect_to home_url

鍥犱負(fù)*_to鏂規(guī)硶琚噸鍐欑殑鏂瑰紡,鍦ㄤ笂闈㈢殑鎯呭喌,浣犳病鏈夊皢鍙傛暟浼犻掔粰鍛藉悕璺緞,浣犱篃鍙互灝嗗畠浼犻掔粰涓涓紩鐢ㄧ殑鏂規(guī)硶.
 redirect_to :home_url

娉ㄦ剰:灝嗗懡鍚嶈礬寰勫仛涓轟竴涓鍙峰凡緇忓彇娑堜簡(jiǎn),鍦╮ails2.0灝嗚鍒犻櫎.

榪欎釜涔熻兘搴旂敤浜庢槸tests.濡傛灉鍦ㄤ綘鐨刢ontroller閲屾湁redirect_to home_url,涔熷彲浠ョ敤 assert_redirect_to home_url.

*_url鏂規(guī)硶闇瑕佷竴涓敮涓鐨勫彲閫夊弬鏁?榪欎釜鍙傛暟鏄竴涓猦ash,鎻掑叆url_for涔嬩腑,榪欐牱鍋氬氨鏄負(fù)浜?jiǎn)褰撶敤redirect_to,link_to鏃跺懡鍚嶈鍒欏彲浠ュ弬鏁板寲.

浣犲鏋滆鏈夎繖鏍風(fēng)殑route

 map.user_page 'users/:user',:controller=>'users',:action=>'show'

浣犲彲浠ヨ繖鏍峰仛

 link_to @user.username,user_page_url(:user=>@user)

娉ㄩ噴:榪欎釜浠呬粎璞℃櫘閫氱殑routes,琛ㄥ崟鏄痯ath_part/:symbol.鍦ㄤ笂闈㈢殑渚嬪瓙涓?user榪欓儴鍒嗗皢鍙睍紺哄湪璺緞涓?騫朵笉涓ユ牸涓巆ontroller鐩稿叧鑱?users/鍙槸path鐢熸垚鐨勯儴鍒?
涓婇潰鐨勪緥瀛愮敓鎴?lt;a href="http://localhost/users/7">http://localhost/users/7</a>
姣斿:

:user 鏄綘瀹氫箟鐨勫弬鏁板悕縐?濡傛灉瀹氫箟涓や釜涓妯′竴鏍風(fēng)殑璺緞,寰堝彲鑳藉緱涓嶅埌浣犳兂瑕佺殑緇撴灉.瀵逛簬routes,瀹氫箟榛樿鍊?

褰撶敤鍙傛暟鏉ュ懡鍚峳outes,浣犲繀欏諱紶閫掑弬鏁扮粰assert涓殑鍛藉悕瑙勫垯.濡傛灉鍦ㄤ綘鐨刢ontroller涓湁redirect_to user_page_url(:user=>@user), 浣犻渶瑕佹湁assert_redirected_to user_page_url(:user=>@user).controller涓瑻user鐨刬d蹇呴』涓巘est涓殑@user鐨刬d鍖歸厤.

闄や簡(jiǎn)[route_name]_url鏂規(guī)硶,浣犲彲浠ョ敤hash_for_[route_name]_url鏂規(guī)硶,榪欎釜鏂規(guī)硶鍖呰hash,娌℃湁璋冪敤url_for

鎵鏈夌殑reoute灝嗗叾瀹冪殑鍛藉悕瑙勫垯鐢╩ap.connect鎻愪緵緇欎綘.



bobqiu 2008-12-16 09:58 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 宾阳县| 柳河县| 阳朔县| 任丘市| 桦南县| 库尔勒市| 青州市| 嘉峪关市| 无极县| 清丰县| 马鞍山市| 枣阳市| 陇川县| 萨迦县| 墨玉县| 乌兰县| 沙湾县| 巴中市| 宜兰县| 华宁县| 从化市| 明水县| 大名县| 洛扎县| 尖扎县| 宁波市| 宿迁市| 凯里市| 淮安市| 城固县| 七台河市| 高州市| 平陆县| 于都县| 大姚县| 新平| 新闻| 郎溪县| 荆州市| 犍为县| 湘潭市|