Some Of My Favorite Ruby Gems

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hey guys this is an impromptu video that I'm doing yeah it's kind of the end of the year of 2019 I'm wrapping up a few things working on some bigger projects so trying to put more content out but I'm really focusing maybe on building that up as more of a scalable thing in 2020 to come next year so with that I'll I recently published like a year in review on my blog maybe go check that out it's only in written form I didn't feel like doing the video for that cuz I think there is more more to say there than a video would actually grant me but this video is about some of my Ruby favorite ruby gems and you've probably seen me use a lot of these before maybe some you haven't I use these I would say on most of my projects the ones that make sense to use some are obviously ad hoc that you just need for a given thing like chart kik for example which we'll talk about but I just wanted to go over these I think it's always curious or interesting to see what other people who are in the framework of Ruby on Rails or Ruby reach for and this is no exception so I think my idea of using gems I like the concept of using them sparingly if I can create the logic myself and or extend it in such a way that it's just something that I can add to the app I'm gonna try to go that route but if it ends up being a big time-saver or something that just doesn't make sense to try to make myself then I'm definitely gonna reach for a Jim there's pros and cons with that as as with anything gems go out of date especially Ruby gems a lot of people don't maintain them that create them and it's mace basically do just because there's so much work to maintaining one so if you can or no have the know-how definitely contribute where possible keeps the community alive keeps rails and everything yeah I know as strong as it is as a framework and Ruby of course so digging in you've probably heard of this one before I'll get right to it is devised I'm really not going to run through each of these gyms per se like installing them using them I'm just gonna talk about them if you need to see something like that as a walk through maybe mention in the comments or let me know I think their most most straightforward if you see the documentation definitely experiment where you can that's how I ended up learning how to use each of these so it just takes some time and some research and unfortunately that's you know one of those things you have to do to learn so it devised I I have it open in this window it's we've used it here on the channel before it's basically an authentication library that's very extendable and easy to integrate it comes with tons of stuff under the hood that you could use in terms of like a confirmation workflow like confirming a user account this recoverable password stuff registering handling tracking users I don't know that you'd want to do that but it's possible and then you can add this like Omni auth stuff which I've done in a previous video or we integrated like Twitter into our app we can sign in with a social media provider or any provider that uses Omni off concept so that's the gist of devise it's really I think we've gone over it enough in my wreaths previous videos that I think you all understand it if you don't definitely check out a playlist I have that's honestly extending device or using it in such a way that's more custom this one I use in a previous app it's called Kin Kin Kin i think it's originally written by ryan bates who made rails casts and the concept here is different user roles with an easier model so there's this concept of defining an ability class that grants a user certain abilities that they can perform so say you have for instance a blog and you want if you come maybe from the WordPress era or place there's like that subscriber role there's the contributor role there's all those different roles this is kind of that concept but in Ruby on Rails but very extendable you can just make it a certain axis and initialize method here as you can see and just create these mess that can say if the user is an admin they can read the post and etc so certain permissions can be very customizable and then interviews you can you can just just as easily check those things to view certain things and there's these handy helper can and cannot so definitely check out the documentation it's pretty straightforward to lock down a controller for instance it's typically you might use something like devise but in this case you would use this load and authorize resource method that allows you to go ahead and use those roles and you know check if that user if they're logged in and signed up in a certain a certain persona I guess you could say have access or read access to write access etc so you can customize that to your heart's content I've used this maybe one or two times before I've haven't really need a huge use for it cuz I haven't built so many use cases to have a user that has many specific roles in an app it's usually like the base user or the like an admin role or something like that which is just honestly a boolean in the end so it's not a big deal there the next one these are no particular order by any means but the next one I had was chart kick which is a suite library that's honestly like a drop-in and I like that it's actually up to date so with rails 6 you can just add the chart J's right library right away and then just render these methods and your views to just get some awesome data based on some columns you pass to it so if you get a a specific user you can group by the specific day and create it at account so all these things come with this library different types of charts as well so that's really great in terms of like maybe an admin level if you want to see you start to get some feedback on your app more people are joining or whatever you're doing and more users are coming in you can see real real data around that at a glance as opposed to like doing actual command line search and stuff like that with SQL or something like that so this is nice to have you definitely don't need it but it's one that is honestly a very simple installation and easy to use and it looks good too so with that we have one call to annotate I like this one a lot another one that's just a nice to have but essentially when you create models and rails typically it generates the model file as you would if you use a generator say you generate a model rails generate model and then some columns on that model this will actually annotate what those are so say you have a typical model you put a quantity in that generator and say it's an integer it'll actually tell you what's going on with that and and do so in the model itself instead of you having to go searchers schemin dot RB file and or tinker in the database just to find these things so I find this really helpful when you're doing your migrations you'll see this stuff update automatically and it'll just be a set of Ruby comments that you see in the model files and I find it really nice because I could stay within that file and I have to go hunting search to make sure I called something a certain name or just forgot to actually add it or something like that so really cool to have I yeah typically put it in the development environment you certainly don't want this in your production environment wouldn't really make sense so that one's a quick one after that friendly ID have used before it's a great way to make your URLs and a given app pretty and the way I tend to use it is like say a blog post or a post of whatever the record would be and they give an app I would use that as the slug and you can find whatever existing column in the database and use that as the slug it kind of mirrors it and uses that as the URL itself it really helps for things like SEO and just honestly sending a link to someone they can really obviously remember like what it would be as opposed to a number which is the default in rails it's usually like an ID number which isn't so intuitive and kind of annoying in other words so it works pretty nice you get this actual new scope that's called friendly that you need to append to your controllers that allows it to scope and find by whatever you declare in your model so the IDE is is using the name attribute that you've already added to your user model and uses that for the slug so you need to append a slug what's it called column to your database and then this will map that name field to it and just create like an actual slug that presents itself in the URL as you would expect so it all happens behind the scenes but it's a super handy feature that I add to pretty much every app I use because I care about SEO and the URLs just being really easy to read especially of stuff where you find people sharing links from your site or to your site etc you really want that next is another one another one that I use for SEO like every app is called meta tags it's really helpful for adding the the bulk of the stuff that you don't feel like writing to your app it helps with making this more dynamic but you set meta tags so your title attributes your description keywords etc on a given web page are really necessary for SEO and Google and search BOTS to crawl your site and understand what the site has what kind of content it should display and refer to when people search for things so I would say this is a game changer for getting the organic traffic to your web app whether you're trying to do that or not it should be probably a focus once you get going this is something I added towards the end of building and given out but it's not anything that you need to focus on immediately but it should be in the back your mind I think just because once you launch you want to have this stuff in place so people can find it easier and just share it easily or like so if you threw a link into slack and you have say a Twitter card image or an open Open Graph tags etc you could have that stuff predefined and it would show up in that preview that you see and just be all ready to go so it's really nice those things and it's less headache later to worry about so definitely recommend adding that one it's very straightforward I think there's just a handy display metatags helper and the view you can end and then tons of options here you can append to that - you know customize how that looks and whatnot so I remember my tags and it ended up being like about 30 or 40 lines long it's not uncommon for it to be that big because you think you focus on things like Facebook or Twitter where people might share things you want to give them that rich experience when they do so this helps dramatically with that and I recommend it Impressionist I don't use this a ton but I've used it to do some actual impressions on views and a given page so if you create an app and want to just get actual impressions on either clicks or views or unique views you can do so with this Jim that's pretty handy it is something you want to cache because the organic views of that can kind of get skewed in a bit if you just constantly click through you just gradually that number would tick up I've ran into issues with that before but there are ways around it and the guide here it has a counter cash itch that you can declare that allows for that it's pretty straightforward otherwise I remember I use this on a let's build with the dribble clone kind of thing where we got annotations on the likes and the views of the shot in the view and this is kind of that that use case I would say so something like that but yeah it's called Impressionists it's pretty straightforward the next is one I'm using I'm gonna use currently I haven't used it a ton yet but it's something I've been looking for like a Ruby on Rails draft concept there's a gem called paper trail that does something like that that's wrapped around the idea of versioning your records I want something more along the lines of a blog posts where it's versioning but it's in the nomenclature of post are like published draft or private etc you can add all these different scopes to it to do different things so that's kind of where I'm coming from then this one I could add that myself and it's pretty straightforward it's just kind of adding like a boolean attribute or some sort of status attribute only given post and then not displaying it or displaying it relative to that but this actually does some versioning too which is really cool so you might check this out it's it's newer to me so I don't know a ton about it but I'm digging in and it looks like it's pretty extendable so I'm trying to deter I'm excited to try it out but there's all these built in methods that I would rather not create myself and have just ready to go which is why I think I'm gonna use it so you could see how he could actually scope maybe what you're gonna display based on these different live settings or trashed or publish and it just automatically handles that query and displays the say interviews whatever you want relative to whatever things are live or drafted or published etc so that's that's pretty cool Jim try and pry rails pry is another way to debug in a ruby environment by bug is one that comes by default at most rails apps it's in your development group in your gem file and it's great to just throw that into the mix like say in a controller when you're running action say committing some sort of form and it'll actually just halt the process so you can go into your console and debug what's going on see say you're trying to pass parameters through or something and you don't get the ones you need but you need to figure out why this is great for that by bug does that great but pry goes like one step further and gives you a few built-in methods to run to show certain things about your app or gives you some nice color preview in your console of like the SQL going on when those things render it's really neat so pry is actually the main thing doing the work there the other gem here is pry rails which just makes it easier to add to a rails app otherwise you'd have to add some initializer code manually and in fry rails is just a bundle install Jim kind of thing that does it for you so I link to those there's nothing really to see behind the link other than the main the main page is there but yeah pay is a new one by my buddies Chris and Jason I think Jason originated this thing but it's a it's a new gem for payment processing in the scope mainly for subscription payments but it does work for basic charges too and the idea is it uses Braintree and stripe as the payment engines and then inside it comes with all these helper configuration methods and stuff that you just include as like a actual Ruby class that's billable and then you can have some actual configuration just basically the stuff that you'd see on invoicing and stuff like that and then within you can even create your own email templates and and receipts and stuff too which is cool but the general idea is to just dumb down the concept of adding stripe or Braintree to a given app and just making it trivial so you can you get all these certain processing or certain methods on a user and can create charges with just these it's like honestly just a few keystrokes which is really cool I haven't used it a ton I know it's a newer gem it's probably not listed in in most places you might find other gems but I think it's gonna get some praise pretty soon because they're they're actually working on it and it seems really really extendable and usable and yeah I'm excited to try it out coming up so hats off to those guys for this let's see remind me later male catcher so nothing really all like me amazing about this Jim it's one that you just install globally and go with it it runs on this local host at port 1080 and it just works well when you need to send emails locally and test them out I found it to be the one that I've used the most that the last release was in 2016 it's old but my god it works great and as they say if it ain't broke don't fix it so there are other ones out there I think one's called letter opener and one's called mail hog or something like that or this one's based off of that one I can't remember but honestly it's it's just been quick and easy to install on a rails app you just go into your development environment locally add these couple of lines and just boot up this make sure you install is Jim and boot it up here and then if you're sending emails this will catch them and you can read them and test them out there so really recommend it in terms of just sending the emails rails has its own email preview which is great but it doesn't do the whole sending and and you can't can't check with like a black background processing kind of gym like sidekick or something with this so definitely recommend this this is one I just I've used it since the beginning and I probably won't change that unless something breaks given that it's from 2016 things might change coming up so we'll know soon enough so yeah that's one of my favorite ones there red carpet I had this mostly as an admin tool to most of my apps I like to write and markdown on the back end so if I add markdown in areas where I need to author content or blog posts or whatever it's ten almost ten times out of ten is gonna be a markdown driven form and red carpet makes that pretty seamless and easy so it just renders this as HTML on the front end via Ruby of course so you get all these built-in methods and options you can add that just allows you to customize what you do render and what you don't you can even render the table format from like github and stuff too which is nice but yeah it's pretty straightforward yeah mark don't love it let's see axes vota Bowl I've used this on other apps for various things it's as you can imagine either like an upvote or downvote on two particular things but you can also use it as like a favoriting tool I found so you can query by like say they upvoted thing and you only have up votes on your site then you can go query from that and just like display a list of their favorite things at that point point so it's the same as like liking it in a case so like as an example I had originally a tutorial site where people could favorite their favorite tutorials and then in their account they could see the feat of what they favored it instead of having to go and find it on the site or search for it etc just seemed like a cool and easy easy thing to add that's just honestly a few few lines a bundle install and and you're ready to go so recommend that one too the same is true for taggable recently have been rebuilding web crunch comm 2.0 that's currently it's WordPress but I'm going to push it towards being a Ruby on Rails driven app yes so I have my other app it's gonna be Ruby on Rails and my idea is to go ahead and try it and this Jim is the Sims focused on tagging and the idea is to make it very extendable and drop-in ready on my current app that I'm working on that's the web crunch 2.0 version is I actually rolled it myself which is more of a blessed Endemol idea as this but more my own way of doing it so it's it's one thing that I said that if I can do it myself like I said in the beginning that I'm gonna try to but otherwise reaching for a Jim like this is not a bad choice because it has so much potential to you know just make your app that much better if you need tagging of any sort so it's really great and extendable so there's I mean it's not much more to say other than just check out the docs it's straightforward as I can see here you can actually get a query of most and least used which is nice pretty cool stuff unread this one is pretty neat if you use kind of a messaging system built into rails I would say most probably reaching for something like this today are gonna go some-something javascript driven that's real I'm going to be like chat instead of actual like sending an email message but this way you can like get notified if someone views something if it's read like a message or document or comment and once they do maybe you send an email and let them know or something like that just dependent on your use case so that's really neat and I find it quite easy to integrate you just add a few lines to your models and a method if you want for the scope if it's only admin or whatever and then go from there so once you create a new message you can mark it as read and it just kind of does this thing and then from there if you want to notify people you can actually make a mailer that does that specific cueing and me you know goes down the list and notifies those people so I find that pretty useful if I had some sort of concept of messaging or viewing of something that needs to be a notification that isn't just real-time I think this would be a good fit for that so I haven't used it a ton I've just recently used it and I'm really liking it so far so I'm throwing it in the you know recent gems I've used maybe not my favorite but just one of I'm liking so far without a doubt home brew and home brew cask are my favorite Jim I would say it's something in any new computer I get it's the first thing I install so I can go and install any packages I need whether it's Ruby or RB MD or Rails or anything like that and then homebrew cast makes it easy for a Mac user to install the typical apps you would normally go download that dmg file and this does it all which is the command so you do like what is it homebrew install or brew install your app what is it brew cask install your F I think that's what it is and it's so streamlined and fast and easy you don't need to open a file mounted eject it after you're done installing it copy file over your applications folder it's just that all process seems backwards to me so this makes that streamlined it's more of a developer tools so someone that the people who aren't developers probably would be like there's no way I'm using that so I get it but yeah those two without a doubt or my initial first and and continuously use Jim's of all time so I think this is called patchy I'm gonna say Apache recently switched from will paginate it used to be my de-facto pagination gem I don't need to paginate a lot but paddy is way more faster as you can see and that's what kind of sparked my interest in it really is just performance so pagination could get kind of resource heavy I guess you could say and this one makes it a little nicer and easier to use in terms of paginating anything in your rails app so I recommend it and it's quite easy to integrate it looks a little funky here to throw this in your controller but that's how it actually looks and then you just render it here you can you can actually customize the partial - that comes with it which I've recently done for the blog I'm working on so it's pretty cool a sidekick of course is a background processing gem it's used by tons of folks and I think one guy runs it which is awesome there's a pro version it's basically what I use for anytime type of background processing mostly for me emails you don't want to send those all at once your your server would just bust basically if you send a ton of emails especially you need to give it the concept of queueing that stuff up and that's what sidekick does it allows you to scale your app pretty fast and and get things just thrown in a queue that operate and then in a constant loop I guess you could say it's really useful and yeah I'd really recommend it there's a default active job in Ruby on Rails but there's the way you install sidekick is as an adapter to that and it kind of hooks into the integration and enrolls with it from there and I just like it more it's got the GUI interface that you can see real things happening or if there's stuff that you need you're like retry jobs that failed you can do so from the interface and it's really useful I typically mark that as authenticated only by admins in my apps so you can log in as you as long as your admin and see that interface so really recommend it finally and this is this list isn't exhaustive it's not every Jim that I would use I've used many more but whenever Jim is a great way to do cron job stuff so maybe you need to run emails at a specific hour every specific month or week or whatever send out newsletter I don't know whenever is a great tool for that it's very simple to set up and and Ruby logic behind it is obviously simple as you might expect so it's it reads like English every day at 4:30 a.m. and 6:00 p.m. run this model and then you know perform some tasks whatever it may be usually a rake task that you add to your rake folder I haven't done anything like that on the channel but maybe I'll get into something like that or you can run this task and it's automated and it's very useful and you can sleep at night knowing it will go assuming you don't get errors or anything happens to the server and whatnot so typically you would combine whenever with a rake task with something like sidekick to do all your processing streamline it and run that however often you want basically and this allows all that to kind of queue up and do do its thing so it's really great yeah so that is the exhaustive non exhaustive list I should say there's so many more gems out there you should check out but these are the ones I've definitely used in my time few are very new to me but I'm gonna use them more and I'm excited to get going with those if you have any gems that you like and want to shout out definitely throw them in the comments I'd be interested to see your favorites as well so I think that's it guys if you have any questions for me or want me to cover something in particular with regards to maybe these gems or something future definitely let me know and as always thanks for watching you
Info
Channel: Web-Crunch
Views: 3,982
Rating: 4.9694657 out of 5
Keywords: ruby, ruby gems, ruby gems 2019, ruby on rails, rails, devise, pagy, whenever gem, sidekiq gem, homebrew, cancancan gem, pay gem, ruby on rails 2019, learn ruby, learn ruby on rails, ruby tutorials, ruby on rails tutorials, devise ruby on rails, Some Of My Favorite Ruby Gems
Id: IqF_JVEfhuc
Channel Id: undefined
Length: 29min 4sec (1744 seconds)
Published: Sun Dec 15 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.