Recaptcha setup and usage with devise
recaptcha is a gem that uses google's CAPTCHA service. A CAPTCHA is a program that can tell whether its user is a human or a computer. To Setup recaptcha on local machine we need to add the gem, gem "recaptcha", :require => "recaptcha/rails" then we need to obtain private and public key by registering to this url http://www.google.com/recaptcha/whyrecaptcha While registration we can choose if we need public and private keys which work on particular domain or we can choose to use it on any domain. Once we have the public and private key we can
Heroku - How to Setup on local
To Setup Heroku on local machine we first need to add the heroku gem using, gem install heroku then we need to add heroku plugins using, heroku plugins:install git://github.com/ddollar/heroku-accounts.git we then need to add heroku account using, heroku accounts:add project --auto where "project" can be any name that’s meaningful to you, the name is only used locally. We can add multiple heroku accounts using the above command, now we need to set the newly created account using, heroku accounts:set project we can use the above command to switch between
Polymorphic associations
Consider a scenario where multiple models has 1 to N relationship with one model. For example. Consider models like School, College, Event and Semester are having multiple relationship with a single model i.e Student. It will not be a good idea to have multiple foreign keys to student model like school_id, college_id, event_id and semester_id into one table. So whenever you have a scenario like this, you have to follow polymorphic associations. For example: In your models i.e school.rb, college.rb, semester.rb and event.rb, define something like this: class School <