Skip to content

Ganesh's TechBlog

A Technical Note

  • Home
  • Ruby Tutorial
  • About Me
Main Menu

Ruby

Rails ActiveRecord search records between two dates

September 5, 2018 - by Ganesh Kunwar - Leave a Comment

Yeah, this is simple in Rails. date = Date.today start_date = date.at_beginning_of_month end_date = date.at_end_of_month Model.where(:created_at => start_date..end_date) This gives the records created in current month. This is simple because rails save created_at and updated_at in following format: created_at: “2018-09-03 09:49:41” But here in my …

Read More

Build a beautiful Active Admin interface using Active Admin themes

May 12, 2018May 14, 2018 - by Ganesh Kunwar - 1 Comment

As we know Active Admin (https://activeadmin.info) is a popular Ruby on Rails plugin to generate admin interface.  It has many benefit over currently existing other similar plugin like Rails Admin. Active Admin gives the facility to customize pages, layouts. Here is simple demo of Active …

Read More

Install and Use Ruby Gems

February 25, 2018 - by Ganesh Kunwar - 6 Comments.

Ruby gems are the ruby third-party libraries that are created for special purpose. For example, in web application if I want to display large number (>500) of data in a single page, I have to use pagination. For this we have special library build in …

Read More

Rails tips: ActiveAdmin access filter collection

February 20, 2018February 21, 2018 - by Ganesh Kunwar - Leave a Comment

Since ActiveAdmin uses Ransack for search, we can use Ransack to grab filter collection using their params. This is old method but it works fine to my Rails 5.0.0 and ActiveAdmin 2.0.0 version. ModelName.ransack(params[:q]).result Here is an example controller do def index if params[:q].present? && …

Read More

Run Cron job using whenever gem in production server

February 16, 2018March 25, 2018 - by Ganesh Kunwar - Leave a Comment

The software utility cron is a time-based job scheduler in Unix-like computer operating systems. We can schedule cron job to run specific job in a particular date/time. For ruby we have whenever gem to run those cron job. These are the processes to run whenever …

Read More

Rails Tips: ActiveRecord Conditional Validation

February 14, 2018February 14, 2018 - by Ganesh Kunwar - 1 Comment

In my User model, I have to check validation presence of state only for users from Nepal. No need to check validation for the users from other country. For this I have implemented as follows: class User < ActiveRecord::Base validates_presence_of :state, :if => :in_nepal? private …

Read More

Conference I attended: RubyConfIndia (Ruby Conference India)

February 12, 2018May 12, 2018 - by Ganesh Kunwar - Leave a Comment

RubyConfIndia (http://rubyconfindia.org) is a global event complementing other RubyConf events across the world. This is India edition of ruby conference. This year RubyConfIndia was happened in Bangluru on 9th and 10th Feb 2018. I got chance to attain this event. The event was started with …

Read More

Ruby Gemset

January 30, 2018February 13, 2018 - by Ganesh Kunwar - Leave a Comment

What is Gemset? A Gemset is just a container you can use to keep gems separate from each other. We create separate gemset for different project which only have required gem with version for the particular project. It is a separate directory with version of …

Read More

Rails tutorial: Upload image with paperclip gem

January 27, 2018May 14, 2018 - by Ganesh Kunwar - Leave a Comment

Paperclip is intended as an easy file attachment library for Active Record. Paperclip is ruby gem which helps to upload image or attachment in rails application. We can upload attachment using paperclip gem in rails through following steps. Add paperclip gem to your Gemfile gem …

Read More

Why college projects are important?

January 17, 2018February 13, 2018 - by Ganesh Kunwar - 1 Comment

In my career I had taken more than 100’s of interviews in my company and the number is raising up. Most of candidate are freshers and some are experienced developers. Fresher candidate apply for entry level job whereas experience developers apply for mid-level and senior …

Read More

Posts navigation

1 2 Next

Subscribe my blog

Thank you!

Popular Posts

  • Rails check_box_tag set checked with condition value
  • Rails tutorial: Upload image with paperclip gem
  • Build a beautiful Active Admin interface using Active Admin themes
  • Use both MongoDB and MySQL database in rails project
  • Rails ActiveRecord search records between two dates
  • Run Cron job using whenever gem in production server
  • Rails tutorial: Send email with rails
  • Rails tutorial: Simple blog subscription feature in Rails
  • Ruby Tutorial Syllabus
  • Setting MySQL database to Rails Application

Tweets on #Ruby and #Rails

Tweets about #ruby #rails

Scrum Ceremonies

https://www.youtube.com/watch?v=J2So36K_-Q8

Recent Comments

  • Otto Benitone on Install and Use Ruby Gems
  • Marco Hosteller on Install and Use Ruby Gems
  • Piers C on Build a beautiful Active Admin interface using Active Admin themes
  • Caron Phipps on Rails tutorial: Send email with rails
  • Mariela Schuette on Install and Use Ruby Gems
  • Bennie Regina on Install and Use Ruby Gems
  • Rufus Wehrley on Rails tutorial: Send email with rails
  • Larry Spece on Install and Use Ruby Gems
  • Ganesh Kunwar on Login to remote Linux server with private key
  • Jan Zac on Login to remote Linux server with private key
Copyright © 2019 Ganesh's TechBlog.
Powered by WordPress and HitMag.