Rails 3.2和phonegap [英] Rails 3.2 and phonegap

查看:107
本文介绍了Rails 3.2和phonegap的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个rails应用程序当前运行,我想为它做一个移动应用程序,我不想学习objective-c或java,我阅读了很多关于phonegap的文章,如何使用它来做一个跨平台Web应用程序
Phonegap compile css / htm / js
Rails应用程序有它的ruby代码,还有html.erb和js.erb扩展
所以我怎么能做一个移动应用程序,主要是为android作为我的轨道切除服务器的后端

我将使用jquery mobile作为应用程序的UI
我需要制作一个api并使用emberjs或angularjs或骨干联系与服务器?
将rails用作移动应用程序的后端的教程如此罕见

I have a rails application currently running ,I want to make a mobile application for it ,I don't want to learn objective-c or java ,I read many articles about phonegap and how I can use it to make a cross platform web apps Phonegap compile css/htm/js Rails application has its ruby code and also html.erb and js.erb extensions So how can I make a mobile application ,mainly for android for ex as a back-end of my rails excising server
I will use jquery mobile as a UI for the application Do I need to make an api and use emberjs or angularjs or backbone to contact with the server ? Tutorials in using rails as a back-end for a mobile application are so rare

推荐答案

显然,一个单一的方法来做到这一点。因此,我将告诉您在使用API​​服务器应用程序构建移动客户端时使用的工具。

Obviously, there is no a single way to do this. So, I'll tell you the tools I use when have to build a mobile client working with API server app.

后端:


  1. Ruby on Rails

  2. rabl gem (Ruby API Builder语言)是一个Rails和Padrino ruby​​模板用于生成JSON,XML,MessagePack,PList和BSON的系统。使用这个gem你可以:

    • 根据对象中的数据创建任意节点

    • 传递参​​数到方法并存储结果

    • 重命名或别名属性以更改模型名称

    • 重复部署模板并继承以减少代码重复

    • 将属性从子级附加到父级节点

    • 仅在满足某个条件时才包含节点

  1. Ruby on Rails
  2. rabl gem (Ruby API Builder Language) is a Rails and Padrino ruby templating system for generating JSON, XML, MessagePack, PList and BSON. With this gem you can:
    • Create arbitrary nodes named based on combining data in an object
    • Pass arguments to methods and store the result as a child node
    • Render partial templates and inherit to reduce code duplication
    • Rename or alias attributes to change the name from the model
    • Append attributes from a child into a parent node
    • Include nodes only if a certain condition has been met

前端:


  1. Cordova :一组设备API,允许移动应用开发人员从JavaScript访问本机设备功能,如相机或加速度计。 li>
  2. Angularjs (可选)

  3. Ionic (如果你选择使用Angular):免费和开源,移动优化的HTML,CSS和JS组件库。使用Sass构建并针对AngularJS进行了优化。 Ionic附带了一个 AngularJS和Cordova种子计划示例,您可以用它来开始赢得的应用程序。

  4. angular-restmod (如果您选择使用Angular):Rails inspired REST-API ORM。有了这个,你可以有javascript模型来与您的Rails API进行交互。如果您不想使用此功能,可以使用 Angular的$ http

  1. Cordova: set of device APIs that allow a mobile app developer to access native device function such as the camera or accelerometer from JavaScript.
  2. Angularjs (Optional)
  3. Ionic (If you choose to work with Angular): Free and open source, library of mobile-optimized HTML, CSS and JS components. Built with Sass and optimized for AngularJS. Ionic comes with an AngularJS and Cordova Seed Project example you can use to start your won app.
  4. angular-restmod (If you choose to work with Angular): Rails inspired REST-API ORM. With this you can have "javascript models" to interact with your Rails API. If you don't want to use this you can use Angular's $http

使用Ember,您可以使用 ember_phonegap_starter 。这是一个入门工具包,让您在移动应用程序中使用Ember运行。这可以在PhoneGap包装器中转储,以为Ember应用程序创建一个App包装器。 (请查看屏幕录像

With Ember you can use ember_phonegap_starter. This is a starter kit to get you up and running with Ember inside a mobile application. This can be dumped inside a PhoneGap wrapper to create an App wrapper for your Ember application. (check out the screencast)

您可以使用 bootstrap-for-ember 示例)将Twitter Bootstrap 3添加到Ember应用程序。

You can use bootstrap-for-ember (examples) to add Twitter Bootstrap 3 to your Ember app.

这篇关于Rails 3.2和phonegap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