躺在沙灘上的小豬

          快樂的每一天

          #

          Feedburner

          http://feeds.feedburner.com/martinx

          posted @ 2006-05-19 09:27 martin xus| 編輯 收藏

          Integrate FCKEditor with your Ruby on Rails application

          http://www.joshuamcharles.com/rails/fckeditor.html

          posted @ 2006-05-17 17:04 martin xus| 編輯 收藏

          Rails Document

          http://delynnberry.com/pages/rails-chm-documentation/

          posted @ 2006-05-16 20:30 martin xus| 編輯 收藏

          Post and Get

          在《Agile Web Development with Rails》中看到如下的一句話

          ???? If it has no associated data, it will come in as a GET request. If instead it contains form data, we’ll see a POST. Inside a Rails controller, the request information is available in the attribute request. We can check the request type using the methods get?( ) and post?( ).

          也就是說當(dāng)沒有數(shù)據(jù)的時候,是get,而有數(shù)據(jù)的時候則是post.

          例如我們在用戶登錄的時候,首先轉(zhuǎn)到登錄界面,這個時候當(dāng)然還沒有數(shù)據(jù),那么

          request.get?

          為true,輸入相應(yīng)的數(shù)據(jù),提交為false,這樣我們可以通過一個action來控制流程
          ?
          ??def?login
          ??????
          if?request.get?
          ??????????session[:user_id]
          =nil
          ??????????@user?
          =?User.new
          ??????
          else
          ??????????@user?
          =?User.new(params[:user])
          ??????????logged_in_user?
          =?@user.try_to_login
          ??????????
          if?logged_in_user
          ??????????????session[:user_id]
          =logged_in_user.id
          ??????????????redirect_to?:action
          =>'index'
          ??????????
          else
          ??????????????flash[:notice]
          ="Invalid?user/password?combination"
          ??????????end
          ??????end
          ??end?

          posted @ 2006-05-16 10:08 martin xus| 編輯 收藏

          rails 中文亂碼的問題

          在使用rails+mysql的時候遇到了中文亂碼的問題,google了一下,解決了,把它貼出來,防止以后又忘記了

          首先在application.rb中增加utf-8的filter:

          class ?ApplicationController? < ?ActionController::Base
          ??before_filter?:configure_charsets??

          ????
          def ?configure_charsets????????
          ????? ??@headers[
          " Content-Type " ]? = ? " text/html;?charset=utf-8 " ???
          ????end
          end

          修改數(shù)據(jù)庫的編碼為utf-8

          CHARSET=utf8

          其中有一點要說明的是,我看到有人說,不能使用InnoDB,可是我測試下來的結(jié)果是,可以正常使用

          posted @ 2006-05-16 09:41 martin xus| 編輯 收藏

          僅列出標(biāo)題
          共28頁: 上一頁 1 2 3 4 5 6 7 8 9 下一頁 Last 
          主站蜘蛛池模板: 洛宁县| 察哈| 苍南县| 长沙县| 康定县| 定州市| 临潭县| 博乐市| 普定县| 韶山市| 天峨县| 武定县| 南溪县| 石城县| 宁国市| 土默特右旗| 呼伦贝尔市| 乌拉特后旗| 千阳县| 繁峙县| 大新县| 武邑县| 旺苍县| 贵德县| 仪陇县| 康平县| 佛山市| 施秉县| 宾川县| 灵寿县| 徐州市| 万年县| 东兰县| 武冈市| 新野县| 灌南县| 鄂尔多斯市| 安吉县| 观塘区| 赫章县| 正阳县|