Marc Gayle

Joined

730 Experience
4 Lessons Completed
0 Questions Solved

Activity

Posted in Code Review: Run Number Refactoring Discussion

Just watching this Episode Chris and I must say I love it.

I look forward to watching more.

I hope you still do Refactorings!

I would love to see you create a gem for this on screen.

Another thing I have been curious about is how you prep for each episode.

Perhaps you could do a meta-episode, where you show the episode and then after you show the prep that goes into that episode also? 

Just so that not are we learning, but we are learning new ways to learn by watching you prep to teach, if that makes sense?

Posted in Stimulus JS Twitter UI: Part 2 Discussion

I think this is a great idea. Perhaps redoing the '@mention' episode you did many months ago, but using Stimulus -- so you do autocomplete on some character trigger or in a search box -- would be a cool thing to see....I think.

Also, Stimulus and other popular gems (say SimpleForm).

Posted in Stimulus JS Twitter UI: Part 2 Discussion

+1

Posted in Stimulus JS Framework Introduction Discussion

Have a link to those comments by DHH about stimulus? Would love to hear his thinking.

Thanks!

Posted in Using ActiveAdmin to Build an Admin UI Discussion

Hey @disqus_RYFYDXZ9Pd:disqus where is the security vulnerability for Administrate? Not seeing a new version since Oct 28, at 0.3.0. Am I missing something?

Posted in Searchick filter with scope

So what worked was:

[31] pry(main)> query
=> "*"
[32] pry(main)> Profile.search(query, where: { status: :published}).count
  Profile Search (8.3ms)  curl http://localhost:9200/profiles_development/_search?pretty -d '{"query":{"bool":{"must":{"match_all":{}},"filter":[{"term":{"status":"published"}}]}},"size":1000,"from":0,"timeout":"11s","_source":false}'
  Profile Load (3.5ms)  SELECT "profiles".* FROM "profiles" WHERE "profiles"."id" IN (14, 22, 29, 26, 24, 25, 21, 34, 5, 9, 33, 4, 15, 27, 35, 36, 38, 6, 16, 39, 46, 7, 18, 13, 28, 23, 31, 37, 17)
=> 29

Posted in Searchick filter with scope

Interesting idea Chris....but still getting the same issue:

[83] pry(main)> Profile.where(status: 1).search(query).count
  Profile Search (19.8ms)  curl http://localhost:9200/profiles_development/_search?pretty -d '{"query":{"match_all":{}},"size":1000,"from":0,"timeout":"11s","_source":false}'
  Profile Load (13.8ms)  SELECT "profiles".* FROM "profiles" WHERE "profiles"."id" IN (14, 22, 24, 25, 26, 29, 52, 5, 9, 12, 21, 33, 34, 4, 6, 15, 27, 35, 36, 38, 7, 13, 16, 18, 28, 39, 46, 17, 23, 31, 37, 47)
=> 32

Posted in Searchick filter with scope

Hey Chris or Christophe,
I am having the exact same problem, where the empty query on my indexed model is returning all records rather than the records in my scope.

How exactly should the updated search_data look?

For context, this is my Profile.rb model:

enum status: { unpublished: 0, published: 1 }

And this is what I tried with my search_data.

  def search_data
    {
      name: name,
      bib_color: bib_color,
      player_type: player_type,
      school_name: school.name,
      age: age,
      status: published,
      position_name: positions.map(&:name)
    }
  end

And even after I reindexed my Profile model, I am still seeing unpublished records show up in my empty query.

[66] pry(main)> query
=> "*"
[67] pry(main)> Profile.search(query).count
  Profile Search (50.0ms)  curl http://localhost:9200/profiles_development/_search?pretty -d '{"query":{"match_all":{}},"size":1000,"from":0,"timeout":"11s","_source":false}'
  Profile Load (2.8ms)  SELECT "profiles".* FROM "profiles" WHERE "profiles"."id" IN (14, 22, 24, 25, 26, 29, 52, 5, 9, 12, 21, 33, 34, 4, 6, 15, 27, 35, 36, 38, 7, 13, 16, 18, 28, 39, 46, 17, 23, 31, 37, 47)
=> 32
[68] pry(main)> Profile.published.count
   (0.7ms)  SELECT COUNT(*) FROM "profiles" WHERE "profiles"."status" = $1  [["status", 1]]
