Permalink
Browse files

starting work on tree instance list

  • Loading branch information...
1 parent d45b0a4 commit 334c243eeb74a9894b36759a5538874dac4ed0cc @herbdaily committed Mar 27, 2012
Showing with 16 additions and 1 deletion.
  1. +15 −0 lib/marley/joints/forum.rb
  2. +1 −1 lib/marley/plugins/orm_rest_convenience.rb
View
15 lib/marley/joints/forum.rb
@@ -13,6 +13,19 @@ def topics(params=nil)
def list(params=nil)
topics(params).eager_graph(:user).all.map{|t| t.thread}
end
+ def reggae_instance_list(params={})
+ items=list_dataset(params).all
+ if items.length==0
+ Marley::ReggaeMessage.new(:title => 'Nothing Found')
+ else
+ cols=items[0].rest_cols
+ Marley::ReggaeInstanceList.new(
+ :name => resource_name,
+ :schema => items[0].reggae_schema(true) << [:resource,resource_name,RESTRICT_RO],
+ :items => items.map{|i| cols.map{|c|i.send(c)}}
+ )
+ end
+ end
end
module InstanceMethods
def write_cols
@@ -21,6 +34,8 @@ def write_cols
def children
self.class.list_dataset.filter(:parent_id => id)
end
+ def thread_vals
+ end
def thread
return reggae_instance if children.all.length==0
foo=reggae_instance
View
2 lib/marley/plugins/orm_rest_convenience.rb
@@ -40,7 +40,7 @@ def reggae_instance_list(params={})
cols=items[0].rest_cols
Marley::ReggaeInstanceList.new(
:name => resource_name,
- :schema => items[0].schema(true),
+ :schema => items[0].reggae_schema(true),
:items => items.map{|i| cols.map{|c|i.send(c)}}
)
end

0 comments on commit 334c243

Please sign in to comment.