Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

开发ruby-china的客户端,API到哪儿找到?我没有找到ruby-china的api文档。。。。? #25

Closed
crossle opened this issue May 3, 2012 · 11 comments

Comments

@crossle
Copy link

crossle commented May 3, 2012

咨询,开发ruby-china的客户端,API到哪儿找到?我没有找到ruby-china的api文档。。。。?

@ashchan
Copy link
Member

ashchan commented May 4, 2012

lib/api. code is documentation.

@crossle
Copy link
Author

crossle commented May 5, 2012

OK ,3Q

@crossle crossle closed this as completed May 5, 2012
@crossle
Copy link
Author

crossle commented May 9, 2012

咨询一下。。。Grape::Entity 这个的主要作用是什么? 还有expose ?

@crossle crossle reopened this May 9, 2012
@ashchan
Copy link
Member

ashchan commented May 9, 2012

Grape::Entity对应相应的ActiveRecord对象(我们不直接暴露AR对象,那样既无必要也容易返回敏感数据),expose用于指定要在api中暴露出去的属性。

@ashchan ashchan closed this as completed May 9, 2012
@crossle
Copy link
Author

crossle commented May 9, 2012

Grape::Entity 可以来自不同的ActiveRecord吗?因为我想从不同的表查询出数据。。。如果可以,怎样表示呢?谢谢非常

@ashchan
Copy link
Member

ashchan commented May 9, 2012

可以啊。你看现在的代码能找到这样的用法。

iPhoneから送信

On 2012/05/10, at 1:54, Crosslereply@reply.github.com wrote:

Grape::Entity 可以来自不同的ActiveRecord吗?因为我想从不同的表查询出数据。。。如果可以,怎样表示呢?谢谢非常


Reply to this email directly or view it on GitHub:
#25 (comment)

@crossle
Copy link
Author

crossle commented May 10, 2012

class Reply < Grape::Entity
expose :_id, :body, :body_html, :message_id, :created_at, :updated_at
expose :user, :using => APIEntities::User
end
是这样的吧? expose :user, :using => APIEntities::User 意思是返回的时候也返回。每条回复的user entity是吧?大神。。。

@crossle
Copy link
Author

crossle commented May 11, 2012

ruby-china 中的 spec目录是干什么用的?

@crossle
Copy link
Author

crossle commented May 11, 2012

还有ruby-china中的site-node表db文件是再哪里 啊?我怎么没有找到?谢谢

@tiemei
Copy link

tiemei commented May 15, 2012

spec: test site-node: db/schema.rb

@crossle
Copy link
Author

crossle commented May 16, 2012

db/schema.rb中没有site-node表的结构。。。。。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants