420 Experience
2 Lessons Completed
0 Questions Solved


Posted in Setup Ubuntu 18.04 Bionic Beaver Discussion


There's an issue installing older versions of ruby (<2.4) with rbenv.

Need to use:

sudo apt install libssl1.0-dev

I'm looking to implement a user-customizable roles feature in an application and I was wondering if anyone had any ideas, experiences, or good examples from other apps. I'm looking for ideas for both the UI portion and the backend portion.

I'd like admin users within each account to be able to create, modify, and delete roles for their account. These roles can be fine-tuned for different permissions across the app.

I have some ideas of how to implement this, but I'm always open to new or better ways.

For reference, I plan to use Pundit for the actual authorization of these roles.


I agree. I did try having separate models for templates and non-templates (and all of the associated records), and it was a terrible approach. As you mentioned, it was a lot of unnecessary duplication. Now I just use the same model, with a template boolean. I hadn't thought of breaking it up into different classes, but I may look into that if the need arises.

I still use the deep_cloneable gem, but for a record with a lot of children and grandchildren... it can be slow. I've been using another gem (active record import) for those large records... and it's much faster... although it a bit more setup.

Yes, using the deep_cloneable gem you can add associated records as arguments.

I'm using this the deep_cloneable gem (https://github.com/moiristo/deep_cloneable) and it seems to work pretty well.

Chris, I appreciate the answers. I'll try the .dup method. I agree that operating off existing records is the better way to go... much less duplication in the background.

I'm curious as to what people think is the best to create a new record, or save an existing record... as a template. The template would be used as a starting point to duplicate that record easily and quickly in the future (with associated records).

For example, let's say I have a survey application with surveys, which have many questions, which have many answers. Each user creates their own surveys, but each user might have a few different survey templates (pre-populated questions and answers) they'd like to start from and then edit... rather than creating an entirely new survey each time from scratch.

I see two different approaches for this...

The first is to save existing surveys as templates (still not sure how though), and then create survey's from those.

The second is to create the templates first, then create surveys from those templates.

I think both approaches are useful and I'd like to get advice on how to implement both of them.

Thanks for any help.

Posted in Any good tutorials on using rbenv?

Thanks for the answers Chris.

Posted in Any good tutorials on using rbenv?

Also maybe how to restart fresh with all of my gems (but keeping my current apps working)?

Posted in Any good tutorials on using rbenv?

I setup my rails environment using the ubuntu installation guide found on gorails (amazingly helpful, thank you) but I'm not really sure how to use rbenv.

I have a few rails apps, and I'm wondering how to manage their gems using rbenv. I've cloned a few older apps into my sites directory and I've broken a few things here and there with "Gem::LoadError" popping up saying "You have already activated rake 10.5.0, but your Gemfile requires rake 10.4.2" as an example.

I've looked at the rbenv github and I'm still a bit confused.

I guess my first basic questions would be...

1) If I'm installing a new gem in one of my apps... is there anything special I need to do with rbenv to keep that gem segregated to that app?

2) If I'm creating a new app... anything special I need to do with rbenv?

3) If I'm cloning an app into my sites directory... anything special I need to do with rbenv? As a side question to this... I'm supposed to delete the gemfile lock right?

Thanks for any help.

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.