Blog Posts

Dynamically updating selectlist using Jquery and Ajax

In many web site we have seen that on selecting country, state or city list is updated. In this article i am showing how to update children select list on changing parent list. To do this i am using jquery and ruby on rails.although it will works for almost all languages For this article, I am updating city list on changing states. So one state has many cities,and city belongs to state. and city_list.xxx gives following html on processing state

Continue Reading

Select/Deselect Multiple CheckBox Using Jquery

In many website we have seen that on checked or unchecked one box all the check box are checked or unchecked. Now in this article i am showing how to checked unchecked all the check box In this setting checked attribute true/false alternatively by clicking on select/deselect for alternate removing and adding class not_checked depending upon that we are setting true and false

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

How to include another html page into existing html page using jquery

We can include another html page using jquery load method example is as shown below <html xmlns="http://www.w3.org/1999/xhtml">    <head>       <title>Loading an Html page</title>      <script src="jquery.js" type="text/javascript"></script>     $(document).ready(function() {         $('#loadpage').load('load.html or any server side page');     }); </head> <body>    <div id="loadpage" ></div> </body> </html>

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

Construct a link to use GET variables to instruct the script to execute a certain function

Here it is how we can do that magic, if( isset($_GET[‘function’]) ) { switch( $_GET[‘function’] ) { case ‘dosomething’: dosomething(); break; case ‘dosomethingelse’: dosomethingelse(); break; } } And then link to script.php?function=dosomething url rewriting Benifit : When a search engine visits the dynamic url like product.php?id=test it does not give much importance to that URL as search engine sees “?” sign treat it as a url which keeps on changing. so we’re converting the dynamic URL like the product.php?id=test to

Continue Reading

Site Footer