Tabish Iqbal


6,070 Experience
17 Lessons Completed
5 Questions Solved


Posted in How to use Hotwire in Rails Discussion

You using link_to or button_to ?

Posted in Auto-removing notices from a turbo_stream

Do you mean like a flash notice? you can do it as a

function myFunction() {
  setTimeout(function(){ alert("Hello"); }, 3000);

Posted in What is the best way to learn React JS? has a beginner and advanced React courses thats up-to-date.

Hey - this is all I had to do to get it working. If you're on slack I can send you a video of how that looks.

Hey Matthew, kinda old but did you figure this out? From what I gather you're trying to have one drop down where when the user selects a value it updates values in another dropdown. If so hit me up as I have a working example of this.

Posted in Introduction to Stimulus Reflex Discussion

SR does allow you to update the whole page, selector or nothing. For the whole page morph it will re-run the controller action. Not sure how it would work with Calendar events but more info can be found here:

Posted in Realtime Nested Comments: Part 3 Discussion

How does this work with someones avatar thats uploaded using activestorage? I get the following url for the image

where the was set in application_controller_renderer.rb. Even after replacing it to "localhost" it still doesn't work. When you do a full page reload all the avatars show up.

Posted in Realtime Nested Comments: Part 2 Discussion

Not going to lie I hear some beeping sound or popping sound and then raise my right or left arm depending on which ear I heard it in. Am I the only one hearing this or what? It's low key making me do the hearing test...

Posted in How to use Hotwire in Rails Discussion

do you have a /assets/javascripts/libraries folder? installed it for asset pipeline or webpack?

Posted in How to use Hotwire in Rails Discussion

prob the best xmas gift he got...

Howdy. You can have your static marketing pages in the same app if you like. The way I have done it is have routing constraints. IE

class MarketingSite
  def self.matches?(request)
    request.subdomain.blank? || request.subdomain == "www"

class App
  def self.matches?(request)
    request.subdomain.present? && request.subdomain == "app"

Rails.application.routes.draw do
  constraints(MarketingSite) do
    root "static#index"
    get "/pricing", to: "static#pricing"
    get "/contact", to: "static#contact"

  constraints(App) do

And then you will have a views/layouts/static.html.erb which will be used by the static controller like so:

class StaticController < ApplicationController
  layout "static"

Posted in Row-level Multitenancy with ActsAsTenant Discussion

You can let people sign up using devise but accept a nested attribute for company and get the company name on the signup form as well. Company has many users and user belongs to company. Another thing is having a join table so

Company: has_many company_users
CompanyUser: belongs_to company, belongs_to user
User: has_many :company_users, belongs_to company, through: company_user

Posted in Row-level Multitenancy with ActsAsTenant Discussion

If it's not a healthcare app or where it's required that data needs to be separated then row based.

Posted in Trouble with a lending library query

No problem! Yea the states I had were much more and I ended up using the gem but your stuff works so glad I could help!

Posted in Trouble with a lending library query

Hey Peter! What you want to do is have a state/status column on your Book. This way the initial state is 'Available' and then when a check-out record is created that state/status on the book can be changed to "Checked-out". When someone is returning that book and you update the 'checked_in_at' datetime column you can update the status of the book back to Available.

This way you don't have to do weird queries but can just query for all books that are 'Available" or "Checked-out"

With AASM I was able to do something like this:

aasm column: :status do
    state :available, :initial => true
    state :checked_out

   event :checkout do
      transitions :from => :available, :to => :checked_out

    event :checkin do
      transitions from: :checked_out, to: :available


On book's you would just have an aasm column or a status column which is of string type.

Posted in How to use Uppy with ActiveStorage Discussion

Masud - Currently working on this with Ahad using Shrine + Stimulus

Posted in Uppy Video

Share your code. Give some background - using active storage etc.

Was having issues with this but found out behavior was changed from Rails 5. You have to now add the following in your application.rb file:

  config.active_storage.replace_on_assign_to_many = false

Notes on this can be found in the change logs here:

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.