cartdrige has quit [Quit: I am more peaced off than a dragon trying to blow out candles]
<Doc_X>
I've got a rake/ActiveRecord migration question (no rails, just rake db migration). I'm using the a gem (`Departure`) to do my mysql DB migrations and I want to pass some configuration to it when the `load_config` step happens.
<Doc_X>
I tried to add the config via `config/initializers/departure.rb`, but that is being called on startup by `rake`, then my config is overwritten by the defaults later on. I know I could add something into the migrations, but I know there's gotta be a better way to configure this in a central location.
<Doc_X>
I've done a fair bit of googling and SO reading, but everything I see either talks about some rails modification (which isn't applicable for me), or modifying the individual migrations. Any chance someone has a pointer to some config doing this kind of thing I could look at?
cartdrige has joined #ruby
yxhuvud has quit [Remote host closed the connection]
yxhuvud has joined #ruby
John_Ivan has joined #ruby
cartdrige has quit [Ping timeout: 272 seconds]
Mikaela has quit [Remote host closed the connection]
Mikaela has joined #ruby
sam113101 has quit [Ping timeout: 260 seconds]
Synthead has joined #ruby
Shortstop has joined #ruby
<Shortstop>
hey there, can someone help me figure out the nested routes I have for my rails application, and how to access 'location' properly?
<Shortstop>
Here's my frontend function trying to create a location for a specific party, its a React frontend, but its just JS for this part: https://bpa.st/RYHQG
<Shortstop>
When I try to create a location via that workflow above, I get this in the Chrome web developer console: AddLocationForm.js:19 POST http://localhost:4000/parties/1/location 404 (Not Found)
<Shortstop>
Is it because I should have had 'locations' (plural) instead of 'location' for the nested routes above? I ask this because I really only want a single location for a party though, so I'm a bit confused
<ox1eef_>
Shortstop: run 'rake routes' and you will see what it expects.
<Shortstop>
Cool, thanks I'll try that
<Shortstop>
its a rails project, so I think rails routes would be good too
<ox1eef_>
'rake routes' is a Rails rake task.
<Shortstop>
POST /parties/:party_id/location(.:format) locations#creat
<Shortstop>
POST /parties/:party_id/location(.:format) locations#create
<Shortstop>
Interesting, I thought that's why I'm doing within the fetch request on the frontend though in the same format... weird
cartdrige has joined #ruby
<ox1eef_>
I don't see why that's a 404 then, maybe the controller is being hit but the record is not found
___nick___ has joined #ruby
<Shortstop>
Durr on my end, I didn't even specify the create function on the 'locations_controller'
<Shortstop>
Sorry about that, sometimes its a lot of moving parts. You're right the 'rails s' logs pointed to the fact that the 'create' method didn't even yet exist on the 'locations_controller'
___nick___ has quit [Client Quit]
<Shortstop>
Thanks for the heads up on 'rails routes', that made it very simple to figure out what routes I could even use
<Shortstop>
I'm having such a hard time figuring out how to really access 'location' as its supposed to be tied to the 'party' in my project
<Shortstop>
I'm able to create one with that fetch request without an issue, and I can see it in 'rails c' console as well. I just am having a hard time wondering why the 'parties' GET result shows items, yet no locations. Its so weird
<caleb>
close but no cigar, those are the v1 bindings
<caleb>
but they'll do as a starting point if I can't find the other one
markong has quit [Ping timeout: 260 seconds]
crax23 has joined #ruby
cartdrige has quit [Ping timeout: 246 seconds]
finsternis has joined #ruby
ur5us has joined #ruby
<Shortstop>
So I reworked my project to make it so that location pretty much models the middle tier relationship like the item model
<Shortstop>
When I try to make a POST request to the backend to '/parties', I get this error: https://bpa.st/OMXOS
John_Ivan has quit [Read error: Connection reset by peer]
<Shortstop>
Related Party controller with byebug present in 'create' method that doesn't even hit the byebug for some reason: https://bpa.st/3V4VW
<Shortstop>
Here's my current entity relationship diagram in comparison: https://ibb.co/wpwTzhS
John_Ivan has joined #ruby
<ox1eef_>
Shortstop: You are calling a method that expects an argument without any arguments. It's almost impossible to help without real-world code examples. Diagrams won't help. The issue is with the code.
<ox1eef_>
Hola John_Ivan - long time no see.
<John_Ivan>
ox1eef_, hey there
<John_Ivan>
sup
<ox1eef_>
Not much. How's Christmas in Ireland?
<weaksauce>
did christmas come early
<John_Ivan>
Ireland?
<John_Ivan>
oh
<ox1eef_>
Tis the day before Christmas.
<John_Ivan>
I live in Wales, the west of Britain. My ISP is part of an irish conglomerate that offers internet (magnet) so I think you likely picked up an irish IP xD
<John_Ivan>
does it really say I live in Ireland?
<John_Ivan>
Christmas is rolling, yeah.
<John_Ivan>
Rolling with snow and cold *shivers*
<ox1eef_>
Ah, interesting ! No, your IP is not visible. I just remember that from a past conversation.
<crax23>
What E.II wants to do for XMass? -> resussitate like the Kryst! lol
<weaksauce>
i need to dry brine my turkey if it's almost christmas
<John_Ivan>
Yeshua Hrist
<ox1eef_>
In Brazil Christmas is a two-day affair where the eve, and day are equally as important.
crax23 has quit [Ping timeout: 252 seconds]
<adam12>
ox1eef_: Is that where you are located?
<Shortstop>
The weird part is that it didn't even hit the create method, so I don't know which method is truly messed up in the parties_controller ox1eef_
<Shortstop>
I did share the code above though ^
<Shortstop>
I realized I didn't have the top part of that error message though, so here's the better error message: https://bpa.st/R4TFQ
<weaksauce>
what are your routes
<weaksauce>
that error isn't very useful
<weaksauce>
other than you are not creating a party with the required parameter or something is messed up in your model
<Shortstop>
The only thing I can think of is the migration for 'party'
<Shortstop>
Within the Party model. Wow, crazy, wish it pointed to the model at that point though but cool, I found it
<weaksauce>
that's a rough one
<weaksauce>
glad you found it though
<weaksauce>
i wonder if rubocop or the like would have found that or just assumed you knew better and was calling some method
<ox1eef_>
adam12: Yep.
Shortstop has quit [Quit: Connection closed]
___nick___ has quit [Ping timeout: 248 seconds]
hd1 has joined #ruby
hd1 has left #ruby [#ruby]
Guest99 has joined #ruby
Guest99 has quit [Client Quit]
sam113101 has joined #ruby
caedmon has joined #ruby
caedmon has quit [Ping timeout: 248 seconds]
jmcgnh has quit [Ping timeout: 268 seconds]
inward has joined #ruby
caedmon has joined #ruby
sam113101 has quit [Ping timeout: 272 seconds]
ur5us has joined #ruby
Shortstop has joined #ruby
<Shortstop>
Hey there, can anyone help me figure out how to properly access a 'location' within my project? I have a nested relationship within my 'routes.rb' found here: https://bpa.st/5CREI
_ht has quit [Quit: _ht]
<Shortstop>
My related 'locations_controller' with a related byebug in the 'create' method: https://bpa.st/QYGHM
jmcgnh has joined #ruby
<Shortstop>
Related byebug output where I see '.items' present for the given '@current_user', but receive a related error for '.locations': https://bpa.st/DLULE
<Shortstop>
I'm wondering if this has to deal with the plurality of 'locations' in general. For a scenario like this where I want a single location for a party, does it make sense with what I have so far in the 'routes.rb' file in comparison to how i want to actually use it?
<weaksauce>
shows all the methods that are created
sam113101 has joined #ruby
<Shortstop>
Gotcha, but is this an issue with singular location being used?
<Shortstop>
Bookmarked that for future reference weaksauce
<Shortstop>
What's blowing my mind is that 'items' and 'location' have the same exact relationship. I can call @current_user.items, but can't call @current_user.location
<weaksauce>
Shortstop if you can in the future have one gist with all the files separated out so you can see it all in one view
<weaksauce>
gist.github.com lets you do that
<weaksauce>
or you can just do it all in one paste thing
<weaksauce>
there's nothing inside user that would create the methods for locations
<Shortstop>
Is the following valid for the User model?
<Shortstop>
has_one :location
<Shortstop>
has_many :parties, through: location
<weaksauce>
the only thing has_many does is create methods *on the object* it's being called from
<weaksauce>
or has_one
<Shortstop>
Gotcha, but is that idea above valid ^ ?
<weaksauce>
off the top of my head i can't validate the data mappings you'd have to do a diagram
<weaksauce>
and/or describe the relationships
<Shortstop>
Gotcha, I'll just try that and see if that works to be honest, and play around with a byebug with it
<Shortstop>
Thanks for helping me point to the User model though, makes sense
<weaksauce>
you're welcome
<weaksauce>
Shortstop the methods that are doing the things are really dumb at the end of the day and expect the data to be laid out in a proper fashion
<weaksauce>
they don't do anything special wrt making sure things are correct
<Shortstop>
For sure, hence why I want to play around with it with a byebug to be sure
<weaksauce>
yeah when in doubt
<Shortstop>
Pretty sure it'll act like 'items' in this scenario but singular though
<Shortstop>
had to rethink that project today since without the user being tied to location, it would be very hard to access and make changes etc
<Shortstop>
so its better to also treat it like a middleman anyway, since a person would tie a location to a party anyway. Though the ownership is slightly weird, it'll be ok for this purpose anyway
<weaksauce>
learning project?
caedmon has quit [Ping timeout: 268 seconds]
<Shortstop>
Yeah its just the final one I gotta do for a bootcamp
<Shortstop>
It sucks because my "instructor" barely helps so it's always on my own for this bs
<Shortstop>
If I had known what I know now, I wouldn't have done it, but honestly it's fine as I already got a junior job in the meantime
<Shortstop>
not really with their help though, and not even related langs are used anyway
<Shortstop>
Just trying to crank it out quickly though so I can just get that stupid bs done
<Shortstop>
even with those relationships though, @current_user.location doesn't work, and just gives