« Back to channel list

#RubyOnRails - 06 July 2018

« Back 1 day Forward 1 day »
[00:12:56] jbd7072: has joined #RubyOnRails
[00:24:27] bradleyprice: has joined #RubyOnRails
[00:40:08] kurko_: has joined #RubyOnRails
[00:55:00] sevenseacat: has joined #RubyOnRails
[01:13:02] apeiros: has joined #RubyOnRails
[01:22:06] DylanJ: has joined #RubyOnRails
[01:52:25] jmay: has joined #RubyOnRails
[01:56:44] ule: Hey guys. After I upgraded to Rails 5, if I pass an empty value like this it doesn't show up on my params insite my controller:
[01:57:12] ule: post :update, params: { foo: []}
[01:57:23] ule: If I pass: post :update, params: { foo: ['']} # it works
[01:57:33] ule: or post :update, params: { foo: []}, as: :json # it also works
[01:57:58] ule: so my question is: How to make that pass without as: :json? Just passing foo: []?
[02:03:42] optikalmouse: has joined #RubyOnRails
[02:05:55] Technodrome: has joined #RubyOnRails
[02:12:46] aiguuu: has joined #RubyOnRails
[02:12:47] bradleyprice: has joined #RubyOnRails
[02:21:15] jnollette: has joined #RubyOnRails
[02:36:23] osp2: if I have a User and UserLevel model, where User has_one UserLevel (basically an int 1-5); how do I create a default UserLevel?
[02:37:01] osp2: UserLevel has a title:string (e.g. elevated privileges) and a level:int (e.g. 3)
[02:37:27] osp2: the thing is, I can't guarantee the ID of the UserLevel when the db is seeded, right?
[02:38:32] darkhanb: has joined #RubyOnRails
[02:51:33] osp2: anyone? =)
[02:51:35] optikalmouse: osp2: yep you can
[02:51:50] osp2: by forcing the id in the seeds?
[02:51:59] optikalmouse: you can create X number of UserLevel instances, save them and then grab whatever id they have
[02:52:14] optikalmouse: no need to force the id, it'll be populated after you create them
[02:52:46] osp2: I'm not sure I follow
[02:52:52] optikalmouse: you can also have constants for the titles that finds or creates them so you dont have to rely on the seed.db
[02:53:15] osp2: how do you do that?
[02:53:21] osp2: is that possible in a migration?
[02:55:34] jmay: has joined #RubyOnRails
[02:56:50] optikalmouse: yah you can do it in a migration; it would be the same as a doing it in the seed db
[02:57:32] optikalmouse: osp2: http://edgeguides.rubyonrails.org/active_record_migrations.html#migrations-and-seed-data
[02:58:06] akaiiro: has joined #RubyOnRails
[03:00:18] optikalmouse: level_one = UserLevel.create(title: UserLevel::LEVEL_ONE) ; User.create(name: 'some user', user_level: level_one)
[03:00:23] optikalmouse: as an example ^
[03:00:37] osp2: optikalmouse, just read that section and it didn't look like what I'm trying to do exactly
[03:00:43] osp2: here's an example
[03:00:44] osp2: https://hastebin.com/aqajabohis.rb
[03:01:14] osp2: or is that the wrong approach?
[03:02:07] optikalmouse: that's a good approach; the user_levels.each block has to be moved into the def change
[03:02:16] optikalmouse: you can create both tables in one migration along with the seed data
[03:02:36] optikalmouse: or have a separate migration that is the 2nd migration that runs after with the seed data
[03:04:58] osp2: so I'd prefer to do a separate migration just because I've already ran the migration for user_levels (I'm a beginner so idk how to undo and I"m afraid of messing it up :P); would that just look something like: `t.references :user_levels, default: UserLevel.where(title: 'anyone')`
[03:05:18] osp2: `t.references :user_levels, default: UserLevel.where(title: 'anyone').first`
[03:09:31] kapil___: has joined #RubyOnRails
[03:09:48] braincrash: has joined #RubyOnRails
[03:16:43] Lauer: has joined #RubyOnRails
[03:30:37] optikalmouse: osp2: that makes sense!
[03:30:50] osp2: yup :) I've been experimenting
[03:30:59] osp2: but it looks like my associations aren't working properly now
[03:31:02] osp2: so 2 steps forward 1 step back
[03:31:08] osp2: at least it's progress :D
[03:31:56] osp2: appreciate the help my dude/dudette
[03:48:21] ephemer0l: has joined #RubyOnRails
[03:48:51] 07IADCW4V: has joined #RubyOnRails
[03:56:07] Technodrome: has joined #RubyOnRails
[04:33:16] jackhum: has joined #RubyOnRails
[04:41:08] Saukk: has joined #RubyOnRails
[04:49:18] bradleyprice: has joined #RubyOnRails
[04:50:44] jackhum: has joined #RubyOnRails
[05:08:04] DTZUZO: has joined #RubyOnRails
[05:21:59] srinidhi: has joined #RubyOnRails
[05:27:11] dionysus69: has joined #RubyOnRails
[05:42:10] Aherin: has joined #RubyOnRails
[05:43:21] aiguuu: has joined #RubyOnRails
[05:48:34] Aherin: has joined #RubyOnRails
[05:55:15] kimgb: has joined #RubyOnRails
[06:05:08] apeiros: has joined #RubyOnRails
[06:20:07] hfp_work: has joined #RubyOnRails
[06:29:07] Saukk: has joined #RubyOnRails
[06:30:05] dionysus69: has joined #RubyOnRails
[06:34:59] jackhum: has joined #RubyOnRails
[06:36:55] mtkd: has joined #RubyOnRails
[06:57:58] cgfbee: has joined #RubyOnRails
[07:13:12] jackhum: has joined #RubyOnRails
[07:26:52] crankharder: has joined #RubyOnRails
[07:27:03] apeiros: has joined #RubyOnRails
[07:53:58] Dbugger: has joined #RubyOnRails
[08:01:57] conta: has joined #RubyOnRails
[08:10:36] Sylario: has joined #RubyOnRails
[08:11:21] bradleyprice: has joined #RubyOnRails
[08:34:56] Xiti: has joined #RubyOnRails
[08:41:18] reber: has joined #RubyOnRails
[08:45:01] Jason2245: has joined #RubyOnRails
[08:46:19] Jason2245: Hi guys! Having issues with irb console / rails console. I realized it happens USUALLY when i copy and paste a piece of code into the terminal.
[08:46:46] Jason2245: Basically all of sudden it starts inserting "\r " on every key press
[08:47:44] Jason2245: No idea if it is related to linux environment. Happens only in irb console
[08:49:16] Jason2245: Example, i paste this: Driver.select(:id, :name).joins(:shifts).merge(Shift.in_time_range(Time.now - 6.hours, Time.now + 30.minutes)).merge(Shift.normal)
[08:50:50] Jason2245: Then i try to edit it so i quickly tap a few keys
[08:51:04] Jason2245: Driver.select(:id, :name).joins(:shifts)..merge(Shift.in_time_range(Time.now - 6.hours, Time.now + 30.minutes)).merge(Shift.normal)\r .merge(Shift.in_time_range(Time.now - 6.hours, Time.now + 30.minutes)).merge(Shift.normal)\r .merge(Shift.in_time_range(Time.now - 6.hours, Time.now + 30.minutes)).merge(Shif
[08:51:04] Jason2245: t.normal)\r
[08:51:07] Jason2245: And get this
[08:57:10] ur5us: has joined #RubyOnRails
[09:01:37] Jason2245: Hmm... Interesting. It happens if i navigate with cursor somewhere to the beginning of command and press SHIFT + '
[09:02:58] kapil___: has joined #RubyOnRails
[09:08:46] ariejan: has joined #RubyOnRails
[09:10:31] NL3limin4t0r: Jason2245: What line endings does the file you're copying from use? Does it use unix line endings ("\n") or windows line endings ("\n\r")?
[09:12:23] NL3limin4t0r: If the file uses Windows line endings you might want to convert them to unix line endings and try copying and pasting again.
[09:12:45] Jason2245: Hmm i copy from visual studio code
[09:13:05] Jason2245: so maybe it uses windows endings, ill check that
[09:16:36] NL3limin4t0r: Most editors have an option somewhere for that. In my editor (Sublime Text) it's under View->Line Endings->(Windows,Unix,Max OS 9).
[09:19:27] Jason2245: "files.eol": "\n"
[09:19:52] Jason2245: The default settings say it \n
[09:19:55] cheeti: has joined #RubyOnRails
[09:20:20] kimgb: has left #RubyOnRails: ()
[09:20:47] cheeti: hi iam using rails 5 how to validate required true for simple form collection_radio_buttons in client side
[09:21:16] cheeti: <%= f.collection_radio_buttons :environment, [[true, 'Yes'] ,[false, 'No']], :first, :last :default => true, :required => true %> not working
[09:22:58] Jason2245: @NL3limin4t0r I tested without copying line ending chars. Even if copy and paste middle part of a string the issue still exists
[09:23:24] hammer065: has joined #RubyOnRails
[09:25:36] ur5us: has joined #RubyOnRails
[09:26:26] kapil___: has joined #RubyOnRails
[09:26:38] NL3limin4t0r: Jason2245: hmm, I thought that could be it. In that case I have no clue. What's your environment setup? Do you run linux in a vm and are you trying to copy from a windows host to linux guest?
[09:27:07] Jason2245: just ArchLinux
[09:27:53] cabotto: has joined #RubyOnRails
[09:28:16] NL3limin4t0r: Have you tried a different shell?
[09:29:34] Jason2245: has joined #RubyOnRails
[09:30:13] Jason2245: NL3limin4t0r: It's so annoying i can't work ;D
[09:32:07] Jason2245: Hmm, okay i think it's terminal emulator related
[09:32:37] Jason2245: I am using terminator, doesn't seem to happen on gnome-terminal
[09:33:49] ariejan: has joined #RubyOnRails
[09:34:30] Jason2245: Thanks for help, sry for wasting your time. GOD DAMMIT
[09:37:31] NL3limin4t0r: cheeti: What is your expected result? Do you want to generate an error if the radio button is not checked?
[09:38:06] NL3limin4t0r: Also, have you set a database default value? If you've done that, it might be the reason no error is set.
[09:46:29] fragamus: has joined #RubyOnRails
[10:06:33] craysiii: has joined #RubyOnRails
[10:20:44] fragamus: has joined #RubyOnRails
[10:26:16] cabotto: has joined #RubyOnRails
[10:26:25] fox_mulder_cp: has joined #RubyOnRails
[10:36:03] cabotto: has joined #RubyOnRails
[10:46:08] cabotto: has joined #RubyOnRails
[10:48:00] chkhanch: has joined #RubyOnRails
[10:55:17] cheeti: NL3limin4t0r hi not set default value, i wnat to show tooltip when radio buttton not checked
[11:06:53] bradleyprice: has joined #RubyOnRails
[11:17:10] GodFather: has joined #RubyOnRails
[11:17:27] ariejan: has joined #RubyOnRails
[11:23:19] jackhum: has joined #RubyOnRails
[11:29:37] fragamus: has joined #RubyOnRails
[11:33:36] fragamus: has joined #RubyOnRails
[11:37:43] defsdoor: has joined #RubyOnRails
[12:04:04] nemesit: has joined #RubyOnRails
[12:11:53] hfp_work: has joined #RubyOnRails
[12:17:42] bradleyprice: has joined #RubyOnRails
[12:18:00] nzst: has joined #RubyOnRails
[12:19:06] epochwolf: has joined #RubyOnRails
[12:29:42] fmcgeough: has joined #RubyOnRails
[12:40:07] Quintasan: has joined #RubyOnRails
[12:43:43] Quintasan: Hi, does anyone have any tips on Docker Compose + Capybara + Selenium Chrome Headless testing? I did the following https://gist.github.com/Quintasan/d9f7786989a9c2a13385b3e59088c955 and when I do `docker-compose exec server bundle exec rspec -bw spec/features/normal_flow_spec.rb` it hangs after starting the webserver
[12:57:16] fmcgeough: has joined #RubyOnRails
[13:00:46] srinidhi: has joined #RubyOnRails
[13:18:35] ariejan: has joined #RubyOnRails
[13:26:28] Technodrome: has joined #RubyOnRails
[13:36:50] ariejan: has joined #RubyOnRails
[13:38:50] DrYockel: has joined #RubyOnRails
[13:42:58] uksio: has joined #RubyOnRails
[13:49:13] apparition: has joined #RubyOnRails
[13:57:41] rikkipitt: has joined #RubyOnRails
[13:58:21] rikkipitt: hey folks, I'm trying to get the Vue js https://vuejs.org/v2/guide/single-file-components.html to work in rails/webpacker
[13:59:27] rikkipitt: has anyone managed it? i think i'm missing some kind of babel plugin that'll allow vue style jsx...
[14:09:25] dblessing: has joined #RubyOnRails
[14:11:23] psychoslave: has joined #RubyOnRails
[14:12:33] kapil___: has joined #RubyOnRails
[14:22:07] npgm: has joined #RubyOnRails
[14:28:11] mtkd: has joined #RubyOnRails
[14:53:05] veloutin: has joined #RubyOnRails
[14:56:18] troys: has joined #RubyOnRails
[14:56:24] dblessing: has joined #RubyOnRails
[14:56:39] dviola: has joined #RubyOnRails
[14:57:11] chkhanch: has joined #RubyOnRails
[15:03:56] Terens: has joined #RubyOnRails
[15:09:04] chouhoulis: has joined #RubyOnRails
[15:13:34] samosaphile: has joined #RubyOnRails
[15:20:36] akaiiro: has joined #RubyOnRails
[15:29:04] samosaphile: https://pine.fm/LearnToProgram/chap_06.html - "...Change your previous program so that you have to shout BYE three times in a row. Make sure to test your program: if you shout BYE three times, but not in a row, you should still be talking..." <- how does one do this?
[15:34:35] eckhardt_: has joined #RubyOnRails
[15:40:01] cagomez: has joined #RubyOnRails
[15:53:13] fragamus: has joined #RubyOnRails
[15:54:14] mikecmpbll: has joined #RubyOnRails
[15:55:44] optikalmouse: has joined #RubyOnRails
[16:03:02] benlieb: has joined #RubyOnRails
[16:03:58] jmay: has joined #RubyOnRails
[16:05:26] tomoyuki28jp: has joined #RubyOnRails
[16:07:50] tomoyuki28jp: How can I validate integer value to ensure the value does not contain decimal point?
[16:11:45] tomoyuki28jp: Ah, decimal value is automatically converted to integer.
[16:12:14] optikalmouse: tomoyuki28jp: you may want to use .to_i or .round or .floor to ensure you're getting the value you want
[16:13:22] tomoyuki28jp: optikalmouse: thanks. I just want to make sure that we can show errors if user inputs unwanted value.
[16:14:05] nzst: I can't figure out why this is called a twiddle wakka, ~>
[16:14:07] jcarl43: has joined #RubyOnRails
[16:14:13] optikalmouse: tomoyuki28jp you should be able to do a begin/rescue in some way to do that, or if it's a string, you can add a custom validator
[16:14:27] tomoyuki28jp: optikalmouse: thanks!
[16:14:36] optikalmouse: tomoyuki28jp: actually, this should help you if you're using ActiveRecord Models: http://guides.rubyonrails.org/active_record_validations.html#numericality
[16:14:41] optikalmouse: validates :games_played, numericality: { only_integer: true }
[16:15:30] dionysus69: has joined #RubyOnRails
[16:24:26] tomoyuki28jp: optikalmouse: thanks a lot for your help
[16:25:00] tomoyuki28jp: optikalmouse: 1.1 is casted to 1. So all I want is `numericality: { greater_than_or_equal_to: 0 }`, I think.
[16:28:43] Pupeno: has joined #RubyOnRails
[16:29:14] Pupeno: How do you keep your development database credentials out of your database.yml (that is, out of the repo)?
[16:29:43] tomoyuki28jp: By using dotenv?
[16:30:32] chouhoulis: has joined #RubyOnRails
[16:30:48] Pupeno: This: https://github.com/motdotla/dotenv ?
[16:32:11] Pupeno: Ah... no, I take it it's this: https://github.com/bkeepers/dotenv
[16:35:37] sameerynho: has joined #RubyOnRails
[16:35:46] optikalmouse: tomoyuki28jp: most likely that should work
[17:01:15] jmaya: has joined #RubyOnRails
[17:04:29] chkhanch: I have a User model to which devise is connected. I want to add an enum role, but I get an error while migrating db:
[17:04:29] chkhanch: ArgumentError: You tried to define an enum named "role" on the model "User", but this will generate a class method "parent", which is already defined by Active Record.
[17:04:29] chkhanch: Why can it be?
[17:07:32] samosaphile: optikalmouse: any idea how to write (".".join(str(int(x, 16)) for x in (["".join(x) for x in zip(*[iter(UID)]*2)]))) or ('.'.join(str(int(i, 16)) for i in ([UID[i:i+2] for i in range(0, len(UID), 2)]))) (does same thing) in ruby? it's supposed to convert little endian hex string to IP
[17:07:47] lxsameer: has joined #RubyOnRails
[17:11:05] benlieb: has joined #RubyOnRails
[17:13:27] chkhanch: The problem was that there is a parent method that should have been generated by one of the enum role values
[17:15:46] psychoslave: has joined #RubyOnRails
[17:17:52] lxsameer: has joined #RubyOnRails
[17:21:19] havenwood: samosaphile: If you give us example input and desired output, I'm sure someone will give you a solution.
[17:21:34] havenwood: samosaphile: Might be a better question for #ruby channel.
[17:22:59] DrYockel: has joined #RubyOnRails
[17:26:10] samosaphile: example input: 55905E48 desired output: 85.144.94.72
[17:27:57] lxsameer: has joined #RubyOnRails
[17:28:07] akaiiro: has joined #RubyOnRails
[17:35:17] GodFather: has joined #RubyOnRails
[17:35:18] havenwood: (answered in #ruby)
[17:37:43] lxsameer: has joined #RubyOnRails
[17:38:05] samosaphile: thx, i see now
[17:41:42] dionysus69: has joined #RubyOnRails
[17:48:01] lxsameer: has joined #RubyOnRails
[17:51:02] GodFather_: has joined #RubyOnRails
[17:56:14] dionysus69: has joined #RubyOnRails
[18:03:50] Aherin: has joined #RubyOnRails
[18:12:57] benlieb: has joined #RubyOnRails
[18:17:33] psychoslave_: has joined #RubyOnRails
[18:22:39] bradleyprice: has joined #RubyOnRails
[18:23:17] benlieb: has joined #RubyOnRails
[18:24:57] johndunn: has joined #RubyOnRails
[18:41:12] bradleyp_: has joined #RubyOnRails
[18:47:11] bradleyprice: has joined #RubyOnRails
[18:53:52] jmay: has joined #RubyOnRails
[18:56:18] mikecmpbll: has joined #RubyOnRails
[18:58:27] vedu_: has joined #RubyOnRails
[19:32:28] za1b1tsu: has joined #RubyOnRails
[19:39:01] hfp_work: has joined #RubyOnRails
[19:43:08] jmay: has joined #RubyOnRails
[19:43:46] blackmesa: has joined #RubyOnRails
[19:54:15] mtkd: has joined #RubyOnRails
[19:54:45] blackmesa1: has joined #RubyOnRails
[19:54:54] fox_mulder_cp: has joined #RubyOnRails
[19:58:04] dblessing: has joined #RubyOnRails
[19:58:30] jliberman: has joined #RubyOnRails
[20:02:44] tdy: has joined #RubyOnRails
[20:05:10] blackmesa1: has joined #RubyOnRails
[20:12:51] ur5us: has joined #RubyOnRails
[20:13:37] jmay: has joined #RubyOnRails
[20:19:26] ^mtkd: has joined #RubyOnRails
[20:20:02] hfp_work: has joined #RubyOnRails
[20:27:17] fragamus: has joined #RubyOnRails
[20:30:08] za1b1tsu: has joined #RubyOnRails
[20:33:48] Technodrome: has joined #RubyOnRails
[20:37:52] sirensari2: has joined #RubyOnRails
[20:39:26] jmay: has joined #RubyOnRails
[21:24:35] blackmesa1: has joined #RubyOnRails
[21:37:59] hfp_work: has joined #RubyOnRails
[21:44:48] hfp_work: has joined #RubyOnRails
[21:49:48] jmay: has joined #RubyOnRails
[21:50:31] ur5us: has joined #RubyOnRails
[21:56:26] Technodrome: has joined #RubyOnRails
[22:01:21] hfp_work: has joined #RubyOnRails
[22:10:49] psychoslave_: has joined #RubyOnRails
[22:13:46] ur5us: has joined #RubyOnRails
[22:19:40] ephemer0l: has joined #RubyOnRails
[22:24:14] SteenJobs: has joined #RubyOnRails
[22:24:44] benlieb: has joined #RubyOnRails
[22:26:43] tdy: has joined #RubyOnRails
[22:33:26] Technodrome: has joined #RubyOnRails
[22:42:59] sameerynho: has joined #RubyOnRails
[22:44:43] akaiiro: has joined #RubyOnRails
[23:02:24] johndunn: has left #RubyOnRails: ()
[23:10:25] ellcs: has joined #RubyOnRails
[23:11:34] RougeR: has joined #RubyOnRails
[23:11:53] benlieb: has joined #RubyOnRails
[23:31:57] Technodrome: has joined #RubyOnRails