Monthly Archives: July 2012

all valid field types in rails

string text (long text, up to 64k, often used for text areas) datetime date integer binary boolean float decimal (for financial data) time timestamp Active Record supports the following database column types: :string :text :datetime :date :integer :binary :boolean :float … Continue reading

Posted in rails, ROR, ruby on rails, web development | Tagged | Leave a comment

Naming conventions while creating tables in rails

1) database tables should be named with the plural form of the names of your model class Example 1 Model Class:- Order Table name: orders Example 2 Model Class:-Person Table Name:- people 2) database tables with all lowercase table names … Continue reading

Posted in rails, ROR, ruby on rails, web development | Tagged , , | 1 Comment

Passing ror data to javascript

1) In view file <body data-lat=”<%=@address.lat %>” data-long=”<%=@address.long %>” onload=”loadMap()”> in javascript/jquey file function loadMap() { lat=$(‘body’).data(‘lat’); lng=$(‘body’).data(‘long’); } 2) In view file <%@mapdata= Map.find(:all,:conditions=>”catagory=’historic’”) %> <%  @mapdata.each do |c| %> <%=link_to “#{c.name}”,’#’,:class => ‘my-link’,:”data-lng”=> “#{c.lat}”,:”data-lat”=> “#{c.lng}”%> <% end %> … Continue reading

Posted in rails, ROR, ruby on rails, web development | Tagged , , | Leave a comment

Heroku deployment rails 3.1 – isn’t precompiled error

Add the following  line to the production.rb file config.assets.precompile += %w( public.js public.css  )     http://www.klairvoyant.in

Posted in rails, ROR, ruby on rails, web development | Tagged , , | Leave a comment