Ruby on Rails: Modern development good practice - ruby-on-rails

Currently, I am planning to build a web app with the Ruby on Rails framework.
In the future, the web app might need to evolve into an iOS or Android app.
I am wondering what's the best practice is to structure the software so that it can be easily migrated to different platforms.

Use Rails only for backend, build some API server. For frontend you can use anything you want: web(angular, reactjs, other js), ios app, android app.

Related

Create offline OSX application from Rails web app

I was recently building an internal business database web app using Ruby on Rails 4 and Postgres. The plan was to make the app available to all our employees using Devise for authentication and hosting on Heroku.
Toward the end of development, a request was made to include some highly sensitive information in the app including social security numbers, etc. Thus, instead of heavily worrying about online security we are planning to make this app only run locally on one Mac and not have it available online. The app will only be used about 5 times a month by one person. Instead of requiring that person to launch a postgres server and a webserver via terminal (such as "rails server"), is there a way to package the entire Rails web app and database in to an application so it could be run similar to other OSX apps?
If anyone knows a PC solution instead, that is also a (less preferred) option.
At this point, we realize we should have developed a xcode app, but now that the development is mostly complete with some tricky UI, we would rather not have to recreate the functionality in xcode.
Though I haven't used it myself, what your describing sounds pretty close to what Rubymotion offers

Rails Api + AngularJS + IonicFramework

I want to start a new project and im not sure, if im using the best setup/approach. The project is kind of a list directory without high computing power needed.
I planned to build an website with Rails Api and AngularJs (+Bootstrap) for normal devices and mobile and use the same api for apps too.
Therefore i planned to use the IonicFramework (+PhoneGap). Is this a common approach or are there any best practices i should consider?
This is the standard way to develop web/desktop apps and mobile apps.
You are approaching this correctly.
Use core AngularJS + Bootstrap for web/desktop app and Ionic
Framework for mobile
Sharing the backend Rails API makes sense. Typically the Rails API
would be designed with REST principles in mind which makes it easier
to consume (probably using Restangular) via web/desktop app and
mobile app
If you follow standard AngularJS conventions to create a separation
of concerns (controllers, services, and views) then you will be able
to share quite a bit of JavaScript code between the web/desktop app
and mobile app and easily override functionality to customize for
devices, if necessary.

Integrate Brunch with Rails

I'm trying to use below Brunch skeleton and integrate with my Rails app:
Sassy Brunch with Ember and CoffeeSoup
Is there a way to do this so I can still use Brunch operations like build and watch seamlessly within the Rails app?
Or would we rather want to have separate Frontend for Brunch and use Rails as RESTful provider?
Checkout the Breakfast Gem. It integrates Brunch into Rails pretty seamlessly.
Developing Brunch application separately from Rails application is in my opinion idiomatic way of developing web apps:
Ability to synchronously develop frontend and backend. You can simply use static JSON files on your frontend (served from public/) before Rails app is ready.
Ability to make frontend totally independent from backend. There can be many front ends, after all (iOS, for example).
Ability to share frontend code as an example implementation of your API-using-app. In many applications (yeah not all) frontend these days is less important than the backend data itself and backend business logic. I see no reason not to provide third-party developers a convenient example app they can base they code on.

Restful Web services for Mobile App - What language, framework,infrastruture?

