Preloading associations while using find_by_sql

To preload the associated records we generally use #includes, #preload or #eager_load for more information please see this blog This will work perfectly if we preload associations for an ActiveRecord::Relation, but in case if we want to load associated records for an Array, these methods will fail Let's consider this example class Company < ActiveRecord::Base has_many :users end class User < ActiveRecord::Base belongs_to :company end Say we have a query, which is performing joins and also have sub queries, then we would need to use find_by_sql, to generate the query. But find_

Integrating datepicker and timepicker with active admin

In one of our apps, the requirement was having a datetime field which will allow user/admin to select date and time in active admin. So the very first option which I had that was to use existing gem, http://github.com/saepia/just-datetime-picker But this gem doesn't seem to be maintained since last year, so this option was ruled out! The next option was creating DateTimePicker manually using gem "jquery-ui-rails" and then adding .js and .css.scss files in active-admin, this solution was also not working for me! We found one gem gem 'pickadate-rails' documentation can be