Vertical table in rails

In this article i have just taken a short example describing vertical table,and its implementation using rails. When table has no fixed column it has dynamic fields .data is not stored on separate column but data stores in vertical fashion. For implementing vertical table table has mainly 2 columns key and value pair.key is like database column name and value contains actual data. Lets take an e.g Consider website in which it contains various products and its comparison ,searching and

Continue Reading

Static pages in rails

Static site using rails As we know rails is mainly used for dynamic website.we can also display static web pages or we can deploy full static website using rails. The following code can help us to display static pages. Step 1:-Create Rails project Step 2:-Generate StaticPage Controller Step 3:- Create StaticPage Class in Model Step 4:- Add following line in routes.rb Here we are passing filename as parameter which is static file name. This will generate url as http://sitename/page/static_filename.html Step

Continue Reading

Generate PDF Using Rails and Flying Saucer

Rails Pdf Plugin act_as_flying_saucer There are various ways to generate pdf documents in any language.In Rails we can use prawn library ,HtmlDoc,PrinceXml and many other library,using their api we can generate pdf document.Basically the primary goal is converting HTML web pages to PDF Document,without much changing existing CSS and HTML. Using the Flying Saucer Project we can achieve this.we can convert HTML + CSS to PDF documents without much changing HTML and CSS. It also support CSS 2 and many

Continue Reading

Rails Observer

Observer classes respond to lifecycle callbacks to implement trigger-like behavior outside the original class. This is a great way to reduce the clutter that normally comes when the model class is burdened with functionality that doesn‘t pertain to the core responsibility of the class. In my project,I have to track certain action (create and update) of user on particular model basically i am maintaining some kind of log, or audit trails.In my application eventlog model has attribute user and body.

Continue Reading

Multiple database in rails

In normal rails application contain one database,but if we want rails application having more than one database that is multiple data base.   we can achieve this using multiple way.one of the way is i am showing here.it’s just 3 steps. Lets take an e.g Project has many milestone and milestone has many task In normal scenario model looks like following way class Project < ActiveRecord::Base has_many :milestones end   class Milestone < ActiveRecord::Base has_many :tasks belongs_to :project end  

Continue Reading

Site Footer