collection(@activities) do |collection|collection.members do |member, activity|member.values { |values|values.id activity.idvalues.title activity.title
# ACTORvalues.actor {values.type activity.actor_type.downcasevalues.id activity.actor_id}
# VERBvalues.verbs activity.verbs
# OBJECTvalues.object {values.type activity.object_type.downcasevalues.id activity.object_idvalues.content activity.object.content if activity.object_content?}# Indirect OBJECTif activity.indirect_objectvalues.indirect_object {values.type activity.indirect_object_type.downcasevalues.id activity.indirect_object_id}end
}endend
I've extracted tokamak so it has its own project now and can also be
used by other Restfulie client and servers:
https://github.com/caelum/tokamak
It is the same code as earlier but in another namespace. As soon as we
get Restfulie 1.0 out (just missing some extra docs) it will be
already using this namespace.
Great work.
Btw, I've used the example mentioned here to create the README file at github.
Regards
Guilherme Silveira
Caelum | Ensino e Inovação
http://www.caelum.com.br/
hi Jeroen, how are you doing?
The question makes sense and the answer depends on how you use it
Those who use sinatra or pure rack, tokamak alone will do the trick.
If you are using rails 3, the restfulie gem adds a few responder traits, as cache, etag and some navigation controls by default.it also patches rails to support patch. I have been using the traits to enhance the http response with conventions.another example of that is the 404 trait that suggests similar resources.
Finally, the client side is also in the gem.
So it depends on what you want to achieve...
Suggestions?
Regards
Le 24 déc. 2010 10:21, "Jeroen van Dijk" <jeroentj...@gmail.com> a écrit :
Thanks for the comments guys. Everything you suggested works fine.I have one question about the new gem and the role of the server library. I currently only use Restfulie for the tokamak templates, I do not use the act_as_restfulie controller extension. I'm wondering whether the server (controller) part of Restfulie does really more then e.g. https://github.com/josevalim/inherited_resources (which I'm using)? To me as an outsider it feels this part of the library is not really needed.Regards,
Jeroen
On Thu, Dec 23, 2010 at 6:32 PM, Guilherme Silveira <guilherme...@caelum.com.br> wrote:
>
> ...
hi Jeroen, how are you doing?
The question makes sense and the answer depends on how you use it
Those who use sinatra or pure rack, tokamak alone will do the trick.
If you are using rails 3, the restfulie gem adds a few responder traits, as cache, etag and some navigation controls by default.it also patches rails to support patch. I have been using the traits to enhance the http response with conventions.another example of that is the 404 trait that suggests similar resources.
Finally, the client side is also in the gem.
So it depends on what you want to achieve...
Suggestions?
I spoke to Luiz and he gave the following suggestion for inner collections:
values.users []
base.users.each do |user|
values.user do
end
end
Is your problem with top level or inner collections?
Regards
Guilherme Silveira
Caelum | Ensino e Inovação
http://www.caelum.com.br/
I've got the same feeling. The problem is that in order to be less
verbose, it need a few hacks in some corner cases.
So we should be aiming to minimize this code:
if comments = @comments.try(:[], activity.id)
member.members(:root => "comments", :collection => comments) do
|member, comment|
member.values { |comment_values|
comment_values.timestamp comment.created_at.to_i
Do you have any suggestion on how you would like it to look like?
I can see no drawback on removing one line from there (the values definition):
if comments = @comments.try(:[], activity.id)
member.members(:root => "comments", :collection => comments) do
|member, comment|
member.timestamp comment.created_at.to_i
I have implemented it and went a little bit more deeper, supporting
also the next one, but then there are some scope issues:
if comments = @comments.try(:[], activity.id)
members(:root => "comments", :collection => comments) do |comment|
timestamp comment.created_at.to_i
Let me know some suggestions on how it could look like and I will try
to implement it. I can move forward with the second one - it has
already been implemented and is backward compatible - does it already
help a little bit?
Regards
~Guilherme