I haven't done any work building mobile apps with Rails, but I followed the very informative RailsConf demo from Sam Stephenson on Turbolinks 5 as a tool for building cross platform Apps with rails, Turbolinks 5 Demo and it looks great. The only part I can't replicate is how to get the "Turbolinks.framework" file that needs to be embedded in the iOS app shell.
The documentation at github's Turbolinks-ios page refers to a number of package managers for iOS (Carthage and CocoaPods) with which I am unfamiliar, or alternatively suggests "building Turbolinks manually and linking to my project." I think he demos the linking part, but no idea how to "build Turbolinks manually". Can someone give me a clue?
I have never done straight development like that. But I have done something different using Rails.
All you need is creating React-Native app web view implemented and pass url to rails pages (make sure rails app supports mobile responsive css). Including there you can benefit turbolinks events. It will save your precious time, and also, faster development!
Turned out to be very straightforward to install cocoapods and then use that to install Turbolinks-ios as mentioned on the git hub page.
Related
I just want to share with you an uncomfortable situation that I'm having right now and ask you for advice. It turns out that I'm developing a kind of old project by using rails 3.2 and ruby 2.0. Until now, as usual I've been creating the view layer with haml markup language. Recently I was assigned to implement a new set of UI requirements that seems to be a little complicated. So I was wondering if I could use the react library to do that. I'm using the react-rails gem to facilitate the integration and it works fine. But the problem comes in when I try to use a third party library like react-dropzone or react-modal or whatever react library. I have not been able to get it to work neither using rails-assets gems nor downloading directly the /dist files and require them with sprockets. Some of the errors that I get are:
typeError: undefined is not an object (evaluating 'webpack_require(3).unstable_renderSubtreeIntoContainer')
Can not find module 'react'
I don't know if I can easily setup a webpack server to compile these react libraries and then can be used along with react-rails and the specific version of rails 3.2. I've searched about the subject and I found the webpacker gem but it requires at least rails 4.2. I appreciate any comment or observation about what should I do.
I've finally solved my problem by using react_on_rails gem which allows an easy integration of React + Webpack + Rails, and also includes the server side rendering option.
I know I can view the sourcecode for a website by clicking on "View Source" or "Developer Tools". I was interested in learning more, so I looked for some Chrome Extensions.
I downloaded "RailsPanels", but it seems like I can only use that by including a gem in my gemfile. This also doesn't show the Ruby on Rails sourcecode, only the standard HTML, CSS and JavaScript.
I'm interested in viewing the actual Ruby on Rails code of a website. I would like to know if there are any ways I can do this, or any extensions?
I have researched Developer Tools extensively and searched for this on Google. Unfortunately, I could not find what I was looking for.
That's not possible because the Ruby code of the web site is never sent as part of the request made by the browser.
If you want the source code of a Rails application, it would be better to contact the owner directly.
This may be a really dumb question but I've been searching the interwebs and haven't really found much helpful information. I have CodeKit 2 and I want to use Wordpress and Bootstrap in a project. I've never used Bower before but it looks really cool and I thought I'd give it a shot with CodeKit. I installed Wordpress, JQuery, and Bootstrap through the assets tab in my project and they installed into bower_components. In the video from Bryan Jones showing off Bower, he says not to move anything out of that folder or CodeKit won't see it as an asset anymore.
So my question is: how do I go about building my project from here? Obviously I don't want to have to run from the bower_components folder to do everything. In the Bower docs it says the easiest way is to just statically link the components you want. But I don't really understand how that would work with Wordpress and it seems like there'd be a better way to do it with CodeKit.
Thanks for the help!
There is no need to use Bower to manage wordpress, since wordpress can update itself very easily.
I think the best approach to building a WP site with Codekit is described in this tutorial: Use CodeKit 2.0 for Local WordPress Development.
Basically:
setup wordpress locally, any way you like, and use MAMP or AMPPS to serve the site.
drag your theme folder into Codekit - the theme is the project.
In the Browser Refreshing section of your project settings, use the external server option. Paste in the local URL for your new WP site.
Here's an article with some details.
Basically you just need to install bootstrap.less and variables.less in your /less folder, and then point your #import commands to your /bower_components folder. While you technically are running things out of /bower_components, after it's set up, you'll never know the difference.
The most useful thing about having wordpress connected to Bower is that you can just get the files downloaded quickly without having to grab the latest zip.
It makes sense to move the wordpress files to the top level, or where ever you are used to putting them.
I have a website which need a mobile version.
I decided to use Sencha Touch 2.1 to create it.
I found the following Gem but it is clearly outdated.
So my question is do you know an easy way to integrate Sencha Touch with Rails Assets Pipeline?
The fact that the app needs to be built made me put it in the public directory for now.
Thanks.
I do not think Sencha Touch is a good use case in this scenario.
For a mobile version of a web application I would recommend switching to a framework with a responsive grid system such as Zurb foundation or Twitter bootstrap.
If you are still insisting on using Sencha Touch I would recommend creating a subdomain, such as http://mobile.domain.com and then serving the static files from something like S3, you can then use Sencha Touch to consume your Rails API.
How am I supposed to use bootstap with rails 3.0 rather than >= 3.1 ? is there any plugin which supports rails 3.0 ?
I think all of the bootstrap gems require Rails 3.1 or greater. I recently had bootstrap on a 3.0.10 Rails app using the Less.js file that you download from their site: http://lesscss.org/. This is the simplest most basic way to use Twitter-Bootstrap; the file compiles all of your "my_file.less" files into css on the client side.
However, if you want to modify the variables (which is the real power of using this framework) than you need to compile it. You can take a look at this Less compiler: http://wearekiss.com/simpless. I've never tried that, but I hear good things about it and it works on Mac, Linux, or PC.
Probably the easiest thing to do - if you want to compile the code on server side - would be to upgrade your project to Rails 3.1.1 and just use one of the Twitter Bootstrap gems. This is actually exactly what I ended up doing. I was able to update my app to 3.1.1 and I used the Boostrap-Sass gem (just because I slightly prefer Sass).
If you decide to upgrade, follow this RailsCast: http://railscasts.com/episodes/282-upgrading-to-rails-3-1
It helped me a lot.
Ryan Bates also offers a video on how to incorporate Twitter Bootstrap into a Rails app: http://railscasts.com/episodes/328-twitter-bootstrap-basics.
Here's a link to the Sass version of Bootstrap that I am currently using: https://github.com/thomas-mcdonald/bootstrap-sass
Many solutions : you can upgrade to rails 3.1+, might be the better (not the easier, depending on you app) way. You can include the static files yourself if you don't intend to change anything that is handled at the less level. You can do it even if you intend to, but you'll have to recompile the files yourself (or find a way to automate it). Finally, there might be a gem out there that is compatible with rails pre-asset-pipeline, or an old version of a gem. You'll have to look for yourself if you absolutely want a gem.