John Munyi


2,650 Experience
10 Lessons Completed
0 Questions Solved


Need rails 6.1.0 and above to access user.signed_id in case somene is having issues with that

Posted in Incorporating an Admin Dashboard

Hi Dave,

I believe this is what you are looking for

Posted in Our First API (Example) - GoRails

Awesome video Chris, cant wait to dive deeper :) Authentication especially

Posted in dymanic data filter with jquery

Hi Chris I want to replace the create action of my app with dynamic jQuery data pulling so that user has a chance to see the data pulled from the DB before the actual create happens , so currently my create action is then one doing all the dirty work but incase a user abort before updating then a dirty record is saved here it is

  def create
     @attendance_sheet =
     @team = Team.find(attendance_sheet_params[:team_id])
     @team.users.each do |u|

     respond_to do |format|
        format.html { render :edit }
         format.json { render :show, status: :created, location: @attendance_sheet }
         format.html { render :new }
         format.json { render json: @attendance_sheet.errors, status: :unprocessable_entity }

NB: I am rendering edit to give the user to update the pulled record of user accordingly ..... the attendances records added here are via nested attributes (not sure if it necessary to have that actually)

Now I am some jQuery in the line of :

 $(document).on 'ready page:load', ->
   list = $('.attendance').html() //this is the div to didplay users list from selected team
   $('#attendance_sheet_team_id').change ->

      team = $('#attendance_sheet_team_id :selected').text()

    //here now i wanna match the selected team with it users and show the hidden div with all the users from that team in it , this is the bit where i am stuck .. on how to grab the nested from and query as well 


Posted in Dynamic select boxes with Rails 4

Hi chris,

The issue is with how the form fields are added , I am using gem cocoon and they have an in built method to help sort that out ..

     cocoon:before-insert: called before inserting a new nested child
     cocoon:after-insert: called after inserting
     cocoon:before-remove: called before removing the nested child
     cocoon:after-remove: called after removal

Posted in Dynamic select boxes with Rails 4

Hey there I am trying out a dynamic select box with rails 4 and I am stuck on where to put the js code because the form exists in a nested form. So should the code go in the js file for the form accepting nested attributes or to the js file named as the partial of the data.

see my partial code below and js as well


     <h4 style="text-align: center">Select Job Queue</h4><br>
           <div id="project_queue_id" class="field">
             <%= f.label :project_name %><br>
             <%= f.collection_select(:project_id, Project.order(:project_name), :id, :project_name, include_blank: true) %>
           <div id="job_queue_id"class="field">
           <%= f.label :job_name %><br>
             <%= f.grouped_collection_select(:job_id, Project.order(:project_name), :jobs,  :project_name, :id, :job_name, include_blank: true) %>

  jQuery ->
    jobs = $('#job_queue_id').html()
    $('#project_queue_id').change ->
     project = $('#project_queue_id :selected').text()
       options = $(jobs).filter("optgroup[label='#{project}']").html
     if options

Will appreciate any pointers, I am not getting any errors but the data is not getting filtered as well

Posted in Nofications screen cast

christophe, thnks for the response but i thought to create a notification in the DB I only need the controller action for Notification.create() as per the tutorial the json part comes much later but for the Notification to be available in the db isnt it only what i have done ?

Posted in Nofications screen cast

Hi Chris ,

I am following the notifications screen here :
all is well no errors but when i create a post the notifications arent being created, any guidance ?

my code can be found here


Posted in lazy high charts gem

Hi there,

I have been tinkering lazy high gem trying to get charts up and running, it works well with hard-coded data into the chart but when I try passing data dynamically i cant make some headway. Here is my code the example on the gems page aren’t helping much i am trying to use raw js for now ....


Posted in In-App Messages Between Users Discussion

Nice episode Chris , worthy mentioning mailboxer doesnt work with sqlite3 you have to use postgres or mysql

Hi Chris finally made it work with q = Date.strptime(params[:query], '%Y-%m-%d') unless params[:query].blank?

then just passing q to the where clause in the controller .
Thanks Man

Hi Sacko,

Mind posting your params method from the controller for Vente or what the params is actually is when its being pushed to the db

HI Chris , I have hit another block while in my controller i am doing this

        @weekly_performance_reviews ='*', where: {  week_start:                      
[:query], '%Y/%m/%d') })

I am getting an error " no implicit conversion of String into Integer"

cheers man

Hey Chris,

My syntax had an issue i wasn’t using where, thanks man all well now

what i mean is if i am searching for a record dated .. "2016-03-04" and enter "2016-03-05" i still end up with the same results, you know how elastic search corrects the search for you ?

so i was wondering how i can lock the search to an exact match

ok cool..... will check again what i am missing ... or should exact match be more efficient ?

HI Chris,

I implemented elastic search using search kick gem and all went well from search, autocomplete and suggestions when dealing with text.

Now i wanna perform a similar search on table that all columns are dates and integers is it possible .. i have tried tinkering with it but its yielding nothing, any ideas

Posted in Displaying previous score in current record

Hi Chris,

So i finally got a work around to this issue of overwriting the last value on every-record, i wrote a custom method to track the id of the current record and then returns the prev one, this is called directly on the view now. Here it is

      def prev
          self.user.weekly_performance_reviews.where("id < ?", id).last

with the above now, on the view i can call

                     <%= @weekly_performance_review.prev.kpi_quality_next_target %>

which returns the score of the specific previous record , any other efficient way we can modify this ? so far it works though

Posted in deeply nested forms

Hey Chris i am tinkering with deeply nested forms, all is well but I can manage to render the show with all 3 forms in one ... esp the last form. when its added I get non method error and i am sure the modelling is ok , or isn’t not a hierarchical like this

I can nest B in A and C in B so calling something like @A.B.C should be fairy resolvable. hope this makes sense.

Posted in Implement a hash tags like feature in rails

Hi Chris looks like, is working brilliantly straight out of the box with now issues , happy to report

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2021 GoRails, LLC. All rights reserved.