Tutorial by Examples

View tables ActiveRecord::Base.connection.tables Delete any table. ActiveRecord::Base.connection.drop_table("users") ------------OR---------------------- ActiveRecord::Migration.drop_table(:users) ------------OR--------------------- ActiveRecord::Base.connect...
Any method in Rails model can return boolean value. simple method- ##this method return ActiveRecord::Relation def check_if_user_profile_is_complete User.includes( :profile_pictures,:address,:contact_detail).where("user.id = ?",self) end Again simple method returning bool...
Sometimes we want to use a where query on a a collection of records returned which is not ActiveRecord::Relation.Hence we get the above error as Where clause is know to ActiveRecord and not to Array. There is a precise solution for this by using Joins. EXAMPLE:- Suppose i need to find all user ...

Page 1 of 1