=> 30
[75] pry(main)> Profile.where(status: :published).search(query).count
  Profile Search (10.9ms)  curl http://localhost:9200/profiles_development/_search?pretty -d '{"query":{"match_all":{}},"size":1000,"from":0,"timeout":"11s","_source":false}'
  Profile Load (1.4ms)  SELECT "profiles".* FROM "profiles" WHERE "profiles"."id" IN (14, 22, 24, 25, 26, 29, 52, 5, 9, 12, 21, 33, 34, 4, 6, 15, 27, 35, 36, 38, 7, 13, 16, 18, 28, 39, 46, 17, 23, 31, 37, 47)
=> 32
[80] pry(main)> Profile.published.search(query).count
  Profile Search (23.8ms)  curl http://localhost:9200/profiles_development/_search?pretty -d '{"query":{"match_all":{}},"size":1000,"from":0,"timeout":"11s","_source":false}'
  Profile Load (9.3ms)  SELECT "profiles".* FROM "profiles" WHERE "profiles"."id" IN (14, 22, 24, 25, 26, 29, 52, 5, 9, 12, 21, 33, 34, 4, 6, 15, 27, 35, 36, 38, 7, 13, 16, 18, 28, 39, 46, 17, 23, 31, 37, 47)
=> 32

What am I missing?

Thanks!

Posted in Shrine Backgrounding and Video Transcoding Discussion

One mistake in this video Chris is that you set the filetype for the screenshot to be ".mp4" as opposed to "jpg". Not sure how it still worked, but I noticed that.

Or was that intentional?

Any further ideas Chris? Still no dice :(

I just did that, so now I have it on both and no dice. I updated the question with the logs of the profile#index page refresh when it is added to both.

Sorry, I put it around the local variable when the partial renders each time:

`<% cache [params[:rating], profile] do %>`

Around the collection, the index is just `<% cache @profiles do %>`

Got a chance to check out the SO link?

Chris, I have replied twice and both times Disqus has marked it as spam. Should I go ahead and put the response to this question in my SO question?

Edit: I just added the logs it to the SO question, so you can refresh it.

How would I save them as separate caches? My partial is `cache profile do`, would I change that to `cache [params[:rating], profile do`? Or did you have something else in mind?

I have tried the above version and it doesn't work properly. It still messes up the views when I switch between my `/profiles` and `/profiles?rating=speed`.

Edit: For more details, here is my Stack Overflow question: http://stackoverflow.com/qu...

That guy had the same suggestion you did, but that doesn't work :(

Hey Chris,
So you can ignore my comment on the other thread because I found this.

One thing I am running into is cached results when I use filters in my params.

For instance, using your List example. Say your root_path is List#Index. But you also could tag your lists. So say you had a tag for 'rails', which basically just re-rendered your List#Index but changed the value of the `@lists` collection to just include the lists related to the tag `rails`.

How do you tackle Russian Doll caching in a scenario like that, where the views are identical, no partials or any data changes, the only thing that changes is the filter param in the URL?

Thanks again for all the wonderful work you do.

Edit: Oh and to make my scenario a bit more complicated, what actually happens is when a filter param is present, the results it shows on the `List#Index` is actually different based on the role of the user requesting. So just adding the `edit` link to the `rails` list, if the user is an admin, but if the user is a regular user that `edit` link on the `rails` list doesn't show up.

Posted in Russian Doll Caching with Rails 5 Discussion

Awesome episode as always Chris.

What about the implications of using roles for some content within a partial that is cached? E.g. say I have a section that I only want to show to `current_user.has_role? :teacher`, but another user that doesn't have the role teacher is also viewing that page at the same time.

How does the built-in Russian Doll Caching stuff play with that scenario?

Edit: Actually Chris, I see that you did that already in the 'Advanced Caching with User Permissions and Authorization' epsiode. Thanks much and pleas ignore this question :)

Posted in Liking Posts Discussion

Hi Chris,
Why did you decide to roll your own liking system rather than using `acts_as_votable`?

Posted in Inviting Users with devise_invitable Discussion

Awesome episode as usual Chris.

How would you modify this to do a single click invite? i.e. say you are looking through a list of users and you want to "invite them" to your project or w/e, how would you do that?

Just create a new action on ProjectUsers controller, pass the email associated with that link that was pressed and then execute `User.invite!`?

The reason I am asking is that I was trying to pass params to the devise_invitable controller and it seems to be more tricky than you would expect it to be on the surface, so I am trying to explore other ways to do do what i am trying to do.

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.