I am very new to IOS development.I wonder which language/framework everyone is using to create RESTFUL web services for high traffic, scalable IOS app backend.
The solution requires:
1. Secure Login
2. Restful web services (JSON)
3. High traffic
4. File upload/download
5. Quick search result from large volume database
I am from .NET and MSSQL background. I heard people are using PHP, Java, Python, RoR with IOS webservice development. I understand every language can have pros and cons, just want to know what is prefered in today's trend.
And for database, is NoSQL database a prefered choice than RDBMS for scalable large volume databse? I am checking MongoDB.
Apologies if I am asking wrong questions. I am investigating the technologies for this new project, and any input will be greatly appreciated!
Thanks
I have worked in three major projects that all of them have desktop clients, web clients, and mobile clients (Android, iOS). The 3 have completed different server side approach, and all of them make me and the users happy:
Project 1:
Server: Delphi + RemObjects
Clients: Delphi desktop apps, PHP Web apps, Java applets, Android apps, iOS apps
Why Delphi? Because the existent project was already a Delphi multi-tier app, the development team have domain of Delphi platform, ans was easy with RemObjects (or even with the standard DataSnap) to return JSON, SOAP or XML-RPC to be invoked by the clients;
Project 2:
Server: PHP
Clients: ExtJS Web apps, Android apps, iOS apps
Why PHP? The development team was experienced with PHP, the projects was originally a PHP web app with some classes well defined and not coupled with the UI. Some new classes in the server that reused the existing code base, just converting to/from JSON were enough to allow the clients to talk to the server, with minimum effort.
Project 3 (initial development):
Server: C# ASP.NET
Clients: ASP.NET apps, Android apps, iOS apps
Why C#? Again: the development team was experienced with C# and ASP.NET, the projects was originally an ASP.NET app. We are refactoring some app logic into web services that will be consumed for both the ASP.NET app and the clients.
As you see, there is no need to make the team learn something completely new on the server side.
I'd suggest you to keep your development in .NET with MSSQL, taking advantage of your current skills.
If the application traffic grows you can move the server app to an IaaS server (like Amazon AWS EC2) that supports SQLServer, or even better to a PaaS server, which in this case Windows Azure will probably be your best friend.
These are all loaded questions that can't be answered without more information about what you're making, etc. I use a combination of Ruby with Sinatra and DataMapper (and SQLite/PostgreSQL) for most of my projects, but that's my personal preference and probably won't be of much help to you.
Rather than choosing a technology stack based on trends, why don't you just pick something with a good user base for help and go from there?

Can we use Ruby on Rails to develop a mobile app?

Since Rails uses MVC architecture. I was wondering that if we can use Rails to develop a mobile app or any web app.
Out of MVC the 'M' and 'C' won't change to develop the mobile app right?
I mean the models and controllers will remain the same.
Only the view portion should be changed such that, instead of using html.erb files I want Java or Android SDK or whatever, to provide the UI for the mobile user.
Can someone enlighten me on this perspective?
Also I have been hearing about jRuby does it come into play for our mobile app development requirement?
The answer to this question is going to depend on how you want to deploy this app. Do you want it running completely on the phone or can it be a web app disguised as an iphone/android app?
For the native app solution I'd checkout the Rhodes Framework. It's not RoR but you'll see that it's an MVC framework that feels similar. This will allow you to build native iphone/android apps using Ruby.
For the 2nd option, web app disguised as a mobile app, I'd recommend Sencha Touch. Sencha has done an amazing job mimicking the look and feel of native iphone/android apps with their Javascript library. With this solution it would be just like any other web app though it's targeted for android and iphone via it's UI.
I've created an example rails / ember.js App that is exported with Phonegap. It uses just the usual MVC architecture of a Rails and an Ember.js App. Maybe you will find it useful. It also implements token authentication based on ember-auth and several OAuth strategies.
Currently in de the devel branch: https://github.com/joscas/base_app/tree/devel
Heroku deploy: https://starter-app-staging.herokuapp.com (the desktop version)
Exported with phonegap-rails gem (of which I'm also the author) for assets, fix paths etc.
Absolutly YES!
Ruby on Rails just a backend tech, is the same as what you plan to do for normal browser. There are only two things that you need to consider about mobile app. First is mobile browser's content size because you need to adjust your layout to fit the size. There is a HTML meta tag called viewport can help you.
Ex.
This script will tell user's browser that the content should be fit the devise size,initial-scale defines the viewport rate and maximum-scale defines how many times this page can scale, and user-scalble=0 means user cannot scale the page. More about viewport you can check the Mozilla's doc.
The other thing you need to consider is the HTML5 techs, but actually these aren't problems when you are using jQuery mobile. I recommend you to check their docs. This is very useful and clear for anyone.
RubyonRails is web application framework - it is running on server and user observer the result of application built on RubyOnRails inside browser(or Browser component), despite the fact that you can process on server just "M" from "MVC", and implement "V" and "C" fully on client side( in mobile browser).
In theory, you can fully deploy RubyOnRails application on client side( even RubyOnRails server and etc), but it will be rather expensive and hard, but it is could not be require in any rational project.
assuming:
There are two way you can choose:
Organize RubyonRails application on the server(process there Model), and process "V" and "C" on client side with any proper js libraries.
You can develop Ruby(not RubyOnRails application) - at least it is possible to develop for Android with JRuby.
Yes you can . Your view can be an web page/android/ ios application as view.
You may want to try jQuery Mobile (which is still in alpha by now) if it's just a matter of UI. If you need a tighter integration with your mobile, I don't think that running Rails would be efficient enough.
Try using React Native, the backend technology can still be Ruby while the front-end can use React Native to build mobile app both Android and iOS.
React Native

Resources