Rails 3 · ruby · Ruby On Rails

Naming conventions on Ruby & Ruby on Rails

Ruby Naming Conventions Local VariablesLowercase letter followed by other characters, naming convention states that it is better to use underscores rather than camelBack for multiple word names, e.g. mileage, variable_xyz Instance VariablesInstance variables are defined using the single “at” sign (@) followed by a name. It is suggested that a lowercase letter should be used… Continue reading Naming conventions on Ruby & Ruby on Rails

JavaScript · Rails 3 · Ruby On Rails

Comparition of Adopting Unobstructive Javascript and XSS in Rails 2 & 3

Cross-Site-Scripting in Rails 2 <%= @post.body %> –> Unsafe <%= h @post.body %> –> Safe Cross-Site-Scripting in Rails 3 <%= @post.body %> –> Safe <%= raw @post.body %> –> Unsafe Adopting Unobstructive Javascript Example 1 : Rails 2: <%= link_to_remote ‘Show’, :url => post %> Will generate a HTML like, “<a href=”#” onclick=”new Ajax.Request(‘/posts/1′, {asynchronous:true,… Continue reading Comparition of Adopting Unobstructive Javascript and XSS in Rails 2 & 3