我正在尝试为我正在制作的 Rails 3.1 应用程序编写一个 sproutcore 前端。我已经看过 sproutcore 指南,但我有兴趣查看如何将 sproutcore 与 Rails 3(.1) 一起使用的真实示例。
我找到了两个示例,但每个示例都完全不同:
- 使用 todo-app “https://github.com/drogus/bulk_api">bulk_api:一种有趣的方法,使用特定的 REST 风格来最小化流量。但它建议将 sproutcore 应用程序放置在
app/sproutcore
中,但我仍然有点不清楚它实际上是如何完全挂钩的。
- Travis-ci 这似乎是一个非常干净的示例,rails 3.1,使用 sproutcore。我还不完全清楚,但所有 sproutcore js 都干净地存储在
app/assets/javascript/apps
中,据我所知,application.html
只需加载 js 并提供加载所有内容的框架。
你还知道其他例子吗?如何在 Rails 应用程序中使用 sproutcore?
I am trying to write a sproutcore frontend for a rails 3.1 application I am making. I have had a look at the sproutcore guides, but I am interested in seeing real examples how to use sproutcore together with rails 3(.1).
I have found two examples, but each is totally different:
- A todo-app created using bulk_api: an interesting approach using a specific REST-style to minimise the traffic. But it proposes to place the sproutcore app in
app/sproutcore
, and is still a bit unclear to me how that actually hooks in completely.
- Travis-ci which seems to be a very clean example, rails 3.1, to use sproutcore. It is not yet completely clear to me, but all sproutcore js is cleanly stored inside
app/assets/javascript/apps
and as far as i can tell, the application.html
just loads the js and provides the frame where everything is loaded into.
Do you know any other examples? How do you use sproutcore in your rails app?
发布评论
评论(2)
您描述的方法与将backbone.js集成到rails应用程序中的方法相同,并且它似乎工作得很好
https://github.com/codebrew/backbone-rails
这将主干存储在
app/assets/javascripts/backbone/
应用程序/资产/javascripts/backbone/应用程序/模型
app/assets/javascripts/backbone/app/controllers
然后视图中有一个脚本标签,它只是初始化主干
我想 sproutcore 的类似过程是有意义的
The method you describe is the same way that you integrate backbone.js into a rails app, and it seems to work very well
https://github.com/codebrew/backbone-rails
This stores backbone in
app/assets/javascripts/backbone/
app/assets/javascripts/backbone/app/models
app/assets/javascripts/backbone/app/controllers
And then there is a script tag in the view that just initializes backbone
I imagine a similar process for sproutcore would make sense
我确实找到了一个演示项目: sproutcore-on-rails 确实成功了对我来说更清楚。
I did find a demo-project: sproutcore-on-rails that did manage to make things clearer for me.