Steven Torrence

Joined

4,830 Experience
40 Lessons Completed
1 Question Solved

Activity

Posted in How to use Hotwire in Rails Discussion

Check this out: https://blog.cloud66.com/making-hotwire-and-devise-play-nicely-with-viewcomponents/

I realize this example is using devise and you mentioned Pundit, but I think it might at least send you down the right path. Hope it helps!

Great video! Thanks for making it!

Posted in Episode on GraphQL

This would be awesome!

Posted in jquery doesn't work in js.erb file

Hello! I'm trying to also get jQuery to work in a create.js.erb file. Would I still need to add the code snippet you provided above if I have this in my environment.js:

const { environment } = require('@rails/webpacker')
const webpack = require("webpack")

environment.plugins.append("Provide", new webpack.ProvidePlugin({
  $: 'jquery',
  jQuery: 'jquery',
  Popper: ['popper.js', 'default'],
}))

module.exports = environment

or should I include it anyway? Thanks!

Posted in Rails 6 Form remote: true Error

Hi, all!

I am following along with the video on how to make a chat application using action cable. In the video, I believe Rails 5 is being used, however, I wanted to try it out with Rails 6.

Everything was going great so far. Installed Bootstrap and jQuery and properly configured my environments.js file. It was awesome. Then I get to the part right before we add action cable, and we make the chatroom form remote: true.

I cannot figure out why my form is trying to still submit as HTML instead of JS. On top of that, I am getting an ActionController::InvalidAuthenticityToken error.

Here's how I have my form set up:

<%= simple_form_for [@chatroom, Message.new], remote: true, html: { id: 'message-input' } do |f| %>
  <%= f.input :body, label: false, input_html: { rows: 1, autofocus: true } %>
<% end %>

When I submit, I get this error in my rails server:

Started POST "/chatrooms/1/messages" for ::1 at 2019-10-16 21:02:01 -0500
Processing by MessagesController#create as HTML
  Parameters: {"message"=>{"body"=>"test3"}, "chatroom_id"=>"1"}
Can't verify CSRF token authenticity.
Completed 422 Unprocessable Entity in 1ms (ActiveRecord: 0.0ms | Allocations: 968)



ActionController::InvalidAuthenticityToken - ActionController::InvalidAuthenticityToken:

Started POST "/__better_errors/cf3c4e5c6fa2d1b1/variables" for ::1 at 2019-10-16 21:02:01 -0500

Not sure what to do. I've googled and came across this but I'm not sure if it's entirely applicable: https://stackoverflow.com/questions/56128114/using-rails-ujs-in-js-modules-rails-6-with-webpacker

Any help would be greatly appreciated!

Posted in Flagging Videos with Obscene Content

Hey, all!

I'm trying to take the next logical step for my website.

So far I am using a language filter gem to help catch explict text content on all forms that can be submitted.

I am also using Google's Cloud Vision API to help filter explict avatars and pictures that are being uploaded.

I am, however, stuck when it comes to finding a gem or library to help with flagging or filtering obscene video content. Just checking to see if any one has had any experience dealing with this particular problem.

Thanks in advance for any help you may be able to offer!

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

© 2024 GoRails, LLC. All rights reserved.