« Back to channel list

#RubyOnRails - 24 July 2018

« Back 1 day Forward 1 day »
[00:10:13] alfiemax: has joined #RubyOnRails
[00:15:20] lxsameer: has joined #RubyOnRails
[00:26:52] Inside: has joined #RubyOnRails
[00:27:07] alfiemax: has joined #RubyOnRails
[00:33:43] chouhoulis: has joined #RubyOnRails
[00:38:28] woohoou: has joined #RubyOnRails
[00:52:50] sevenseacat: has joined #RubyOnRails
[00:55:31] apeiros: has joined #RubyOnRails
[01:00:43] weaksauce: has joined #RubyOnRails
[01:28:47] quazimodo: has joined #RubyOnRails
[01:50:41] cagomez: has joined #RubyOnRails
[02:10:01] dblessing: has joined #RubyOnRails
[02:14:54] Technodrome: has joined #RubyOnRails
[02:16:12] lxsameer: has joined #RubyOnRails
[02:28:37] tdy: has joined #RubyOnRails
[02:48:04] darkhanb: has joined #RubyOnRails
[02:49:47] wethu: has joined #RubyOnRails
[03:10:15] braincrash: has joined #RubyOnRails
[03:10:45] gambl0re: has joined #RubyOnRails
[03:16:54] podlech: has joined #RubyOnRails
[03:53:53] woohoou: has joined #RubyOnRails
[04:13:44] srinidhi: has joined #RubyOnRails
[04:16:51] lxsameer: has joined #RubyOnRails
[04:30:10] Technodrome: has joined #RubyOnRails
[04:45:43] Puffball_: has joined #RubyOnRails
[04:46:14] moei: has joined #RubyOnRails
[04:53:29] Saukk: has joined #RubyOnRails
[04:59:17] za1b1tsu: has joined #RubyOnRails
[04:59:48] mikhael_k33hl: has joined #RubyOnRails
[05:00:07] mikhael_k33hl: Can you guys direct me to an article or guide pertaining good model creation?
[05:07:31] sevenseacat: thats a really broad topic
[05:17:13] srinidhi: has joined #RubyOnRails
[05:19:59] mikhael_k33hl: sevenseacat: Yeah, where should I go to get started?
[05:38:56] vedu_: has joined #RubyOnRails
[05:41:08] sevenseacat: the official rails guides are a great place to get started http://guides.rubyonrails.org
[06:09:49] psychoslave: has joined #RubyOnRails
[06:16:16] atrius: has joined #RubyOnRails
[06:17:28] lxsameer: has joined #RubyOnRails
[06:18:56] dnewkerk: has left #RubyOnRails: ()
[06:28:42] mikhael_k33hl: How do i generate models with associations?
[06:31:28] mikhael_k33hl: or will it best to make the models manually?
[06:31:45] sevenseacat: you can use `references` to create belongs_to associations, eg. `rails g model Book owner:references`
[06:31:59] sevenseacat: you need to know how to do it manually anyway so you can edit models later
[06:32:24] mikhael_k33hl: sevenseacat: So just generate model then edit it?
[06:32:37] mikhael_k33hl: In that case, what happens to the migrations automatically generated as well?
[06:32:58] sevenseacat: you create new migrations to make changes to your database structure
[06:33:05] sevenseacat: migrations are run-once
[06:34:01] mikhael_k33hl: okay so generate -> edit -> then migrations
[06:34:36] sevenseacat: generating a model will also generate a migration
[06:35:04] mikhael_k33hl: sevenseacat: So how do I update the migration after I edit the model?
[06:35:13] sevenseacat: you don't, if you've already run it
[06:35:21] sevenseacat: you create a new migration
[06:36:35] mikhael_k33hl: So when I generate model User, it will create a user migration. Then I edit User for associations. Can I just run rails generate migration User?
[06:36:45] mikhael_k33hl: Will it generate a new migration based on the the modified model?
[06:36:54] sevenseacat: thats not how migrations work
[06:37:09] mikhael_k33hl: How should it be done?
[06:38:04] sevenseacat: if you want to change your database schema, you generate a new migration and name it appropriately, eg. `rails g migration add_role_to_users`
[06:38:21] sevenseacat: and then inside that migration, make your changes
[06:40:40] mikhael_k33hl: Oh, so manually edit the migration too
[06:40:46] mikhael_k33hl: let me give it a try
[06:41:19] sevenseacat: yes, you should get familiar with editing all of the code. the generators aren't meant to generate perfect code - they'll help form a starting point.
[06:41:42] mikhael_k33hl: sevenseacat: so first I generate a model without the associations right?
[06:42:09] sevenseacat: you can generate a model with belongs_to associations like I said before, but not has_many
[06:42:56] mikhael_k33hl: okay thanks, let me give it a try
[06:45:56] anikras: has joined #RubyOnRails
[07:00:49] Arkentias: has joined #RubyOnRails
[07:03:49] Arkentias: Hello ! I have a question, do you guys think there is a way for me to store lambdas in the database somehow?
[07:04:09] sevenseacat: I wouldn't do it.
[07:04:48] Arkentias: Yes I know that it seems crazy and stupid but in a world where this would be a good idea, how would one do that?
[07:05:23] Arkentias: If it's even possible
[07:05:42] sevenseacat: I don't know how you could do ruby lambdas. stored procedures in postgres would be the equivalent
[07:05:58] tbuehlmann: have an evil_ruby column and save a string in it, that'll be evaled later on in ruby-land
[07:06:04] tbuehlmann: yes, I just wrote that
[07:06:31] tbuehlmann: not okay actually
[07:06:37] Arkentias: ahaha no I know
[07:06:40] Arkentias: I'll give a bit of background
[07:06:45] tbuehlmann: there's hopefully a better solution to your problem
[07:06:48] sevenseacat: don't even think of executing user-entered code. just... please.
[07:06:57] Arkentias: No no of course not user entered code
[07:07:06] Arkentias: That's actually something we do in our V1... Crazy..
[07:07:17] Arkentias: (I didn't write the code)
[07:08:04] Arkentias: Ok so we provide a product that allows for easy creation of fundraising platforms for NGOs, the idea is that users create 'projects' through which they raise money for the NGO by asking their families and friends etc
[07:08:38] Arkentias: But this expanded, sometimes you just "vote" for a project, sometimes you give money, sometimes you buy products, sometimes you buy a ticket, etc
[07:09:10] Arkentias: And this action can now be applied on a platform directly (root level), on a group of project, or on a project (or even a user)
[07:09:47] Arkentias: So my idea is to try to have a 'recipe' for the funnel that users go through when they want to do one of these actions
[07:10:09] Arkentias: This recipe would be my "Procedure" object, which already contains a JSON that allows for easy changing of the form that user go through
[07:11:02] Arkentias: And I'm trying to find a way to maybe have some sort of recipe in the backend for the different records to create etc depending on the Procedure, like one would create a Vote, one would create a transaction + make the User follow a project etc
[07:12:11] Arkentias: But indeed, the client would have to be able to play around with it through our Backoffice, so I can't just let our Vue application send Ruby code, that's a no go, absolutely
[07:12:43] tbuehlmann: why not just have that code in your application? am I missing something?
[07:12:45] Arkentias: Just trying to figure out how to attain a high level of flexibility without shooting my own foot
[07:12:53] sevenseacat: I'm wondering what I'm missing also
[07:13:11] quazimodo: has joined #RubyOnRails
[07:13:57] tbuehlmann: I guess it's cool to have these things in your application and if you're ever at a point where you feel there's missing an abstraction, think again
[07:14:12] Arkentias: Yeah I guess it makes sense for that model to be really fat
[07:14:17] sevenseacat: if you want to create a new 'thing' for people to do, you're going to need to write more than a lambda in your db
[07:14:22] Arkentias: Since it's basically all of our application
[07:15:04] sevenseacat: we have a similar sort of thing, where we have different entry methods users can pick from, to enter a competition
[07:15:15] sevenseacat: yes, the entry method model is complicated as hell lol
[07:16:15] lxsameer: has joined #RubyOnRails
[07:17:52] Arkentias: Ahaha ok I guess it's indeed better that way, when we need more behaviour i'll just add some methods
[07:17:56] Arkentias: Thanks for the help guys!
[07:19:04] psychoslave: has joined #RubyOnRails
[07:43:56] mikhael_k33hl: Tried to run rails generate model, but why does my model doesn't have the right fields/attributes? https://gist.github.com/marzdgzmn/cac840acd0a87b8c955e8bf29b949428
[07:44:46] sevenseacat: what fields is it missing?
[07:45:10] sevenseacat: your model doesnt need to list all the fields that are in the schema
[07:45:19] sevenseacat: Rails is smart enough to work all of them out
[07:47:44] mikhael_k33hl: Oh okay. So regardless of what you used, either has_one and belongs_to, in the migration file, it will add only the belongs_to field to the appropriate model?
[07:48:26] sevenseacat: I don't see any associations there. but the difference between those two association types is which model the foreign key goes on
[07:48:46] vedu_: has joined #RubyOnRails
[07:49:08] sevenseacat: `references` in a migration/generator is a belongs_to association
[07:49:15] sevenseacat: never a has_one
[07:52:10] mikhael_k33hl: sevenseacat: So I have the models: Hog, Supplier, Feed, and PigPen. I want to create an association for Hog belongs_to: supplier, has_many:feeds, has_one: PigPen
[07:52:45] sevenseacat: well that's going to add foreign keys to three different database tables
[07:53:53] sevenseacat: if a Hog has_one PigPen, then a PigPen belongs_to a Hog - you might want that to be flipped so a Hog belongs_to a PigPen and a PigPen can has_many Hogs
[07:54:45] sevenseacat: if a Hog has_many Feeds, then a Feed belongs_to a Hog - so the feeds table would have a hog_id field
[07:56:58] mikhael_k33hl: can't seem to find the rails g migration command for that: https://edgeguides.rubyonrails.org/association_basics.html
[07:57:24] vedu_: has joined #RubyOnRails
[07:58:05] mikhael_k33hl: I'd like to create a new migration for the associations
[07:58:36] mikhael_k33hl: I run `rails generate model #{model}` for each models. Now I want to create a migration for their associations
[07:58:36] sevenseacat: well sure, then you'll need to generate a migration and add them in
[07:59:07] mikhael_k33hl: I simply run `rails generate migration add_hogs_to_pen`?
[07:59:13] sevenseacat: you could have done all of the associations when you did the models, ie. add hog:references when generating the Feed model
[07:59:13] mikhael_k33hl: then edit the generate file?
[08:00:37] conta: has joined #RubyOnRails
[08:05:47] lupine: sounds like an interesting domain
[08:10:50] mikhael_k33hl: Okay, I run `rails generate migration add_hog_to_pig_pen hog:references` now i have :https://gist.github.com/marzdgzmn/9c745e19d08748fd03c789da5f36ea7d Should I just add a has_many: to my hog model manually?
[08:11:25] sevenseacat: yes, you'll need to add the has_many yourself.
[08:15:17] mikhael_k33hl: sevenseacat: thanks mate
[08:16:45] lxsameer: has joined #RubyOnRails
[08:17:48] tbuehlmann: surprised my irc client correctly displays the thumb up
[08:18:55] reber: has joined #RubyOnRails
[08:23:00] sevenseacat: emoji are awesome.
[08:31:50] jottr: has joined #RubyOnRails
[08:42:44] Sylario: has joined #RubyOnRails
[08:46:43] hays: has joined #RubyOnRails
[08:53:45] hays: has joined #RubyOnRails
[08:59:51] psychoslave: has joined #RubyOnRails
[09:01:05] srinidhi: has joined #RubyOnRails
[09:12:22] Ergo: has joined #RubyOnRails
[09:12:35] Charliebr73: has joined #RubyOnRails
[09:13:31] Charliebr73: Anyone working on a Rails API app with AngularJS 1.5 frontend?
[09:13:54] Arkentias: Used to, a long time ago, might be able to help
[09:14:07] sevenseacat: we have 1.6, but not with an API
[09:14:22] Charliebr73: Has anyone experienced an issue where AngularJS drag and drop lists ignore the last move, i.e., not saving it to the database?
[09:15:02] Charliebr73: I am working on an Open Source application for an University in London. Rails 5 API and AngularJS frontend.
[09:15:37] Charliebr73: We are having an issue where, when moving list items, the last move is never recorded to the database. If I make only one move, that move is never recorded
[09:15:42] sevenseacat: how does it know what the "last" move is?
[09:15:58] Arkentias: Are you sure you're using the right callback to save to the database?
[09:16:04] Charliebr73: You can take a look at the code at https://github.com/CLOSER-Cohorts/archivist
[09:17:00] sevenseacat: sounds like you're caching moves or something
[09:17:22] sevenseacat: can you show us the code that does the saving when you move an item
[09:17:40] Charliebr73: @sevenseacat The file I believe is creating this problem is https://github.com/CLOSER-Cohorts/archivist/blob/develop/app/assets/javascripts/sections/instruments/modules/build/controllers/constructs.coffee
[09:18:17] Charliebr73: @sevenseacat The Rails controller is https://github.com/CLOSER-Cohorts/archivist/blob/develop/app/controllers/instruments_controller.rb
[09:18:19] sevenseacat: you might have better luck in an angular channel if the code is all js
[09:19:22] Charliebr73: @sevenseacat There is a function called $scope.treeOptions (Angular) that trigger a Post request to Rails 'reorder_ccs' method.
[09:19:46] sevenseacat: so when you move item 1 to position 3, what request gets fired?
[09:19:48] Arkentias: Did you check in the Google Dev Tools when your updates are sent to the Rails API?
[09:19:59] sevenseacat: ^ are the requests right?
[09:20:08] Charliebr73: @sevenseacat I will have a go there as well but the last time I tried there, one of the guys there was incredibly rude
[09:20:12] Arkentias: Is the update really sent when you drop the thingie?
[09:20:27] Arkentias: VS not when you start dragging
[09:20:32] sevenseacat: lots of people are rude, here included
[09:20:48] Charliebr73: @Arkentias I have tried console.logging pretty much everything. From whether data was being loaded, to the changes in positions, etc
[09:21:02] Arkentias: Ok, try using the "Network" tab
[09:21:14] Arkentias: It is your main tool when dealing with SPAs and APIs
[09:21:39] Charliebr73: @sevenseacat "so when you move item 1 to position 3, what request gets fired?" -> The dropped function kicks in and the triggers a post request for Rails to updates the database
[09:21:42] Arkentias: It shows you exactly the requests sent
[09:21:49] sevenseacat: yes, what is the format of that request
[09:21:54] sevenseacat: what params are you sending
[09:22:23] Charliebr73: Just FYI, I did not build this. I inherit this code from a developer who left in December. I only started here two months later. No handing over .
[09:23:21] Charliebr73: @Arkentias I have used the network tab and the sources tab
[09:23:43] Arkentias: Ok so you are certain that the update happens everytime you DROP something?
[09:23:52] Arkentias: Even the first time? Or the update is not sent at all ?
[09:23:54] Charliebr73: It seems it only realises there has been an update from the second move onwards
[09:24:11] sevenseacat: if that was the case, the first move would be missing, not the last.
[09:24:42] sevenseacat: can you show us some actual data, not a description of what you think is happening
[09:24:44] Charliebr73: If I have two moves, the last is not recorded.
[09:25:25] Arkentias: I think it updates the whole list everytime, not move per move, so the first "Dropped" event is apparently not handled but the rest is so when the second "dropped" event happens, the whole list is saved to the DB
[09:25:47] sevenseacat: load up a list of things. record their IDs. move one. note the request params that get made
[09:25:56] Charliebr73: @Arkentias Yes, just like that.
[09:26:02] Radar: good evening.
[09:26:07] Arkentias: So the idea is to find why that first even is not handled. When you put a console.log in the "dropped" handler, the function doesn't even get called the first time, right?
[09:26:43] Charliebr73: If I refresh the page, the last move is lost
[09:26:57] Charliebr73: if only one move, then no changes show
[09:27:19] Charliebr73: I will have a go at it again. Thanks for the pointers.
[09:27:33] Arkentias: You're now certain that the problem is in Angular
[09:27:33] Charliebr73: this bug has been annoying me for over a week now
[09:27:47] Charliebr73: I am 90% sure it is
[09:27:58] Arkentias: You will probably have to check the code that triggers the "dropped" event
[09:28:32] Charliebr73: The thing is, the person who wrote this, had never worked with rails or Angular before. God know why he chose those two if he had no previous experience in them.
[09:29:01] sevenseacat: thats not relevant to the bug you're looking at
[09:29:05] Charliebr73: And he was the only developer at the time so I am pretty sure more things will break as I work on the application.
[09:29:11] Arkentias: ... I know that feel, and I can see that looking at his Rails controller. Good luck with that project
[09:29:18] sevenseacat: things break in any application
[09:29:36] Charliebr73: @sevenseacat I know. I guess I am just feeling frustrated
[09:29:48] sevenseacat: seems so, given I keep asking questions and not getting answers
[09:30:06] Radar: [19:24:42] <sevenseacat> can you show us some actual data, not a description of what you think is happening
[09:30:09] Radar: For instance.
[09:30:20] Radar: I tried to follow the conversation too and gave up because of this reason.
[09:31:09] Arkentias: The problem here is not the data guys, the problem is the AngularJS event not even being triggered, that's the first thing to fix before even thinking about the rest I think
[09:31:30] Arkentias: Maybe the data will be a problem after that, but if the request is not even sent to Rails, that should be fixed first
[09:31:57] sevenseacat: it is being triggered. with the wrong data.
[09:32:05] sevenseacat: hence asking.
[09:32:19] Arkentias: That's not what Charlie is saying, the event is not triggered on the first move
[09:32:28] Charliebr73: @sevenseacat if that is the case, how does it work from the second move onwards?
[09:32:31] test1337: has joined #RubyOnRails
[09:32:38] sevenseacat: and on the second move, its getting triggered with the wrong data, the data from the first move
[09:32:43] test1337: choo choo, choo choo, where is this train heading ???
[09:32:48] sevenseacat: but fine, can see when my help is not wanted :)
[09:33:15] test1337: choo choo, choo choo, where is this train heading ???
[09:33:15] Arkentias: @Charliebr73, you did observe in the Network tab that the request wasn't send on the first move, right?
[09:33:24] test1337: has left #RubyOnRails: ("Leaving")
[09:33:30] Charliebr73: @sevenseacat Every insight is a pointer I can explore. Your help is very much appreciated
[09:33:49] Charliebr73: @Arkentias yes
[09:34:01] Arkentias: Then if the request is not sent, the problem lies in Angular
[09:34:14] Arkentias: don't you think sevenseacat?
[09:34:46] Charliebr73: Let me have another go at debugging that Angular controller.
[09:34:54] Charliebr73: Thanks for the help
[09:34:57] Arkentias: I mean at least the first problem to solve is that one
[09:35:02] Arkentias: Good luckè
[09:39:30] xall: has joined #RubyOnRails
[09:43:44] Arkentias: Try using the dragStop event to see if the behaviour changes @Charliebr73
[09:44:02] Charliebr73: Arkentias: Will do
[09:49:44] chridal: Having some weird issues with paths. Anyone mind having a look? https://gist.github.com/valleybay/724ac6f7ebece13af7477cbb7f4c82f4
[09:56:02] Arkentias: Everything looks fine in the gist indeed
[09:56:51] Arkentias: Wait you get an error in the show view but the manage_room_path is in the index view?
[10:01:12] chridal: Arkentias: The view is buildings/index.html.erb
[10:01:36] chridal: and the manage_room_path is being run in a @building.rooms.each |room|
[10:01:57] Arkentias: yes but the error in the gist says buildings/show.html.erb where line #29 raised: blablbal
[10:02:11] Saukk: has joined #RubyOnRails
[10:02:38] chridal: Oh, right, sorry. it's in buildings/show.html.erb, right
[10:02:57] chridal: Would that be an issue?
[10:06:25] Arkentias: I don't think so no but that's the only weird thing I could find in the gist :p
[10:06:52] Arkentias: I don't think I would be able to help with those informations but maybe someone else has an idea or has already encountered a similar issue
[10:07:14] chridal: Arkentias: I forgot that I could check `rake routes`
[10:07:41] Arkentias: And you managed to find something in there?
[10:07:46] chridal: https://gist.github.com/valleybay/724ac6f7ebece13af7477cbb7f4c82f4
[10:07:56] chridal: Is it just me, or is this a bug?
[10:08:09] chridal: manage_rooms GET /manage/rooms(.:format) manage/rooms#show
[10:08:15] apparition: has joined #RubyOnRails
[10:08:18] chridal: shouldn't that path be manage_room?
[10:10:25] Arkentias: Indeed this is bit the same as in the documentation, I'm not well versed enough in Rails to tell you why though. Are you using Rails 5?
[10:10:57] chridal: Yes, latest version
[10:11:29] chridal: Or, actually I'm on 5.1.6, should upgrade
[10:12:02] Arkentias: It is weird to me that you don't have an index route or anything, maybe someone else has an idea on that? Because I don't :p
[10:19:07] Radar: chridal: !gist-usage
[10:19:07] helpa: chridal: How to use Gist properly: https://github.com/radar/guides/blob/master/using-gist.markdown
[10:19:17] Radar: manage_rooms is correct.
[10:19:35] Radar: chridal: do you mean to use "resource" and not "resources"?
[10:19:56] Radar: You would use the singular version when you only have a single room to manage. Judging by the name of your resource there is more than one.
[10:21:18] conta: has joined #RubyOnRails
[10:22:31] chridal: Radar: Will test with 'resource' instead of resources. Maybe I'm misunderstanding that part.
[10:22:43] chridal: What I want here is to click on one room, and have the show page for that room.
[10:23:03] chridal: I will only be dealing with one room at a time, unless they are being listed in an index or in a buildings show page
[10:23:07] Radar: chridal: yes. So you want 'resources' not 'resource'
[10:25:35] Dbugger: has joined #RubyOnRails
[10:26:51] chridal: Radar: Omg. The time I have spent on this bug...
[10:26:52] chridal: Thank you!
[10:27:07] Radar: chridal: donate to the Radar fund: paypal.me/ryanbigg
[10:33:13] chridal: Sure. Have a coffee :-)
[10:37:39] alfiemax_: has joined #RubyOnRails
[10:45:47] lexileo: has joined #RubyOnRails
[10:53:33] vedu_: has joined #RubyOnRails
[10:57:41] quazimodo: has joined #RubyOnRails
[10:58:19] Arkentias: Damn and here I was thinking resources was when you declared multiple resources at once, when I myself use both singular and plural resoruces in my application.. Dumb me, glad you found the issue
[10:59:45] ur5us: has joined #RubyOnRails
[11:07:05] vedu_: has joined #RubyOnRails
[11:32:59] jlebrech: has joined #RubyOnRails
[11:33:41] jlebrech: i want to access something i create in my initializer from anywhere in the app, do I put it in a singleton?
[11:35:16] nzst: has joined #RubyOnRails
[11:41:28] Puffball: has joined #RubyOnRails
[12:00:35] mikecmpbll: has joined #RubyOnRails
[12:07:59] srinidhi: has joined #RubyOnRails
[12:10:49] Technodrome: has joined #RubyOnRails
[12:12:33] chouhoulis: has joined #RubyOnRails
[12:18:25] sirensari2: has joined #RubyOnRails
[12:24:53] srinidhi: has joined #RubyOnRails
[12:35:25] srinidhi: has joined #RubyOnRails
[12:46:29] mikecmpbll: has joined #RubyOnRails
[12:47:16] GodFather: has joined #RubyOnRails
[12:48:57] mroutis: has joined #RubyOnRails
[12:55:17] quazimodo: has joined #RubyOnRails
[13:14:11] Technodrome: has joined #RubyOnRails
[13:18:50] mroutis: has left #RubyOnRails: ()
[13:34:26] krawchyk: has joined #RubyOnRails
[13:36:58] vedu_: has joined #RubyOnRails
[13:39:15] Caerus: has joined #RubyOnRails
[13:44:36] uks: has joined #RubyOnRails
[13:47:04] conta1: has joined #RubyOnRails
[13:47:38] jerojasro: has joined #RubyOnRails
[13:53:21] dblessing: has joined #RubyOnRails
[14:10:34] IanMalcolm: has joined #RubyOnRails
[14:11:07] scrptktty: has joined #RubyOnRails
[14:18:06] krawchyk: has joined #RubyOnRails
[14:20:57] IanMalcolm: has joined #RubyOnRails
[14:23:12] srinidhi: has joined #RubyOnRails
[14:23:33] yoones: has joined #RubyOnRails
[14:25:02] yoones: Hello. I have a pb with a user model that has both a has_one and has_many documents (https://github.com/yoones/rails_has_one_has_many_bug). When a record is built through has_one, it doesn't show up in the has_many and vice versa. Any idea how to fix this behavior? Is it a bug?
[14:25:43] fryguy: why do you have both relationships?
[14:26:41] yoones: fryguy, developpers before me wrote the app this way, can't change it for many reasons
[14:26:57] fryguy: yoones: that doesn't really answer the question
[14:27:54] yoones: the reason is irrelevant here, I'm just curious as to how I can make rails reflect the has_one non-persistant record in the has_many association
[14:28:18] fryguy: you don't, they are separate relationships
[14:28:50] fryguy: write a new method on user that concatenates the results if that's what you want
[14:29:53] yoones: ok thanks
[14:29:58] sevenseacat: if you add a document via has_one, then reload the has_many, does it appear?
[14:30:20] sevenseacat: oh, non-persistent
[14:30:22] sevenseacat: yeah that won't work
[14:30:46] yoones: sevenseacat, :)
[14:31:43] yoones: maybe I should replace the build_proof_of_id with a self.documents.new(type: 'Document::ProofOfId')
[14:31:47] krawchyk: has joined #RubyOnRails
[14:32:21] fryguy: wait, I thought you couldn't change things?
[14:32:34] sevenseacat: then it won't appear as the has_one relationship
[14:32:35] vedu_: has joined #RubyOnRails
[14:33:38] yoones: fryguy, I can't change the fact that we have a has_many and a has_one, and that the activeadmin forms send {proof_of_id_attributes: ...} params
[14:34:35] yoones: but maybe I can change the way we build the has_one so that it shows up on the has_many
[14:34:57] yoones: sevenseacat, you're probably right.. :-
[14:35:42] yoones: Well, at least I know it's not a bug but a bad design of my app
[14:35:47] yoones: thanks for the help guys
[14:44:56] keegnotrub: has joined #RubyOnRails
[14:59:21] IanMalcolm: has joined #RubyOnRails
[15:09:44] IanMalcolm: has joined #RubyOnRails
[15:10:53] tdy: has joined #RubyOnRails
[15:11:53] SteenJobs: has joined #RubyOnRails
[15:12:11] DTZUZO: has joined #RubyOnRails
[15:17:21] NoidedSuper: has joined #RubyOnRails
[15:17:22] crankharder: has joined #RubyOnRails
[15:21:24] krawchyk: has joined #RubyOnRails
[15:22:48] crankharder: has joined #RubyOnRails
[15:24:24] conta1: has joined #RubyOnRails
[15:25:01] IanMalcolm: has joined #RubyOnRails
[15:26:25] IanMalcolm: has joined #RubyOnRails
[15:27:19] krawchyk: has joined #RubyOnRails
[15:27:26] IanMalcolm: has joined #RubyOnRails
[15:27:55] tcopeland: has joined #RubyOnRails
[15:28:23] jcarl43: has joined #RubyOnRails
[15:34:11] spectra: has joined #RubyOnRails
[15:37:51] IanMalcolm: has joined #RubyOnRails
[15:46:55] machinewar: has joined #RubyOnRails
[15:48:21] za1b1tsu: has joined #RubyOnRails
[15:54:26] cagomez: has joined #RubyOnRails
[15:57:05] cagomez: has joined #RubyOnRails
[16:01:41] akaiiro: has joined #RubyOnRails
[16:12:01] hkais: has joined #RubyOnRails
[16:13:57] dviola: has joined #RubyOnRails
[16:14:19] hkais: can someone help me?
[16:14:19] hkais: Is there any default build system for rails projects?
[16:14:19] hkais: e.g. something like the rakefile?
[16:14:19] hkais: I am asking since I want to execute some tasks for generating docs and generating static code analysis
[16:15:24] fryguy: hkais: it's rake
[16:16:35] hkais: fryguy: sorry do not get you? I am a non native speaker
[16:17:06] fryguy: rails uses rake
[16:17:28] fryguy: https://guides.rubyonrails.org/command_line.html#custom-rake-tasks
[16:22:11] work_: has joined #RubyOnRails
[16:22:51] beowuff: has joined #RubyOnRails
[16:23:33] agent_white: has joined #RubyOnRails
[16:23:45] hkais: okay thx for the link
[16:24:00] hkais: regarding documentation generation, what is the recommended doc tool for rails?
[16:24:24] hkais: read something about rdoc but also other doc systems are around. so I am a bit confused what to learn
[16:27:49] crankharder: has joined #RubyOnRails
[16:35:47] darkhanb: has joined #RubyOnRails
[16:41:08] IanMalcolm: has joined #RubyOnRails
[16:51:35] IanMalcolm: has joined #RubyOnRails
[16:52:42] orbyt_: has joined #RubyOnRails
[17:03:29] Caerus: has joined #RubyOnRails
[17:03:52] mikecmpbll: has joined #RubyOnRails
[17:05:26] snuz: has joined #RubyOnRails
[17:05:55] nzst: has joined #RubyOnRails
[17:07:27] chouhoulis: has joined #RubyOnRails
[17:14:58] jamesbvaughan: has joined #RubyOnRails
[17:17:31] jamesbvaughan: I'm fairly new to rails and have a question related to git. I understand how the default .gitignore rules are set up and work, but I don't understand *why* they are what they are. For example, why is `log/` kept in git with a `.keep` file when all contents of that directory are ignored? Why not just ignore the directory completely?
[17:20:46] eckhardt: has joined #RubyOnRails
[17:22:44] markh: has joined #RubyOnRails
[17:25:20] crankharder: has joined #RubyOnRails
[17:25:57] havenwood: jamesbvaughan: When the repo ends up in prod, it should have a log/ directory with nothing in it.
[17:26:31] havenwood: jamesbvaughan: (Nothing, other than the placeholder .keep to ensure the dir is committed.)
[17:27:44] havenwood: jamesbvaughan: They could have alternatively put a .gitignore file in the dirs they want to keep, with the content: !.gitignore
[17:28:34] havenwood: But you have to put something in the dir if you want to commit it, since git ignores empty directories.
[17:30:08] havenwood: And they do want to commit it, so everyone doesn't have to create the log/ dir when deploying.
[17:50:04] prettybTech: has joined #RubyOnRails
[17:52:50] ssolomon: has joined #RubyOnRails
[18:00:10] vedu_: has joined #RubyOnRails
[18:01:12] jwr: has joined #RubyOnRails
[18:01:19] NoGodDamnIdea: has joined #RubyOnRails
[18:02:39] jwr: anybody know how to get unicorn to log to stdout? my first instinct was to try stdout_path "-" but that doesn't seem to log anything at all.
[18:03:01] jwr: use case is running unicorn in a container, in case that matters.
[18:03:56] sameerynho: has joined #RubyOnRails
[18:05:17] prettybTech: has joined #RubyOnRails
[18:29:11] chkhanch: has joined #RubyOnRails
[18:32:08] cagomez: has joined #RubyOnRails
[18:33:56] chkhanch: hi2all, I have nested resources 3 lvl, at view form: form_with(model: @lesson, url: course_theme_lessons_path([@course, @theme, @lesson]). after click 'submit' take url like: "/courses/1%2F3%2F4/themes/3/lessons". Why added %2F3%2F4/? at url
[18:34:24] Technodrome: has joined #RubyOnRails
[18:37:19] snuz: has joined #RubyOnRails
[18:40:14] snuz: has joined #RubyOnRails
[18:46:06] chkhanch: polymorphic_path help me, thx
[18:55:05] Caerus: has joined #RubyOnRails
[18:57:24] syndikate: Can someone help me understand this line of code?
[18:57:28] syndikate: ` label onclick="javascript:window.location.href='#{url_for(params.permit(:limit, :q => [:name_cont, :title_cont, :deleted_at_present]).merge(limit: limit))}'"`
[18:57:39] syndikate: I got it from a view file
[18:57:53] syndikate: I understood till url_for, which would give teh current path
[18:58:03] syndikate: Changing href will reload to that path
[18:58:13] syndikate: What's the role params.permit have there?
[18:58:57] syndikate: I understand what params.permit does, but trying to figure how it helps there
[19:02:23] spohnz: has joined #RubyOnRails
[19:06:26] prettybTech: has joined #RubyOnRails
[19:14:52] dachi: has joined #RubyOnRails
[19:15:17] dachi: Hi I'm trying to share sessions between subdomain and domain, and have isolated sessions on different subdomain.
[19:15:22] dachi: I'm trying to do a middleware
[19:15:24] dachi: https://ibb.co/h9zcr8
[19:15:32] dachi: But I can't update Rails configuration from there
[19:15:44] dachi: Can you kindly give any suggestions?
[19:23:53] spohnz: has joined #RubyOnRails
[19:33:30] SteenJobs: has joined #RubyOnRails
[19:37:29] dachi: Or.. maybe somebody knows
[19:37:35] dachi: How can I change https://ibb.co/k0XDW8
[19:37:37] dachi: @key there
[19:37:50] dachi: I can change domain with env["rack.session.options"][:domain] =
[19:37:54] dachi: I want to change @key
[19:38:49] SteenJobs: has joined #RubyOnRails
[20:14:42] Technodrome: has joined #RubyOnRails
[20:15:01] snuz: has joined #RubyOnRails
[20:30:53] lexileo: has joined #RubyOnRails
[20:32:19] crankharder: has joined #RubyOnRails
[20:34:10] ur5us: has joined #RubyOnRails
[20:36:51] sirensari2: has joined #RubyOnRails
[20:38:21] jwr: has left #RubyOnRails: ("Ex-Chat")
[21:07:03] blindMoe: has joined #RubyOnRails
[21:09:07] blindMoe: with rspec, when I am allowing a class to receive a function call and that same function is called with multiple different params, is it possible to have an assertion only check against specific arguments? Right now it will tell me that it expected to receive foo('bar') twice but received foo('asdf') 4 times and foo('bar') twice
[21:24:11] Inside: has joined #RubyOnRails
[21:38:56] hammer065: has joined #RubyOnRails
[21:50:10] jcarl43: has left #RubyOnRails: ("WeeChat 2.2")
[22:03:28] Caerus: has joined #RubyOnRails
[22:06:26] orbyt_: has joined #RubyOnRails
[22:14:23] Inside: how about them ORMs
[22:15:11] Inside: also: how come changes to helpers aren't picked up?
[22:15:19] Inside: I need to literally restart the server every time I change a helper
[22:20:39] ssolomon: has joined #RubyOnRails
[22:23:07] spohnz: has joined #RubyOnRails
[22:23:34] chouhoulis: has joined #RubyOnRails
[22:29:10] chouhoulis: has joined #RubyOnRails
[22:34:43] Radar: GOOD MORNING
[22:36:20] alfiemax: has joined #RubyOnRails
[22:40:08] chouhoulis: has joined #RubyOnRails
[22:45:39] chouhoulis: has joined #RubyOnRails
[22:51:09] chouhoulis: has joined #RubyOnRails
[22:56:04] orbyt_: has joined #RubyOnRails
[22:56:38] chouhoulis: has joined #RubyOnRails
[23:03:19] chouhoulis: has joined #RubyOnRails
[23:07:41] unreal: has joined #RubyOnRails
[23:13:31] prettybTech: has joined #RubyOnRails
[23:13:41] spohnz_: has joined #RubyOnRails
[23:22:34] Technodrome: has joined #RubyOnRails
[23:26:25] chouhoulis: has joined #RubyOnRails
[23:27:25] chouhoulis: has joined #RubyOnRails
[23:34:05] chouhoulis: has joined #RubyOnRails
[23:42:52] chouhoulis: has joined #RubyOnRails
[23:49:44] dachi: has joined #RubyOnRails
[23:50:35] dachi: Please help me. I'm trying to isolate one domain from cookie session store. I need lvh.me and a.lvh.me to share sessions, and I need b.lvh me to be completely isolated from those two.
[23:50:38] chouhoulis: has joined #RubyOnRails
[23:51:35] dachi: I've been struggling with middlewares and other things for a long while, and I was messing my project up. Two rules like ".b.lvh.me" and ".lvh.me" completely ruin app as ".b.lvh.me" gets into ".lvh.me" scope :(
[23:56:04] chouhoulis: has joined #RubyOnRails
[23:56:55] apeiros: has joined #RubyOnRails