Chris Oliver

Joined

291,200 Experience
86 Lessons Completed
299 Questions Solved

Activity

Yeah, you can have a comment as a commentable, allowing you to have Comments with comments if you like. That's how you would normally setup threaded comments. You might want to put some limits on the nesting so you don't get threads that are too far nested in. Facebook limits it to one layer for example.

Heck yes. Let's Encrypt seems awesome, but then when I started poking around it was like okay well this seems a little more complicated than I originally thought.

I'll try setting this up for my personal blog and try to make a tutorial on it.

Posted in data consistency for invitation registration

What I would recommend is that you create a join table for ProductUsers. This will be everyone who has access to the account. You'll duplicate the owner in this list so it's easier to query. You can keep the user_id on the product so that you know who is the owner of it.

When you create that form, you can use like devise_invitable in order to loop through those users and invite them. It creates User records in the database that are saved without passwords. Then it emails out links to set your password to everyone. Since it stores them in the database, you can use those IDs from those records to create the ProductUser join table between those users who don't have accounts yet and the product. As soon as they set their password, they'll automatically have access to the Product.

If you're not using Devise, you can use the same approach and build your own invitation system rather than using that gem plugin.

Make sense?

It definitely does balloon in complexity which is why this is a tradeoff that often isn't valuable until your servers are falling down because you have too much traffic. It's a serious investment coding wise and requires a lot of engineering time to improve performance.

I'm not familiar with the Gon gem, but I would say that if you've got a resource like a BlogPost, you could take your CanCanCan or Pundit scopes and then just simply ask for all the things your view needs (show, edit, update, destroy, whatever you need) and convert that to a JSON object that you can pass to your JS. This way you've got a simple JSON object with a bunch of booleans that can be easily evaluated client side without having to do much logic duplicated on both the client and server.

Sounds like it turned out really smoothly! :D

You could do just one controller and then just make sure to pass in the type into the URL or the form as a hidden field. Then you could use that logic to create an Asset or a Component.

Ha! I'll take it. :)

Yeah. It's helpful to so that you can save the correct type easily, although you don't have to.

I'm not sure I totally understand, but you might consider creating a Component class that inherits from Asset so that you can store all those in the assets table but treat them differently. This is generally called single table inheritance.

http://api.rubyonrails.org/classes/ActiveRecord/Inheritance.html

I think that's what you are looking for?

Posted in Testing your markdown

Also, I posted this in slack, but for anyone else that sees this, I forgot that I'm using Redcarpet instead of html-pipeline anymore. It's because html-pipeline is a real pain to deploy to Heroku (or at least was).

Posted in Testing your markdown

Tables aren't actually part of the official Markdown spec, so you'll see that they don't work all the time. That said, the Github-markdown gem supports it as long as you're rendering as github formatted markdown. I believe mine is but I haven't tested it.

Are you running gfm: true as well?

Posted in Deploy Ubuntu 16.04 Xenial Xerus Discussion

Unfortunately they haven't released a package for xenial yet. It's on their todo list, but they said by June at the latest. That's a long time from now.

Here's how you can install it manually: https://www.phusionpassenge...

Oh, I see what you mean. You could do that just as well, no particular reason either way.

Posted in How to use the Sentimental gem

That could be slow, or go over the Twitter API limits, so you'd want to do that in a background job for sure. In that case, I would just load the local copy of Tweets for that game.

When you do a search and save a Tweet, you can save the keyword you searched and link it to the game, and you can also save the tweet_id so that you can use that on the first_or_initialize or however you'd like to do that.

It will be application specific, but stays in the app's directory so you can keep it nice and organized next to the code.

Posted in How to use the Sentimental gem

Whoo! :)

So if you want to analyze user input, you can just setup your models like normal with your controllers. The callback will automatically analyze it.

For example, you mentioned articles. If you just have your normal scaffold or controller, all you'll have to do is add the callback to your model and the attributes and they will get automatically analyzed anytime the text is changed. Then you can just access the sentiment and score attributes like you would with any other attribute. That's it!

I would imagine feeding things into Google's Prediction API would be pretty great. It might be a bit more involved for than these gems, but is probably worth it if the machine learning aspects are important to your product. Hopefully get dive into that soon.

Any reason you're using an old version of html-pipeline? It looks like 2.4.0 is the latest version. That is probably the source of the issues, just mismatched versions. If you use an old html-pipeline, you'll probably need equivalent versions of the other gems from around the same time.

I think every Wistia account offers the same features for the player stuff. You can try it on their free account to be sure though.

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.