タグ

ブックマーク / enkimi.hatenadiary.org (3)

  • 2005-12-21

    目標、年内読了!Chapter19行きますよ。 Sending E-mail まずはメールを送信する設定をしなきゃね。development, testing, productionで同じ設定を使う場合はconfig/environment.rbに設定し、別々に設定したい場合はconfig/environments以下の設定ファイルに設定。 最初に設定しなきゃいけない項目は↓ :testはテスト用でメールは送信しない。:sendmailはローカルの/usr/sbin/sendmailでメールを送信する。:smtpはSMTPでメールを送信する ActionMailer::Base.delivery_method = :smtp | :sendmail | :test:smtpを選んだ場合はさらにいくつかパラメタを設定する必要がある。 ActionMailer::Base.server_set

    2005-12-21
    tokada
    tokada 2007/09/27
  • AWDwR "Chapter15 More Active Record" - きんきん日記

    もっとActive Record! もっとアップルのiMac G5欲しい! Act as DBのデータをリスト構造やツリー構造のように扱うこともできるよ。ステキじゃなーい! まずリスト構造の場合はテーブルにpositionというカラムを定義してモデルを以下のように定義。 class Parent < ActiveRecord::Base has_many :children, :order => position end class Child < ActiveRecord::Base belongs_to :parent acts_as_list :scope => :parent_id endそうするとchildrenは以下のようにして扱える。 parent.children[0].name parent.children[0].first? # 先頭? parent.children

    AWDwR "Chapter15 More Active Record" - きんきん日記
    tokada
    tokada 2006/09/19
  • 2005-12-11

    やべっ、また半年ほどサボるところだったよ:-)。 Form Helpers 送信されてきたフォームのパラメタは以下のようにparamsハッシュにマップされる。 id=123 #=> {:id => "123"} user[name]=Dave #=> {:user => {:name => "Dave"}} user[address][city]=Wien #=> {:user => {:address => {:city => "Wien"}}} テンプレート内のフォームはform_tag()とend_form_tag()で囲むこと。フォームのヘルパメソッドを以下で順に説明するよ。 まずはテキスト系のフィールド。普通のテキスト、ヒドゥンテキスト、パスワード用テキストがある。 text_field(:variable, :attribute, options) hidden_field(:

    2005-12-11
    tokada
    tokada 2006/08/20
  • 1