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