« Back to channel list

#RubyOnRails - 17 April 2019

« Back 1 day Forward 1 day »
[00:00:24] dviola: has joined #RubyOnRails
[00:02:22] orbyt_: has joined #RubyOnRails
[00:18:04] gb_away: has joined #RubyOnRails
[00:24:34] duderonomy: has joined #RubyOnRails
[00:27:36] gb_away: has joined #RubyOnRails
[00:42:19] gb_away: has joined #RubyOnRails
[00:44:33] gb_away: has joined #RubyOnRails
[00:53:36] gb_away: has joined #RubyOnRails
[00:56:29] agent_white: has joined #RubyOnRails
[01:08:41] ascarter: has joined #RubyOnRails
[01:09:17] sevenseacat: has joined #RubyOnRails
[01:10:42] lunarkitty7: has joined #RubyOnRails
[01:12:11] mangold: has joined #RubyOnRails
[01:34:51] tdy: has joined #RubyOnRails
[01:41:03] Saukk: has joined #RubyOnRails
[01:57:33] maryo_: has joined #RubyOnRails
[02:13:42] jelera: has joined #RubyOnRails
[02:14:02] jelera: Good evening everyone!
[02:16:23] jelera: I have a question about ActiveRecord
[02:16:40] jelera: https://stackoverflow.com/questions/8111283/multiple-relationships-to-the-same-thing-rails would this answer still be valid now?
[02:17:40] sevenseacat: yep, its still good :)
[02:19:45] jelera: awesome, thanks!
[02:34:47] duderonomy: has joined #RubyOnRails
[02:39:41] gambl0re: has joined #RubyOnRails
[02:45:42] rascencio: has joined #RubyOnRails
[03:10:04] braincrash: has joined #RubyOnRails
[03:13:38] tdy: has joined #RubyOnRails
[03:15:05] gb_away: has joined #RubyOnRails
[03:36:41] mangold: has joined #RubyOnRails
[04:00:23] rascencio: has joined #RubyOnRails
[04:09:09] pd09041999: has joined #RubyOnRails
[04:18:08] ariedler: has joined #RubyOnRails
[04:34:18] segy: has joined #RubyOnRails
[04:36:40] pd09041999: has joined #RubyOnRails
[04:41:30] sevenseacat: has joined #RubyOnRails
[04:53:00] segy: has joined #RubyOnRails
[05:13:12] srinidhi: has joined #RubyOnRails
[05:24:40] segy: has joined #RubyOnRails
[05:44:20] garyserj: has joined #RubyOnRails
[05:50:26] sevenseacat: has joined #RubyOnRails
[05:54:43] kapil____: has joined #RubyOnRails
[05:57:02] ascarter: has joined #RubyOnRails
[06:14:09] DTZUZO: has joined #RubyOnRails
[06:19:10] ariedler: has joined #RubyOnRails
[06:48:15] mangold: has joined #RubyOnRails
[06:51:53] uplime: has joined #RubyOnRails
[07:16:52] Dbugger: has joined #RubyOnRails
[07:17:44] prestorium: has joined #RubyOnRails
[07:22:14] pd09041999: has joined #RubyOnRails
[07:47:01] lxsameer: has joined #RubyOnRails
[08:11:48] dionysus69: has joined #RubyOnRails
[08:15:17] catbusters: has joined #RubyOnRails
[08:16:09] catbusters: What's the best way to add something like this to a Rails app?
[08:16:54] catbusters: The user needs to be able to edit the static text on the site that there would only be a single copy of for the entire site
[08:17:09] catbusters: So don't know if putting that in the DB makes much sense
[08:19:58] ariedler: has joined #RubyOnRails
[08:21:36] FastJack: has joined #RubyOnRails
[08:23:24] Ergo: has joined #RubyOnRails
[08:44:23] ziyadb: any idea why devise would use get instead of post?
[08:44:42] ziyadb: i've been stuck on this for 2 days now...
[08:51:58] pd09041999: has joined #RubyOnRails
[08:54:38] Velkow: has joined #RubyOnRails
[09:00:13] pd09041999: has joined #RubyOnRails
[09:00:59] garyserj: ziyadb: you mean the difference?
[09:01:39] ziyadb: garyserj: I wish. I mean why would my devise use GET instead of POST when submitting?
[09:01:40] ziyadb: https://beta.mattersource.com/users/sign_up
[09:02:05] ziyadb: At this point I'm considering scrapping the whole application and rebuilding it from scratch.
[09:02:18] ziyadb: because I have no idea where to even troubleshoot
[09:02:28] s00pcan: has joined #RubyOnRails
[09:03:56] dionysus69_: has joined #RubyOnRails
[09:06:05] garyserj: i see a form for creating an new user, and a search form.. the new user one uses a post , the search form uses a get.. so is your question why the search form uses GET? Maybe you can share the code that produced the search form?
[09:07:14] pd09041999: has joined #RubyOnRails
[09:08:29] prestori_: has joined #RubyOnRails
[09:08:39] dionysus69: has joined #RubyOnRails
[09:09:01] ziyadb: garyserj: I'll review the search form, as since I added it, the user form no longer works. i.e. submitting through it does nothing, it only rerenders the registrations#new method instead of going to registrations#create (hence get vs. post issue)
[09:11:12] prestorium: has joined #RubyOnRails
[09:12:05] ziyadb: I tried removing the search form, but the user form is still not working
[09:13:05] ziyadb: this is what ends up happening after clicking submit:
[09:13:17] ziyadb: http://localhost:3000/users/sign_up?utf8=%E2%9C%93&authenticity_token=mu3NiAS0tA%3D%3D&user%5Bname%5D=Ziyad+Basheer&user%5Busername%5D=ziyadb&user%5Bemail%5D=ziyadbasheer%40gmail.com&user%5Bpassword%5D=MyPassword&user%5Bpassword_confirmation%5D=MyPassword&button=
[09:13:26] ziyadb: which clearly isn't supposed to happen if it was POSTing like it should
[09:13:39] jarr0dsz: has joined #RubyOnRails
[09:13:59] pd09041999: has joined #RubyOnRails
[09:14:28] ziyadb: I’m really just wondering what could possibly make devise break so badly
[09:18:59] Terens: has joined #RubyOnRails
[09:19:18] ziyadb: Hi terens
[09:19:44] Terens: I have several integrations that create a model based on STI
[09:20:08] Terens: integrationa_a/models integrationa_b/models ...
[09:20:34] Terens: what would be a restful way to create another resource from these?
[09:21:10] Terens: integration_X/models/export_to_other_model?
[09:25:16] ziyadb: terens: review https://guides.rubyonrails.org/routing.html#routing-concerns
[09:30:31] ziyadb: I'm still stuck on the devise GET/POST issue...
[09:32:00] pd09041999: has joined #RubyOnRails
[09:34:43] w0rd-driven: has joined #RubyOnRails
[09:36:03] blackbaba: has joined #RubyOnRails
[09:36:33] ziyadb: If I don't resolve this I'll have to take the params passed through get and pass them onto the create method... Since devise won't use POST for some reason that I cannot decipher
[09:39:41] DTZUZO: has joined #RubyOnRails
[09:45:57] blackbaba_: has joined #RubyOnRails
[09:55:52] dviola: has joined #RubyOnRails
[10:04:28] lunarkitty7: has joined #RubyOnRails
[10:33:06] srinidhi: has joined #RubyOnRails
[10:37:01] garyserj: I can see how form_for knows whether to show a blank form, or the form with user's data, 'cos it is based on variable e.g. form_for @user and if user=User.new or if e.g. user=User.all[0] Then it responds accordingly. But I understand that now form_for is replaced with form_with which has the header of form_with(model: user, local: true) do |form| So, it's not looking at a variable @user
[10:37:01] garyserj: So how is it deciding whether to show a blank form or a form with a user's data? rail generate scaffold uses form_with and a file _form.html.erb which uses the same generic form for new user or editing a user, and it somehow knows what to fill the form with, but I can't see how
[10:40:11] tbuehlmann: it's basically the same, just using the local variable `user` instead of the instance variable `@user`
[10:42:01] garyserj: I can't see a value ever being assigned to a variable user.. i'm looking in the user_controller.rb and in _form.html.erb
[10:44:30] garyserj: if the variable were local to the form, then how would the form know?
[10:44:54] garyserj: (I think it's the same form used for whether the user clicks edit, or whether the user clicks to create a new user)
[10:45:17] garyserj: oh I see I think it's passing a variable in
[10:45:49] tbuehlmann: yeah, when rendering the form the variable is passed
[10:50:37] garyserj: thanks.. also, when I look at the html of the form with the update button, it says method="post", whereas rails routes indicates that the acion should be 'put'. So why does it have method="post"?
[10:51:08] szulak_: has joined #RubyOnRails
[10:53:17] lankanmon: has joined #RubyOnRails
[10:55:09] ariedler: has joined #RubyOnRails
[11:00:47] tbuehlmann: garyserj: some browsers don't support certain http verbs, so rails uses POST instead of PUT and adds a custom form field to denote the actual http verb
[11:01:43] garyserj: wow, thanks
[11:01:44] tbuehlmann: something like this: <input type="hidden" name="_method" value="put">
[11:02:08] garyserj: yeah i see now, ta
[11:21:27] mangold: has joined #RubyOnRails
[12:00:24] GodFather: has joined #RubyOnRails
[12:21:05] szulak_: has joined #RubyOnRails
[12:28:08] rascencio: has joined #RubyOnRails
[13:29:06] jefffrails35: has joined #RubyOnRails
[13:32:48] Eindoofus: has joined #RubyOnRails
[13:34:28] Eindoofus: hi, can someone point me to a good tutorial or book for using Rails to build a REST API that interacts with a database? i haven't used rails and don't have any plans to use it for MVC. i have some basic Java Spring Data REST experience
[13:37:34] Eindoofus: or do you guys recommend against it?
[13:37:58] Eindoofus: i guess you've probably heard this question a million times
[13:43:36] jefffrails35: hi eindoofus this tutorial seems nice: https://web-crunch.com/ruby-on-rails-api-vue-js just skip the vuejs part
[13:45:39] Eindoofus: thanks jeffrails35
[13:52:47] jefffrails35: eindoofus, Start by creating a new rails project with the api option, you can follow a rails tutorial to learn how to use db migrations, models, controllers, routes.here is a really good tutorial: https://www.railstutorial.org/book/modeling_users#sec-user_model just skip everithing related to views
[13:55:15] agent_white: has joined #RubyOnRails
[14:08:00] jefffrails35: has joined #RubyOnRails
[14:10:57] kapil____: has joined #RubyOnRails
[14:21:16] tdy: has joined #RubyOnRails
[14:25:54] gregf_: has joined #RubyOnRails
[14:27:07] s00pcan: has joined #RubyOnRails
[14:29:05] pd09041999: has joined #RubyOnRails
[14:42:25] Eindoofus: i'm a bit lost. just ran 'rails db:migrate' from the tutorial and i believe it created a table? somewhere
[14:42:36] Eindoofus: i'm not even sure if i have a local database running
[14:48:10] Eindoofus: oh wait. did that create a sqlite database? where is the config for that?
[14:48:51] Eindoofus: sorry .. see it now: database.yml
[14:52:24] jefffrails35: rails default to sqlite3 if you didn't specify something else when creating the project, your db is under the db folder
[15:08:21] regedit: has joined #RubyOnRails
[15:09:29] Saukk: has joined #RubyOnRails
[15:14:09] prestorium: has joined #RubyOnRails
[15:18:28] ascarter: has joined #RubyOnRails
[15:34:04] lato: has joined #RubyOnRails
[16:01:12] conta1: has joined #RubyOnRails
[16:07:09] MrCrackPotBuilde: has joined #RubyOnRails
[16:08:55] zautomata: has joined #RubyOnRails
[16:09:57] ascarter: has joined #RubyOnRails
[16:22:04] darris: has joined #RubyOnRails
[16:37:45] duderonomy: has joined #RubyOnRails
[16:43:59] SteenJobs: has joined #RubyOnRails
[16:59:41] gambl0re: has joined #RubyOnRails
[17:02:45] orbyt_: has joined #RubyOnRails
[17:04:21] planigan: has joined #RubyOnRails
[17:23:59] SteenJobs: has joined #RubyOnRails
[17:27:52] davidfetter_work: has joined #RubyOnRails
[17:28:56] davidfetter_work: I'm a DBA just starting to touch Rails, so please be gentle. Is there a way to get a migration to spit out the SQL it intends to run without running it?
[17:47:49] pd09041999: has joined #RubyOnRails
[17:51:50] uks: has joined #RubyOnRails
[18:17:49] ascarter_: has joined #RubyOnRails
[18:20:39] SteenJobs_: has joined #RubyOnRails
[18:21:11] tdy1: has joined #RubyOnRails
[18:23:26] pro777: davidfetter_work> Why not just run it?
[18:25:10] pro777: I mean, run it locally?
[18:25:34] davidfetter_work: Pro777: ah, I was about to say, "not on the multi-TB prod database"
[18:25:39] davidfetter_work: Thanks for the suggestion :)
[18:26:47] gambl0re: has joined #RubyOnRails
[18:28:13] davidfetter_work: Pro777: is there a way to tell it, "damn the torpedoes" and ignore all errors including "that table doesn't exist"?
[18:28:47] pro777: davidfetter_work> You mean locally?
[18:29:08] pro777: Well, you could just drop, create, and run all the migrations again.
[18:29:11] davidfetter_work: basically, I just want to see what it's going to try to run
[18:29:12] pro777: Of course you lose all your data.
[18:29:22] pro777: Depends on how nice your seeds are.
[18:29:37] davidfetter_work: there's no "local" for this just yet, and the prod db is unwieldy
[18:30:03] davidfetter_work: ...which is why I was looking for ways to just "dry run" the migration rather than hope it's doing the right thing.
[18:30:21] davidfetter_work: Hope is a strategy I don't use much on account of its ineffectiveness ;)
[18:31:41] pro777: davidfetter_work> I've not used this, but it might be precisely what you are looking for: https://github.com/bdurand/capture_migration_sql
[18:33:17] pro777: Ahh, looks like that only logs them while they are being run.
[18:41:16] davidfetter_work: if it pretends to be a DB and spits stuff out to a file, that'd be about perfect
[18:43:37] davidfetter_work: thanks again, Pro777 :)
[18:48:39] maryo: has joined #RubyOnRails
[19:03:02] SteenJobs: has joined #RubyOnRails
[19:10:46] maryo: has joined #RubyOnRails
[19:18:00] orbyt_: has joined #RubyOnRails
[19:21:19] LtHummus: has joined #RubyOnRails
[19:34:02] cek: has joined #RubyOnRails
[19:39:45] Dbugger: has joined #RubyOnRails
[19:55:01] Dbugger: has left #RubyOnRails: ("Leaving")
[19:58:47] MrCrackPotBuilde: has joined #RubyOnRails
[20:02:35] tdy1: has joined #RubyOnRails
[20:17:51] JJonah: We have a library file that is getting loaded twice. I believe Rails auto-loading is causing this. The errors vanishes if I put an `unless defined? ConstantDefinedInTheFile` around the contents of the file, but this is obviously a horrible solution. Does Rails provide any mechanism natively to ensure that the auto-loading won't reload the same file? If not, what other options do we have?
[20:41:18] JJonah: Looks like setting cache_classes=true in dev fixes it...
[21:02:21] tdy1: has joined #RubyOnRails
[21:46:33] MrCrackPotBuilde: has joined #RubyOnRails
[21:50:55] tdy1: has joined #RubyOnRails
[21:52:01] RiPuk: has joined #RubyOnRails
[21:52:36] Fernando-Basso: has joined #RubyOnRails
[22:03:06] truenito: has joined #RubyOnRails
[22:09:41] yoshie902a: has joined #RubyOnRails
[22:10:11] yoshie902a: How do I present this from escaping? ```link_to(content_tag( :span, listing.listable_type, {class: "message-listable-type"}, false) , listing.listable)```
[22:13:47] yoshie902a: https://www.pastiebin.com/5cb7a5124088a
[22:26:37] crankharder: has joined #RubyOnRails
[22:26:59] paul0: has joined #RubyOnRails
[22:29:25] tdy1: has joined #RubyOnRails
[22:32:03] nnielsen: has joined #RubyOnRails
[23:12:32] gambl0re: has joined #RubyOnRails
[23:51:47] yoshie902a: has left #RubyOnRails: ()
[23:59:06] truenito: has joined #RubyOnRails