Shaun Fahey

Joined

140 Experience
0 Lessons Completed
0 Questions Solved

Activity

Posted in In-App Messages Between Users Discussion

Great episode mate, nice one.

Posted in How would you improve these db's and associations

Hey @tabish

Category’s haven't been a problem for me in the past, I’ve done about a dozen prototype applications using them, the difference with this application is the amount of different category’s in the app. Like I said, I'm just scratching my head at the moment trying to think of a way to combine the four category’s into one, just not sure how to go about it yet.

I'm not using tags because there's not really any point, most tags would only find one thing, which you can already see when you selected the category you want.

When you say tables that's kinda what I’m after, each table/section/div on the main page would have one of the four category’s, and a different page to break each one down, but in each category the way I’ve done it above I’m always pulling from it from it's own category, instead of one main category model, i'm not sure if I could do that where everything is so different, for instance, a body wax isn't a massage :)

Posted in How would you improve these db's and associations

Database Structure

Hello people. I have my first proper paid Rails project to start soon, so I’ve been thinking about the database and the associations.

The two links below are the databases and the associations I’m thinking about.

http://thebackworksclinic.com/treatments.html

http://thebackworksclinic.com/jessica.html

This is what I’ve got in my README

Database Structure

1. User - Devise

  • name:string
  • bio:string
  • email:string
  • phone:integer
  • password:string

  • has_many :massage_treatments

  • has_many :massage_categorys

  • has_many :lava_treatments

  • has_many :lava_categorys

  • has_many :essential_treatments

  • has_many :essential_categorys

  • has_many :nail_treatments

  • has_many :nail_categorys

BODY MASSAGE TREATMENTS

2. MassageTreatment

  • user_id:integer
  • massage_category_id:integer
  • name:string
  • description:text
  • lenght:string
  • tagline:string
  • price:decimal{10,2}

  • belongs_to :user

  • belongs_to :massage_category

3. MassageCategory

  • user_id:integer
  • name:string

  • belongs_to :user

  • has_many :massage_treatments

LAVA SHELL TREATMENTS

4. LavaTreatment

  • user_id:integer
  • lava_category_id:integer
  • name:string
  • description:text
  • lenght:string
  • tagline:string
  • price:decimal{10,2}

  • belongs_to :user

  • belongs_to :lava_category

5. LavaCategory

  • user_id:integer
  • name:string

  • belongs_to :user

  • has_many :lava_treatments

6. EssentialTreatment

  • user_id:integer
  • essential_category_id:integer
  • name:string
  • price:decimal{10,2}

  • belongs_to :user

  • belongs_to :essential_category

7. EssentialCategory

  • user_id:integer
  • name:string

  • belongs_to :user

  • has_many :essential_treatments

8. NailTreatment

  • user_id:integer
  • nail_category_id:integer
  • name:string
  • description:text
  • lenght:string
  • tagline:string
  • price:decimal{10,2}

  • belongs_to :user

  • belongs_to :nail_category

9. NailCategory

  • user_id:integer
  • name:string

  • belongs_to :user

  • has_many :nail_treatments

Am I thinking about this correctly or not?

I can't help thinking I could simplify the categorys, because everything belongs to a category, but each category is completely separate as far as the treatments are concerned. If she wanted to add a category (offer a new service), that could be added to the category table from it's own controller/views, and then have a collection_select on the form, to pick a category when she adds a new treatment.

The more I think about it the more confused I get because i'm not sure how i'm going to pull the data out, I was thinking about a treatments dropdown menu on the navbar to pick Body Massages > Lava Shells > Essentials. But, how would that work if I had one category model and wanted to filter by category?

Also, If you look at the Essentials section on the site, that also has the two logical categories of Male and Female, the more I think about this the more I’m convinced that what I have above isn't the best way to do it, it would work but it just doesn't feel right.

Any suggestions would be great.
Regards, Shaun

Posted in 2 Factor Authentication

2 Factor Authentication has saved me recently with a couple of attempts on my PayPal and Twitter accounts, but as I use a YubiKey I was ok. To answer your question i've only had a quick look at the gem, but they use this https://github.com/samvincent/rqrcode-rails3 gem to generate the QR-code representing the user's secret key.

However, they also talk about sending an SMS, not sure if that's Twilio and you can also use a mobile application such as Google Authenticator for the key. Personally I think it would make a great series, making an app that stores sensitive information/data and takes a payment or something like that.

I'm off to bed now, it's 22:30 in the UK.

Posted in 2 Factor Authentication

Good. I'm glad you liked the idea :-) It's becoming really important to have an extra layer of security with loads of different sites getting compromised these days. I'm looking forward to that tutorial.

Posted in 2 Factor Authentication

Hey Chris. This would be good for a screencast, well i'd like to see it for sure!
https://github.com/tinfoil/devise-two-factor

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.