« Back to channel list

#RubyOnRails - 01 June 2019

« Back 1 day Forward 1 day »
[00:10:56] skryking: has joined #RubyOnRails
[00:13:55] orbyt_: has joined #RubyOnRails
[00:17:25] ephemer0l: has joined #RubyOnRails
[00:28:47] haxx0r: has joined #RubyOnRails
[00:30:06] brandoncc: has joined #RubyOnRails
[00:44:55] bambanxx: has joined #RubyOnRails
[00:51:08] weteamsteve: has joined #RubyOnRails
[00:52:12] weteamsteve2: has joined #RubyOnRails
[00:52:37] bambanx: has joined #RubyOnRails
[01:03:07] brandoncc: has joined #RubyOnRails
[01:11:04] apparition: has joined #RubyOnRails
[01:24:01] orbyt_: has joined #RubyOnRails
[01:36:11] weteamsteve: has joined #RubyOnRails
[01:36:49] bambanxx: has joined #RubyOnRails
[01:53:20] randomuseragain: has joined #RubyOnRails
[01:54:05] xco: has joined #RubyOnRails
[01:59:07] HumorBaby: has joined #RubyOnRails
[02:06:50] Fire-Dragon-DoL: has joined #RubyOnRails
[02:07:58] weteamsteve: has joined #RubyOnRails
[02:12:52] weteamsteve1: has joined #RubyOnRails
[02:15:35] Technodrome: has joined #RubyOnRails
[02:32:24] DTZUZO: has joined #RubyOnRails
[02:35:36] xco: has joined #RubyOnRails
[02:54:30] duderonomy: has joined #RubyOnRails
[03:02:27] gambl0re: has joined #RubyOnRails
[03:10:59] braincrash: has joined #RubyOnRails
[03:37:43] Technodrome: has joined #RubyOnRails
[04:29:13] orbyt_: has joined #RubyOnRails
[04:33:40] haxx0r: has joined #RubyOnRails
[04:36:16] Saukk: has joined #RubyOnRails
[04:37:22] pitastrudl: has joined #RubyOnRails
[04:51:41] nOgAnOo: has joined #RubyOnRails
[04:52:35] Mutsuhito: has joined #RubyOnRails
[04:53:23] fowlduck: has joined #RubyOnRails
[04:53:27] pro777: has joined #RubyOnRails
[04:53:39] frewsxcv: has joined #RubyOnRails
[04:54:02] mattwc: has joined #RubyOnRails
[04:55:42] pitastrudl: has joined #RubyOnRails
[05:01:56] Technodrome: has joined #RubyOnRails
[05:19:38] duderonomy: has joined #RubyOnRails
[05:34:10] duderonomy: has joined #RubyOnRails
[05:41:40] duderonomy: has joined #RubyOnRails
[05:47:05] duderonomy: has joined #RubyOnRails
[05:53:54] duderonomy: has joined #RubyOnRails
[06:08:33] duderonomy: has joined #RubyOnRails
[06:31:49] duderonomy: has joined #RubyOnRails
[06:34:47] duderonomy: has joined #RubyOnRails
[06:36:07] Saukk: has joined #RubyOnRails
[06:56:55] sameerynho: has joined #RubyOnRails
[06:59:50] duderonomy: has joined #RubyOnRails
[07:03:20] snowyrooftops: has joined #RubyOnRails
[07:05:42] snowyrooftops: I recently taught myself to use Rails and started building tiny web applications... it's a breeze to use. I was previously an ASP.NET developer.
[07:08:05] snowyrooftops: Ruby has a really good syntax. The best thing about Ruby (that I've tried so far...) is the optional brackets for function calls. Chaining functions is as simple as Object.func1.func2.func3.func4
[07:09:10] snowyrooftops: And the "!"/"?" suffix is pretty neat. It's a great alternative to by-reference/by-value argument passing with the "&" that other languages use.
[07:09:52] snowyrooftops: Rails adds to the magic: 3.days.ago :-)
[07:11:00] snowyrooftops: Quiet day on this channel, huh?
[07:37:56] snowyrooftops: How much would a rails bug bug, if a rails bug could bug you?
[07:51:32] orbyt_: has joined #RubyOnRails
[08:03:20] duderonomy: has joined #RubyOnRails
[08:17:43] duderonomy: has joined #RubyOnRails
[08:31:21] jasmin__: has joined #RubyOnRails
[08:47:05] ravenousmoose: has joined #RubyOnRails
[08:57:02] webdestroya: has joined #RubyOnRails
[09:09:02] xco: has joined #RubyOnRails
[09:14:19] sirensari2: has joined #RubyOnRails
[09:15:48] tdy1: has joined #RubyOnRails
[09:28:58] skryking: has joined #RubyOnRails
[09:31:14] schne1der: has joined #RubyOnRails
[09:33:14] jefffrails35: has joined #RubyOnRails
[09:50:08] ravenousmoose: has joined #RubyOnRails
[10:36:57] xco: has joined #RubyOnRails
[10:46:25] haxx0r: has joined #RubyOnRails
[10:59:29] lankanmon: has joined #RubyOnRails
[11:01:20] agent_white: has joined #RubyOnRails
[11:12:47] Dbugger: has joined #RubyOnRails
[12:04:45] Fridtjof: has joined #RubyOnRails
[12:34:17] emachnic: has joined #RubyOnRails
[12:36:27] Technodrome: has joined #RubyOnRails
[12:55:49] snowyrooftops: has joined #RubyOnRails
[13:26:24] randomuseragain: has joined #RubyOnRails
[13:34:04] jpaulo6ba: has joined #RubyOnRails
[13:41:37] Fridtjof: has joined #RubyOnRails
[13:58:12] Technodrome: has joined #RubyOnRails
[14:18:34] jarr0dsz: has joined #RubyOnRails
[14:18:58] jarr0dsz: hello everyone, im trying to solve a little bit complex routing issue once again and im stuck hope some experts can give me some pointers
[14:19:33] jarr0dsz: for example i have this routes: https://0bin.net/paste/5e7zoRwL+Q1ysHgu#OV7d8qLT4DyB64X-exPaCME5GgKCZ89P4mWg7GbLPuu i need 2 named routes for 2 routes that point to the same controller and method but have optional param
[14:20:21] jarr0dsz: so basically im trying to have multiple routes that all point to the same actions
[14:21:06] jarr0dsz: like /students/university/step1 /students/board/step1
[14:21:25] jarr0dsz: and if no 'stepx' is provided it should route also the controller requests/step1 is this possible somehow?
[14:24:10] randomuseragain: jarr0dsz: If I'm not mistaken, you might be able to do that by defining custom route. Have you tried that?
[14:24:41] jarr0dsz: how about im doing it like so: https://0bin.net/paste/AT3TieHtBFgTYuaQ#wj+DqiqsVHCWriotvQb9Bz1Xv6QSFUqaOupP0l+I9ng
[14:24:47] jarr0dsz: would that be an acceptable solution rails wise?
[14:25:40] jarr0dsz: mistake this one: https://0bin.net/paste/kWdjEg4KT2tAFtiC#kBlHOQ7j+zeSyCF02tbN9hZo+P8ITsLplXR748DF2Z5 ( complete )
[14:26:10] jarr0dsz: this should work for /students/identifier/step1 /students/identifier and /students/step1 and /students
[14:26:46] randomuseragain: jarr0dsz: Do you get those routes when you run rake routes?
[14:27:11] jarr0dsz: the problem is my controller expects a "step" param and this is not included if i output the params
[14:27:20] jarr0dsz: let me output my routes and params for each route in a new gist
[14:30:21] jarr0dsz: randomuseragain this is my whole output: https://0bin.net/paste/SjzThlVtgj2sPNlp#wPpC4gOzgLtJtIWK6abusCUZxiS76kpXHNOCK5Dq7er
[14:31:10] jarr0dsz: line 22 in the paste gives me not a value for identifier param but for step instead. (:step) is overruling it
[14:31:43] jarr0dsz: so i think i should find a solution to have both /students/step1 and /students/newyork
[14:32:21] jarr0dsz: the steps are always a defined set of steps, step1,step2,step3, could is somehow find a way to differentiate between a 'step' and something else with the routes #totallyconfused on how to solve this
[14:32:42] jarr0dsz: since ofcourse /students/step is assigned to the :step param since the routes is setup like that
[14:32:52] jarr0dsz: basically i want to have a different param for the same route :(
[14:33:46] jarr0dsz: + additional i have to find a way to route each step to the correct step instead of hardcoded #step1 i have now. Each step param would route to #step1 in the controller
[14:37:01] randomuseragain: jarr0dsz: What does your controller look like?
[14:39:52] Fridtjof: has joined #RubyOnRails
[14:40:27] jarr0dsz: randomuseragain something like this ( cleanedup) https://0bin.net/paste/-BC6JbP4053Km0q6#0Kr16-bKNjlw5IfR40Ffym3MOMchkkfw3XQTndlZvi9
[14:40:52] jarr0dsz: so im not even very happy with the controller but found it somewhere online on doing multistep forms
[14:41:09] jarr0dsz: if you have any suggestions on how i could improve this also very welcome
[14:41:25] jarr0dsz: for now my main goal is to first get the routes work, with loading correct step from controller
[14:41:51] randomuseragain: jarr0dsz: I could be wrong but have you tried creating a completely different route instead with different syntax and having a specific action for this?
[14:42:17] jarr0dsz: could you explain that a bit more please?
[14:42:38] randomuseragain: Do you need the two routes you mentioned to point to the same action?
[14:43:18] jarr0dsz: could somehow set a default value for param step work?
[14:43:53] jarr0dsz: so default value of step = 'step1' so even if i have no step params applied but only a indentifier param /students/identifier. the step param would be 'step1' thus not overwriting the identifier param?
[14:44:44] jarr0dsz: like :defaults => { :step => "step1" }
[14:51:02] randomuseragain: jarr0dsz: Is this for some type of form?
[14:51:22] jarr0dsz: i think im maybe should move the decision making to the controller instead of inside the routes
[14:53:04] randomuseragain: jarr0dsz: I think there may be a conflict with the route naming convent
[14:57:52] Fridtjof: has joined #RubyOnRails
[14:58:22] randomuseragain: jarr0dsz: When i see /students/newyork, it looks like you want it to hit the step1 action
[14:58:41] jarr0dsz: yes. to begin with.
[14:58:52] jarr0dsz: but i also want /students/step1 to hit step1
[14:59:01] jarr0dsz: AND be able to determine the difference
[14:59:20] jarr0dsz: so /students/newyork should give me params identifier = new york and step = step1
[14:59:42] jarr0dsz: so /students/step1 should give me params identifier = nil and step = step1
[14:59:59] jarr0dsz: perhaps this is not possible? no-one in the channel has come across this someday?
[15:12:12] notarob0t: has joined #RubyOnRails
[15:13:10] jarr0dsz: ok so i just let the params step for now and in the controller i check the value of it
[15:13:18] jarr0dsz: this seems like a workaround not very fancy but ok
[15:14:15] notarob0t: Hi everyone, not sure if this is the correct channel for this but I'm having issues deploying a rails app over to heroku. Would anyone be able to point me in the right direction?
[15:15:56] havenwood: notarob0t: what problem are you running into?
[15:18:14] notarob0t: havenwood: So when I run "git push heroku master" I get an oudated yarn lockfile error even after I've deleted it. Here's what that looks like: https://dpaste.de/ukd8
[15:20:36] havenwood: notarob0t: regenerate the Yarnfile.lock and check in into git, then `git push` again
[15:21:44] havenwood: notarob0t: the steps suggested in the error message, with `yarn install` should work. if not, let us know what the new issue is.
[15:22:34] notarob0t: Oh I've tried that. The error still shows up
[15:25:53] notarob0t: Error looks like this: https://dpaste.de/KK9t
[15:29:01] ariedler: has joined #RubyOnRails
[15:29:16] notarob0t: A bit more info on the app - it's a rails app with reactjs frontent
[15:29:39] notarob0t: havenwood: frontend*
[15:30:48] havenwood: notarob0t: sanity check that you've for sure added the yarn.lock to git? it's definately committed?
[15:31:28] havenwood: notarob0t: error Your lockfile needs to be updated, but yarn was run with `--frozen-lockfile`
[15:32:20] havenwood: i guess that makes sense for prod, but why does it think `yarn.lock` needs updating? because yarn.lock wasn't committed at all or there are actually differences? unsure.
[15:37:36] notarob0t: Not sure, I did commit the change but still get the same error
[15:42:16] notarob0t: Oh wait. Just noticed this toward the end of the log: [remote rejected] master -> master (pre-receive hook declined)
[15:42:45] notarob0t: I guess it's because of the yarn file though
[15:53:40] xco: has joined #RubyOnRails
[15:56:08] notarob0t: havenwood: I just tried deploying using the heroku dashboard and choosing a github deployment method vs the heroku cli. The build succeeds but does not run the app and I think it's because it needs a procfile. Just not sure exactly how to go about setting that up. My app uses a postgresql db, and I start it up using rails server command
[15:57:06] notarob0t: havenwood: would you happen to know what I should add for a procfile if this is the actual solution?
[16:00:56] havenwood: notarob0t: a Profile doesn't hurt. i usually end up adding one as the app grows anyways, for workers.
[16:01:01] havenwood: notarob0t: web: rails server -p "$PORT"
[16:07:04] DoctorMonocular: has joined #RubyOnRails
[16:08:08] DoctorMonocular: hey I'm having trouble setting up a tricky route
[16:08:13] DoctorMonocular: here's my attempt: https://gist.github.com/PeteMichaud/003d7faaedbe4067a9d8e778ecbf5825
[16:08:37] DoctorMonocular: I want myapp.com/:slug to go to the organization that has that :slug
[16:09:03] DoctorMonocular: but I also want myapp.com/ to go to a different place, thehome page
[16:09:53] DoctorMonocular: right now I have the homepage loading, but if I try any slug, it just fails as no route matches [get] "/testslug"
[16:10:51] Saukk: has joined #RubyOnRails
[16:17:44] randomuseragain: havenwood: ok cool, I've added this to my procfile "web: rails server -p 3001"
[16:20:27] notarob0t: havenwood: For some reason I'm getting this error on heroku: https://dpaste.de/D3OO
[16:21:41] havenwood: randomuseragain: it's supposed to be just: "$PORT"
[16:21:50] havenwood: notarob0t: not 3001
[16:21:59] havenwood: notarob0t: Heroku sets PORT
[16:22:29] notarob0t: havenwood: Do you know where I could define that?
[16:22:48] havenwood: notarob0t: you don't, you just put this in your Procfile, and Heroku automagically sets PORT:
[16:22:55] havenwood: web: rails server -p "$PORT"
[16:23:19] havenwood: notarob0t: https://devcenter.heroku.com/articles/procfile
[16:26:45] davidh38: has joined #RubyOnRails
[16:31:59] tdy1: has joined #RubyOnRails
[16:34:16] notarob0t: havenwood: You can refer to your app’s config vars, most usefully $PORT, in the commands you specify.
[16:36:59] havenwood: notarob0t: you can set various env vars, then use them by putting a dollar sign in front. Heroku sets port. You just in your env file write the word: $PORT
[16:37:20] havenwood: notarob0t: literally, the line that goes in your Procfile without modification is: web: rails server -p "$PORT"
[16:38:16] notarob0t: Ah ok. I have to define the env variable as well
[16:38:46] notarob0t: havenwood: correct?
[16:39:48] havenwood: notarob0t: afaik, Heroku sets PORT for you - it's one of the predefined environment variables
[16:40:26] havenwood: notarob0t: You can see what env vars are set with: heroku run printenv
[16:41:07] notarob0t: ahhhh, gotcha.
[16:43:02] _aeris: has joined #RubyOnRails
[16:45:41] GreekFreak: has joined #RubyOnRails
[16:46:22] GreekFreak: I am trying to run tests using RSpec and FactoryBot (new to testing)
[16:46:37] GreekFreak: I keep getting Uninitialized constact error for my factory, but for the life of me I can't find out why. I've copied one of my working examples and it still gives me the error. Any help would be appreciated for something that I've missed : https://gist.github.com/tscholiadis/68b95a08851506ba717c07ff0a652561
[16:48:32] notarob0t: havenwood: this rails app acts like an api for the react app. I have it communicating over a specific port. So in my react client section I have a proxy defined https://dpaste.de/dFwY and in rails cors.rb file I've got that defined as https://dpaste.de/j7Jd.
[16:49:04] notarob0t: or origins is defined as what you see there
[16:50:26] notarob0t: havenwood: Would I have to modify this so that it can work on heroku?
[16:51:19] notarob0t: Or would you know if that's what needs to be done?
[16:56:01] davidh38: has joined #RubyOnRails
[16:56:38] orbyt_: has joined #RubyOnRails
[16:58:26] davidh38: has joined #RubyOnRails
[17:00:26] GreekFreak: I solved the issue by mistake. In the Factory, instead of doing "factory :invite_token, class: 'Bluverve/InviteToken' do" I had to do "factory :invite_token, class: Bluverve::InviteToken do". Ironically, the factory creates it as a string...
[17:13:03] Exuma: has joined #RubyOnRails
[17:13:20] Exuma: I have a DB transaction with a method in it. inside that method it doesnt use a transaction. if that inner method raises, why doesnt the outer transaction roll back the inner changes
[17:13:28] Exuma: the changes get created in the inner method
[17:33:16] naltun: has joined #RubyOnRails
[17:36:32] naltun: I'm using Rails 5.2.2. I have two Rails apps in two separate folders (eg. `ls # => dir1/ dir2/`)
[17:37:06] naltun: When I run `rake db:migrate` in `dir2`, a migration file from `dir1` is applied to the `schema.rb` file for `dir2.
[17:37:48] naltun: I even moved dir2 outside of the directory with dir1 and dir2, and migrating still applies the migration file from dir1.
[17:37:50] naltun: Any thoughts?
[17:49:27] davidh38: has joined #RubyOnRails
[17:49:56] Xiti: has joined #RubyOnRails
[17:58:51] davidh38: has joined #RubyOnRails
[18:00:54] KeyJoo: has joined #RubyOnRails
[18:03:45] DTZUZO: has joined #RubyOnRails
[18:28:33] DoctorMonocular: Exuma: does the internal method catch its own exception? to make a transaction roll back the exception has to hit it, not be caught
[18:29:21] DoctorMonocular: naltun: do they share a database?
[18:35:59] orbyt_: has joined #RubyOnRails
[18:54:23] notarob0t: Hi everyone, not sure if this is the correct channel for this. I'm having trouble deploying a rails app with react frontend over to heroku. Not sure exactly what's up but the app doesn't appear and could be a deployment issue.
[18:56:21] notarob0t: It's successfully deployed, but doesn't appear to be running because it won't show up when I visit it
[19:03:31] ravenousmoose: has joined #RubyOnRails
[19:13:26] davidh38: has joined #RubyOnRails
[19:16:20] DoctorMonocular: I'm having trouble creating a custom primary key. I have a psql function called id_generator, and I call it like this: https://gist.github.com/PeteMichaud/c20fe0a16f1c7c2d912eb69282bb4404
[19:16:40] DoctorMonocular: the function works if I call it directly, creating a bigint
[19:16:56] DoctorMonocular: but when rails saves a new organization the value is always 0
[19:17:00] DoctorMonocular: what am I doing wrong?
[19:35:05] ravenousmoose: has joined #RubyOnRails
[19:38:55] uks: has joined #RubyOnRails
[19:49:34] xco: I have a polymorphic association that looks like so: https://gist.github.com/xcobar/fb375cc4f7fbeadefbaf0f1deb95fac0 is it possible to joing these three tables? If so, how?
[19:49:56] xco: Can’t seem to find anything online on joining poymorphic association and not sure if this is possible
[19:55:20] DoctorMonocular: I don't understand the question
[19:55:36] xco: question is: How do i join those 3 tables?
[19:55:43] DoctorMonocular: org has people, person has_one org, both have addresses
[19:56:05] DoctorMonocular: has_many :people should just work
[19:56:09] xco: correct
[19:56:18] DoctorMonocular: or has_many :members, class: Person or whatever
[19:56:38] xco: you mean has_man :people on Address table?
[19:56:44] DoctorMonocular: class_name, I can't remember the exact option
[19:57:30] xco: but i already have has_many :members, through: :memberships, source: :person on Org
[19:57:45] DoctorMonocular: yeah I'm saying I don't know why you have that and suspect you should replace it
[19:57:52] DoctorMonocular: with has_many :people
[19:58:26] xco: but question still remains how do i join those 3 tables? is it possible?
[19:58:56] DoctorMonocular: I still don't really understand what you mean by that -- of course you can join any tables, but what are you actually trying to do?
[19:59:22] xco: trying to search across all three models
[19:59:29] xco: given an attribute on ANY of those tables
[19:59:38] xco: so my idea is
[19:59:42] xco: if i joined those 3 tables
[20:00:08] xco: i give any attribute that’s present on any table i can pull that record out
[20:00:09] DoctorMonocular: you want a full text search
[20:00:33] DoctorMonocular: I didn't actually read this, but a quick google turned up: https://www.calebthompson.io/talks/search/
[20:00:42] DoctorMonocular: that is the key word you're looking for though
[20:02:26] xco: so searching across models is call “full text search”?
[20:02:32] xco: i didn’t know that
[20:03:09] xco: i thought that term was for when you’re search only through “text” and not across associated methods
[20:03:52] DoctorMonocular: well, it's related -- full text search CAN be on a single table, it's actually a way of sort of combining columns into a single, internal index column and being able to say "is there text in this similar to the following search string?"" and the thing is that you can set up that search to go across whatever tables you want
[20:05:26] xco: thanks Doc, i’ll check the video out
[20:05:53] xco: heard and came across “full text search” but never thought it could be what i’m looking for
[20:06:50] DoctorMonocular: yeah it's a little tricky because it sounds like it can only do text columns or whatever
[20:07:10] xco: exactly
[20:07:13] DoctorMonocular: but actually what's happening is that the values of whatever columns you want are being combined into a single, text-based, search column
[20:08:58] weteamsteve: has joined #RubyOnRails
[20:21:09] weteamsteve1: has joined #RubyOnRails
[20:26:27] maryo: has joined #RubyOnRails
[20:41:34] jpaulo6ba: has joined #RubyOnRails
[21:05:21] tdy: has joined #RubyOnRails
[21:10:26] davidh38: has joined #RubyOnRails
[21:37:18] sameerynho: has joined #RubyOnRails
[21:51:29] gb_away: has joined #RubyOnRails
[22:05:32] bambanx: has joined #RubyOnRails
[22:29:44] ariedler: has joined #RubyOnRails
[22:41:54] bambanxx: has joined #RubyOnRails
[22:43:14] bambanxx: has joined #RubyOnRails
[22:59:48] ariedler: has joined #RubyOnRails
[23:03:53] RiPuk: has joined #RubyOnRails
[23:04:06] phaul: has joined #RubyOnRails
[23:05:11] ariedler: has joined #RubyOnRails
[23:13:38] davidh38: has joined #RubyOnRails
[23:21:46] davidh38: has joined #RubyOnRails
[23:54:43] prauat: has joined #RubyOnRails
[23:56:42] prauat: Hi, all is there anyone that can explain me what is broken here https://www.pastiebin.com/5cf30f8bb7d8c ?