Abhinay kumar


2,910 Experience
28 Lessons Completed
0 Questions Solved


super neat video about hotwire and for the first time no bugs related to hotwire during the recording(or a sharp video editing) :P. Also, 1.25X speed is the best

Posted in Date Picker for Rails App

Posted in Dependency Inversion Principle Discussion


This should return the path to file in this format: /users/avatar/xxx/xx/original/filename
Also, in my case i had to use something like:
file_path = k.send(value).path.split('/system', 2).second
because it exists locally and path had system as a prefix.

Posted in Searchick filter with scope

I was facing the similar issue and adding the field to to search_data worked for me. In my case I needed to filter records based on institute_id of the creator of a Course.
sharing the solution below:

In course.rb model

# elastic search client to query for partial strings
    searchkick word_middle: [ :name, :description, :instructor_name, :unit_name, :play_list_name ]
    scope :search_import, -> { includes(:creator, :units, :instructors) }

    def search_data
      name: name,
      description: description,
        unit_name: units.pluck(:'units.name').reject(&:nil?),
        instructor_name: instructors.includes(:teacher).pluck(:'users.name').reject(&:nil?),
        play_list_name: units.includes(:play_lists).pluck(:'play_lists.name').reject(&:nil?),
        institute_id: creator.try(:institute_id)

In my controller:

@items = Searchkick.search search_params[:search], operator: "or",
                                                index_name: [Course],
                                                where:{institute_id: institute_id},
                                                fields: ['name^100', 'instructor_name^100', 'play_list_name^70', 'description^50', 'unit_name^50', 'institute_id^100' ],
                                                match: :word_middle,
                                                misspellings: {below: 5, edit_distance: 2},
                                                page: search_params[:page],
                                                per_page: 20,
                                                order: {_score: :desc}

@Thomas M,

Looks pretty good alternative but I am not very familiar with Go so it might eat some extra time. Is there a Rails way of implementing Streams(Roshi/Go) ?

Hey Adrian and Chris,

I am about to integrate the similar feature(activity feeds) for one of the app, I thought public_activity would be a good choice. Can you please tell me why its not a good chioce. may be I can save myself from some frustration :P

Posted in why destroy action is called two times.

Faced the same isssue, culprit was Turbolinks..be careful with the naming of your "ready" functions and also try not to use the same name everywhere. All you need not use is "turbolinks:load" mostly.

Posted in Admin Interfaces with Administrate Discussion

Yeah, I agree..was thinking of something like a 'destroy' command from rails..thanks for the video @excid3:disqus

Posted in Admin Interfaces with Administrate Discussion

really like the UI and simplicity of this Gem but yeah i think its too early to adopt..I couldn't find a command to remove all the files it has generated..is there any?

Cool!!, thank you so much, just in the right time. from last few days i was looking for a process to package a javascript lib which i really wanted to have as a gem.