Skip to content

Commit

Permalink
fix mat path tests
Browse files Browse the repository at this point in the history
  • Loading branch information
herbdaily committed Apr 1, 2012
1 parent e1d981d commit 5b2c6c0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
3 changes: 2 additions & 1 deletion lib/marley/joints/forum.rb
Expand Up @@ -50,7 +50,8 @@ def section_nav
self.reggae_link(:new, 'New Post'),
self.reggae_link(:list, 'All Posts'),
self.reggae_link(:recent_topics, 'Recent Topics'),
Marley::ReggaeSection.new({:title => 'Public Tags', :navigation => MR::PublicTag.filter(:id => topics.select(:messages__id)).map{|t| reggae_link('list',t.tag,"#{resource_name}[_public_tags]=#{t.tag}")}})
Marley::ReggaeSection.new({:title => 'Public Tags', :navigation => MR::PublicTag.group(:tag).map{|t| reggae_link('list',t[:tag],"#{resource_name}[_public_tags]=#{t.tag}")}}),
Marley::ReggaeSection.new({:title => 'Private Tags', :navigation => MR::PrivateTag.current_user_ds.join(:messages_tags,:tags_id => :tags__id).join(:messages,:messages__id => :message_id).filter(:message_type => 'PublicMessage').group(:tag).map{|t| reggae_link('list',t[:tag],"#{resource_name}[_private_tags]=#{t.tag}")}})
]
end
def recent_topics
Expand Down
1 change: 1 addition & 0 deletions lib/marley/joints/tags.rb
Expand Up @@ -72,6 +72,7 @@ class PublicTag < Tag
end
class PrivateTag < Tag
MR::User.join_to(self) if MR::User
Marley.plugin(:current_user_methods).apply(self)
def self.list_dataset(params={})
current_user_ds.order(:tag)
end
Expand Down
39 changes: 20 additions & 19 deletions rdoc/orm_materialized_path_plugin.rdoc
Expand Up @@ -3,46 +3,47 @@
examples:

