SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 240 | Next

Kevin Marshall, Chad Pytel, and Jon Yurek

"Pro Active Record: Databases with Ruby and Rails"

If you want to use a different
name for your left boundary column, specify that name via the left_column parameter, for
example:
class Comment < ActiveRecord::Base
acts_as_nested_set :left_column => "lower_boundary"
end
right_column
The right_column parameter is analogous to left_column. The right boundary column stores
the highest primary key value plus one that the current record shares a level with. By default,
this column is assumed to be labeled rgt. If you want to use a different name, specify that
name via right_column. The following example specifies higher_boundary as the right boundary
column name:
class Comment < ActiveRecord::Base
acts_as_nested_set :right_column => "higher_boundary"
end
scope
The scope parameter allows you to further limit what is considered a part of a given set. If you
specify a symbol that does not end in _id, then _id will automatically be appended to the symbol.
For example, the following calls to acts_as_nested_set are equivalent:
CHAPTER 5 ?–  BONUS FEATURES 102
class Comment < ActiveRecord::Base
acts_as_nested_set :scope => :related #=> actually uses the column related_id
end
class Comment < ActiveRecord::Base
acts_as_nested_set :scope => :related_id #=> actually uses the column related_id
end
If you require even more control on the scope for nested sets, you can simply pass an
entire string that will be used as the where clause.


Pages:
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6