Introduction

Background
Since the appearance of smart-phones, mobile development has been done in separate islands, with each island having it's own set of traditions and languages, "Objective-C", "Java", ".Net"......


So the demand for a cross platform technologies has increased, and indeed a solutions emerged, in this article I'm going to explore the main three technologies out there, "rhodes", "PhoneGap", "Titanium Appcelerator".

How it works?
Despite the fact that each smart phone speaks a totally different language than others, they share one great advantage, that's they all have a web browser, so they all understand HTML, CSS and JavaScript.


So, this is the entry point for any technique targeting cross-platform, all of them are frameworks target the smart phone's web browser, but they differ in details, which we'll be discussing later.

In previous rails versions, to prevent cross-site scripting, the h helper method must be called explicitly to escape the output to the response body. The rails_xss plugin replaces the default ERB template handlers with erubis, and switches the behavior to escape by default rather than requiring you to escape. This behavior is consistent with Rails 3.0. Install rails_xss using the following commands:

sudo gem install erubis
ruby script/plugin install git://github.com/NZKoz/rails_xss.git 

Skipping cache for POST actions in Apache

February 3rd 2010, 1:49 amCategory: Rails 1 comments

If you used page caching in a site that implements RESTful interface, you may face a problem. You could have multiple actions that share a single URL with different HTTP methods. For example, showing a document is served at /documents/1, while updating the same document is also at /documents/1. When I'm trying to update a document, the request is something like:



PUT /documents/1


If your Apache is not well configured, it may respond with a cached file at /documents/1.html. This is wrong because this file should be served for GET requests only. In fact, POST, PUT and DELETE actions should never be cached because they change server state. Investigating in this issue, I found the following snippet at my .htaccess file.

Among the three methods of caching views in Rails, I particularly prefer page caching. The main advantage of page caching is that it is delivered by the web server without accessing your Ruby on Rails server. In this blog post I'll describe how you can keep two separate caches: one for pc browsers and one for iPhone. You can easily extend it to support more than two versions.

Prerequisites

In this tutorial I assume you are using Apache to serve your application with mod_rewrite and .htaccess files enabled.