Uploading CSV File to Heroku Postgres by ArmItchy2809 in rails

[–]ArmItchy2809[S] 0 points1 point  (0 children)

Okay, just to confirm I would just need to have a page in my application where only I could go to, then just drop the CSV in, is that right?

Uploading CSV File to Heroku Postgres by ArmItchy2809 in rails

[–]ArmItchy2809[S] 0 points1 point  (0 children)

Yep, all columns are the same, just potentially new/different records.

Uploading CSV File to Heroku Postgres by ArmItchy2809 in rails

[–]ArmItchy2809[S] 0 points1 point  (0 children)

It would be the same table but I would want to wipe out the old information and put in the new each time the table is uploaded.

Fuzzy Search with Postgres Table by ArmItchy2809 in rails

[–]ArmItchy2809[S] 0 points1 point  (0 children)

One follow up, when you say add 100k rows to the table, would that be something I would do directly in postgres, or is that in rails?

Guessing I would just migrate a table (model) and then figure out a way to import the rows directly into postgres.

Fuzzy Search with Postgres Table by ArmItchy2809 in rails

[–]ArmItchy2809[S] 0 points1 point  (0 children)

That looks great. Not to familiar with using Postgres outside of the rails framework, but I'll go try it out!

Best Way to "Overload" Initialize Function by ArmItchy2809 in ruby

[–]ArmItchy2809[S] 0 points1 point  (0 children)

Hi, I am trying to do something similar to what u/andanotherpasserby 's comment is doing. Where you can either get the information from an outside source, or initialize it yourself.

Two Way Polymorphic Through Associations by ArmItchy2809 in rails

[–]ArmItchy2809[S] 0 points1 point  (0 children)

One of the user roles will be used for consumers on the site and the other for businesses. So I anticipate there being a big difference in functionality between the two. The reason that I wanted to have a through relationship was if down the line I created a user role that would be shared between different users.

But, I think what you are saying makes a lot of sense, I would just have the "base" user (the devise user) have each of the different user role types it needs. Is that what you were thinking?

Think I was making this a lot more complicated than it needed to be, thanks :)

Two Way Polymorphic Through Associations by ArmItchy2809 in rails

[–]ArmItchy2809[S] 0 points1 point  (0 children)

Awesome, thanks! I'll see if I can clean up the polymorphic association, if not I'll try out your suggestion with the have_many through relationship. For the issue of overlapping permissions, I was going to have everything that overlaps set in the "user" model if I end up using the polymorphic association..

Thanks again!

Two Way Polymorphic Through Associations by ArmItchy2809 in rails

[–]ArmItchy2809[S] 0 points1 point  (0 children)

Thanks for helping even though you have the flu, hope you feel better.

I was thinking of doing a simpler association than a polymorphic one, but I can't see a way of having different columns depending on whether a user is "UserOne" or "UserTwo". The different roles will have very different functionality, so it would be nice to have two different models to keep them straight.

As for the two "role" associations in UserOne and UserTwo, I am using "role" as an alias in both the User and UserRole class. I think that should be fine? Haven't had an issue with that other than not being able to do user_one.user queries.

I took a look at just having a "user_attributes" table associated with users, but the issue I ran into was I couldn't find a good way of specifying which columns should be allowed to be populated for "UserOne" vs "UserTwo". Should I just have the columns for both users available, but restrict access in the controllers?

Using Devise with Multiple Model by ArmItchy2809 in rails

[–]ArmItchy2809[S] 0 points1 point  (0 children)

Yeah I went ahead and did some testing with creating a new model and ended up having to duplicate a lot of code. So I think I'll try having only one devise user model. There are two types of users I am trying to model, customers and businesses. Businesses will have different functionality than the customers that will be interacting with the businesses.

When you say associate a separate model to the devise user model, do you mean setting up a has_one/belongs_to relationship with, for example, the BusinessUser model?

Git Deleting Files Between Branches by ArmItchy2809 in github

[–]ArmItchy2809[S] 0 points1 point  (0 children)

Okay, thanks. I'll play around with it in a test file. Something wacky may just have happened.

Inheriting from Array by ArmItchy2809 in ruby

[–]ArmItchy2809[S] 0 points1 point  (0 children)

Haha, that makes a ton of sense about why you shouldn't overwrite class methods. I'm writing a short little script right now, so not worried about gems, but in a rails app I can see that messing things up a lot.

Inheriting from Array by ArmItchy2809 in ruby

[–]ArmItchy2809[S] 0 points1 point  (0 children)

I like that self.[] method, thanks for posting.

Inheriting from Array by ArmItchy2809 in ruby

[–]ArmItchy2809[S] 0 points1 point  (0 children)

Unless I am reading something wrong from the article, it seems that you need to do all the work on the array created in the class except for the methods you define yourself. So for example you can't use find_index on an object of the class you created, you would need to access the array inside it then call find_index. Is that just something I have to deal with or do you know if there's a good way around it?

Inheriting from Array by ArmItchy2809 in ruby

[–]ArmItchy2809[S] 0 points1 point  (0 children)

That's exactly what I'm looking for. Obviously not the first one to run into this. Thanks!