910 Experience
7 Lessons Completed
0 Questions Solved


Posted in in app notifications using stimulus and ujs

I am still using some jQuery, but here is the stimulus controller I am using...

Posted in in app notifications using stimulus and ujs

yes , I did. Did you have any specific questions about it?

Thanks! Do you use bootstrap and tailwind for the gorails site?

I see a postcss.config.js but no .postcssrc.yml.

Posted in in app notifications using stimulus and ujs

Thanks! Makes me love Ruby more every time I have to jump into Javascript.

Posted in in app notifications using stimulus and ujs

I am attempting in app notifications similar to how Chris did it in the tutorial but trying to update it to use Stimulus but i my data-target doesn't seem to be in scope in the ajax success callback. Here is the relevent code:

  getNewNotes() {
        url: "/notes.json",
        type: "GET",
        success: this.handleSuccess

  handleSuccess(data) {
    const items = $.map(data, note => { return note.template })
    let unreadCount = 0
    $.each(data, (i, note) => {
      if (note.unread) {
        unreadCount += 1
    this.unreadCountTarget.innerHTML = unreadCount


Can anyone point me in the right direction to get this working using stimulus?

Posted in Setup MacOS 10.14 Mojave Discussion

Is the header issue for Mojave resolved? When I run the command sudo installer command listed in the final steps I get the following error: installer: Error - the package path specified was invalid: '/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg'.

I have an app with a ContentCategory model that has_many :contents.  In the ContentCategoriesController#show view there is a button for "New Content".  This goes to the ContentsController#new view which has a select box for the content_category.  Currently this defaults to the first category in the list instead of the desired behavior of defaulting to the ContentCategory of the page before.  Is there a way to achieve this without nesting the resources in routes.rb?

Posted in update a model attribute with ujs

i have a page that displays games(model) with a select box for the game result outcome. Game model has_one :result, autosave: true and
I have a unique id for each row in the table based on the game id and I am using materialize rails which attaches a class of "active selected" to whichever choice is selected in the select dropdown(these correspond to the enum keys. i would like to use ujs to update the result whenever the user selects from the select dropdown. I am haven't done much with ujs in rails but it seems like it should be fairly simple. Can anyone give some guidance on how this would be setup?
result model has:

enum outcome: {
undecided: 0,
white_won: 1,
black_won: 2,
white_forfeit: 3,
black_forfeit: 4,
draw: 5,
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

© 2020 GoRails, LLC. All rights reserved.