acts asを 使ってみよう 藤岡岳之 (xibbar) アジェンダ • acts as list • acts as tree • acts as nested set • better nested set acts as listとは • Railsに標準でついている • 順列を扱うときに便利 どうやって使う? • positionというinteger型のカラムを追加 • modelにacts_as_listを追加 class CreateUsers < ActiveRecord::Migration def self.up create_table :users do |t| t.column :name, :string t.column :position, :integer end end def self.down drop_table :users end end c
Better nested set This plugin provides an ehanced acts_as_nested_set mixin for ActiveRecord, the object-db mapping layer of the framework RubyOnRails. The original nested set feature seems to be quite old and missed some necessary functionalities. Details This acts provides Nested Set functionality. Nested Set is a smart way to implement an ordered tree, with the added feature that you can select
http://agilewebdevelopment.com/plugins/betternestedset ここにあります。どういうものかというと、acts_as_nested_setを拡張して 便利にしたものです。 acts_as_nested_set + acts_as_tree + 便利= better_nested_set といった感じです。 インストール方法 ./script/plugin install http://opensource.symetrie.com/svn/better_nested_set/trunkただ、trunkという名前になるので、リネームした方がいい気がします。 使えるメソッド一覧 move_to_child_of 別の場所にぶら下げる move_to_right_of別の場所にぶら下げる move_to_left_of別の場所にぶら下げる root
前回までのあらすじ 2002 5.8.0 2003 5.8.1 5.8.2 2004 5.8.3 5.8.4 5.8.5 5.8.6 2005 5.8.7 2006 5.8.8 ←今ここ
bradとmyとuse fieldsとPseudo-hashesとHash::Utilと bradプロダクトではuse fieldsが多用されています。そして、 my ClassName $var;のような変数宣言が多用されています。 perldoc -f myしてみるとuse fieldsで使うみたいな事が書いてありました。 use fieldsってのは package Jitensya; use strict; use warnings; use fields qw/(sound); sub new { my $proto = shift; my $self = ref $proto ? $proto : fields::new($proto); $self; } 1; のようなコードがあるとして use strict; use warnings; use Jitensya; my $
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く