>> MR::Tree.new(:name => 'asdf').save.reggae_instance
=> [:instance, {:schema=> [[:integer, :id, 2, 1], [:text, :name, 0, "asdf"], [:text, :path, 0, nil]], :url=>"/tree/1", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
=> [:instance, {:schema=> [[:integer, :id, 2, 1], [:text, :name, 0, "asdf"]], :url=>"/tree/1", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
>> MR::Tree[1].new_child.reggae_instance
=> [:instance, {:schema=>[[:text, :name, 0, nil], [:text, :path, 0, "1-"]], :url=>"/tree/", :new_rec=>true, :name=>"tree", :actions=>nil}, nil]
=> [:instance, {:schema=>[[:text, :name, 0, nil]], :url=>"/tree/", :new_rec=>true, :name=>"tree", :actions=>nil}, nil]
>> MR::Tree[1].new_child.save.reggae_instance
=> [:instance, {:schema=> [[:integer, :id, 2, 2], [:text, :name, 0, nil], [:text, :path, 0, "1-"]], :url=>"/tree/2", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
=> [:instance, {:schema=> [[:integer, :id, 2, 2], [:text, :name, 0, nil]], :url=>"/tree/2", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
>> MR::Tree[1].new_child.save.reggae_instance
=> [:instance, {:schema=> [[:integer, :id, 2, 3], [:text, :name, 0, nil], [:text, :path, 0, "1-"]], :url=>"/tree/3", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
=> [:instance, {:schema=> [[:integer, :id, 2, 3], [:text, :name, 0, nil]], :url=>"/tree/3", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
>> MR::Tree[1].new_child.save.reggae_instance
=> [:instance, {:schema=> [[:integer, :id, 2, 4], [:text, :name, 0, nil], [:text, :path, 0, "1-"]], :url=>"/tree/4", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
=> [:instance, {:schema=> [[:integer, :id, 2, 4], [:text, :name, 0, nil]], :url=>"/tree/4", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
>> MR::Tree[2].new_child.save.reggae_instance
=> [:instance, {:schema=> [[:integer, :id, 2, 5], [:text, :name, 0, nil], [:text, :path, 0, "1-2-"]], :url=>"/tree/5", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
=> [:instance, {:schema=> [[:integer, :id, 2, 5], [:text, :name, 0, nil]], :url=>"/tree/5", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
>> MR::Tree[5].new_child.save.reggae_instance
=> [:instance, {:schema=> [[:integer, :id, 2, 6], [:text, :name, 0, nil], [:text, :path, 0, "1-2-5-"]], :url=>"/tree/6", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
=> [:instance, {:schema=> [[:integer, :id, 2, 6], [:text, :name, 0, nil]], :url=>"/tree/6", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
>> MR::Tree[3].new_child.save.reggae_instance
=> [:instance, {:schema=> [[:integer, :id, 2, 7], [:text, :name, 0, nil], [:text, :path, 0, "1-3-"]], :url=>"/tree/7", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
=> [:instance, {:schema=> [[:integer, :id, 2, 7], [:text, :name, 0, nil]], :url=>"/tree/7", :new_rec=>false, :name=>"tree", :actions=>nil}, []]

>> MR::Tree[3].new_child.save.reggae_instance
=> [:instance, {:schema=> [[:integer, :id, 2, 8], [:text, :name, 0, nil], [:text, :path, 0, "1-3-"]], :url=>"/tree/8", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
=> [:instance, {:schema=> [[:integer, :id, 2, 8], [:text, :name, 0, nil]], :url=>"/tree/8", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
>> MR::Tree[3].new_child.save.reggae_instance
=> [:instance, {:schema=> [[:integer, :id, 2, 9], [:text, :name, 0, nil], [:text, :path, 0, "1-3-"]], :url=>"/tree/9", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
=> [:instance, {:schema=> [[:integer, :id, 2, 9], [:text, :name, 0, nil]], :url=>"/tree/9", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
>> MR::Tree[3].new_child.save.reggae_instance
=> [:instance, {:schema=> [[:integer, :id, 2, 10], [:text, :name, 0, nil], [:text, :path, 0, "1-3-"]], :url=>"/tree/10", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
=> [:instance, {:schema=> [[:integer, :id, 2, 10], [:text, :name, 0, nil]], :url=>"/tree/10", :new_rec=>false, :name=>"tree", :actions=>nil}, []]

>> MR::Tree[1].new_child.save.reggae_instance
=> [:instance, {:schema=> [[:integer, :id, 2, 11], [:text, :name, 0, nil], [:text, :path, 0, "1-"]], :url=>"/tree/11", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
=> [:instance, {:schema=> [[:integer, :id, 2, 11], [:text, :name, 0, nil]], :url=>"/tree/11", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
>> MR::Tree[1].new_child.save.reggae_instance
=> [:instance, {:schema=> [[:integer, :id, 2, 12], [:text, :name, 0, nil], [:text, :path, 0, "1-"]], :url=>"/tree/12", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
=> [:instance, {:schema=> [[:integer, :id, 2, 12], [:text, :name, 0, nil]], :url=>"/tree/12", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
>> MR::Tree[2].new_child.save.reggae_instance
=> [:instance, {:schema=> [[:integer, :id, 2, 13], [:text, :name, 0, nil], [:text, :path, 0, "1-2-"]], :url=>"/tree/13", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
=> [:instance, {:schema=> [[:integer, :id, 2, 13], [:text, :name, 0, nil]], :url=>"/tree/13", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
>> MR::Tree[5].new_child.save.reggae_instance
=> [:instance, {:schema=> [[:integer, :id, 2, 14], [:text, :name, 0, nil], [:text, :path, 0, "1-2-5-"]], :url=>"/tree/14", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
=> [:instance, {:schema=> [[:integer, :id, 2, 14], [:text, :name, 0, nil]], :url=>"/tree/14", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
>> MR::Tree[3].new_child.save.reggae_instance
=> [:instance, {:schema=> [[:integer, :id, 2, 15], [:text, :name, 0, nil], [:text, :path, 0, "1-3-"]], :url=>"/tree/15", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
=> [:instance, {:schema=> [[:integer, :id, 2, 15], [:text, :name, 0, nil]], :url=>"/tree/15", :new_rec=>false, :name=>"tree", :actions=>nil}, []]

>> MR::Tree[7].new_child.save.reggae_instance
=> [:instance, {:schema=> [[:integer, :id, 2, 16], [:text, :name, 0, nil], [:text, :path, 0, "1-3-7-"]], :url=>"/tree/16", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
=> [:instance, {:schema=> [[:integer, :id, 2, 16], [:text, :name, 0, nil]], :url=>"/tree/16", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
>> MR::Tree[13].new_child.save.reggae_instance
=> [:instance, {:schema=> [[:integer, :id, 2, 17], [:text, :name, 0, nil], [:text, :path, 0, "1-2-13-"]], :url=>"/tree/17", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
=> [:instance, {:schema=> [[:integer, :id, 2, 17], [:text, :name, 0, nil]], :url=>"/tree/17", :new_rec=>false, :name=>"tree", :actions=>nil}, []]


>> MR::Tree[1].values_tree
=> [1, "asdf", nil, [[2, nil, "1-", [], [5, nil, "1-2-", [], [6, nil, "1-2-5-", []], [14, nil, "1-2-5-", []]], [13, nil, "1-2-", [], [17, nil, "1-2-13-", []]]], [3, nil, "1-", [], [7, nil, "1-3-", [], [16, nil, "1-3-7-", []]], [8, nil, "1-3-", []], [9, nil, "1-3-", []], [10, nil, "1-3-", []], [15, nil, "1-3-", []]], [4, nil, "1-", []], [11, nil, "1-", []], [12, nil, "1-", []]]]
=> [1, "asdf", [[2, nil, [[5, nil, [[6, nil, []], [14, nil, []]]], [13, nil, [[17, nil, []]]]]], [3, nil, [[7, nil, [[16, nil, []]]], [8, nil, []], [9, nil, []], [10, nil, []], [15, nil, []]]], [4, nil, []], [11, nil, []], [12, nil, []]]]


0 comments on commit 5b2c6c0

Please sign in to comment.