サクサク読めて、アプリ限定の機能も多数!
トップへ戻る
コーヒー沼
old-ruby-on-rails.hatenablog.com
Ruby 1.8.7 + Rails 2.3.10 です。 FCKEditor を入れると以下の警告が出ます。 DEPRECATION WARNING: ActionView::SafeBuffer is deprecated! Use ActiveSupport::SafeBuffer instead. (called from local_constants at /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.10/lib/active_support/core_ext/module/introspection.rb:74)日本語のWebページが無かったので... 以下で対応できます。 vendor/plugins/easy-fckeditor/lib/fckeditor.rb を開いて以下の様にコメント化します。 #inclu
こんな感じになったけど、いいのかな… def initialize(attributes = nil) attributes ||= Hash.new attributes[:hoge] ||= 'fuga' super end
対象はWindowsとみなし、SJISで。 モデルでCSVを作って、コントローラで文字コード変換。 コントローラ。format を使うんですね。 def index @projects = Project.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => Project.all } format.csv { send_data NKF.nkf('-sW -Lw', Project.to_csv), :filename => 'projects.csv', :type => 'text/csv; charset=Shift_JIS' } end end nkf のオプションで改行コードを意識する。 モデル。ロジックはモデルにしました。 def self.to_csv head
都道府県プルダウンを選択すると、その隣にある市区町村プルダウンが動的に変化する ・・・みたいな。(^^; ビュー <%= collection_select :prefecture, :id, Prefecture.all, :id, :title %> <%= observe_field(:prefecture_id, { :update => :city_id, :on => 'changed', :url => { :action => :cities }, :with => "'prefecture_id='+value"}) %> <hr /> <div id="city_id">ここに結果が表示されるよ</div> コントローラ(PrefecturesController) def cities prefecture = Prefecture.find params[:pref
このページを最初にブックマークしてみませんか?
『昔の Ruby On Rails のブログ』の新着エントリーを見る
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く