« Back to channel list

#RubyOnRails - 13 October 2017

« Back 1 day Forward 1 day »
[00:03:15] jphase: has joined #RubyOnRails
[00:14:16] cagomez: has joined #RubyOnRails
[00:20:24] orbyt_: has joined #RubyOnRails
[00:22:17] cagomez: has joined #RubyOnRails
[00:30:55] cagomez: has joined #RubyOnRails
[00:34:56] duderonomy: has joined #RubyOnRails
[00:35:33] kuwze: I am trying to use this https://github.com/twbs/bootstrap-rubygem but I don't know how to include bootstrap.min.js
[00:35:37] quirkycoders: has joined #RubyOnRails
[00:38:39] sevenseacat: has joined #RubyOnRails
[00:39:57] bronson: has joined #RubyOnRails
[01:11:41] quirkycoders: has joined #RubyOnRails
[01:12:54] Ropeney: kuwze, you wouldn't
[01:13:45] Ropeney: in application.js, you do the 3 requires it has "jquery3", "popper", "bootstrap". It's about halfway down the page.
[01:13:48] juggler: has joined #RubyOnRails
[01:13:51] Jameser: has joined #RubyOnRails
[01:15:52] gusrub: has joined #RubyOnRails
[01:31:59] kuwze: Ropeney: thank you!
[01:47:39] quirkycoders: has joined #RubyOnRails
[02:10:19] kapil___: has joined #RubyOnRails
[02:34:52] irishfromua: has joined #RubyOnRails
[02:40:54] bronson: has joined #RubyOnRails
[02:41:28] orbyt_: has joined #RubyOnRails
[02:47:12] Technodrome: has joined #RubyOnRails
[02:51:03] Saukk: has joined #RubyOnRails
[02:55:11] ahrs: has joined #RubyOnRails
[03:11:23] [SpLaT]: has joined #RubyOnRails
[03:57:34] acmeraptor: has joined #RubyOnRails
[04:02:57] Technodrome: has joined #RubyOnRails
[04:04:26] acmeraptor: Hello, I've done a fresh install of RoR as a pre-requisite for some website software I want to experiment with. I followed this guide to setup ruby on rails : https://gorails.com/setup/ubuntu/14.04 , then this guide for the web application : https://github.com/etewiah/property_web_builder , it worked fine up until the rails pwb:db:seed command was run. I have a trace gist at https://gist.github.com/anonymous/e2cd4e
[04:15:38] xco: has joined #RubyOnRails
[04:17:27] xco: how do i test the count of objects returned from a controller? currenly i’m trying to do something like this https://gist.github.com/xcobar/0465513934db7ed0d046f249ce24525f#file-gistfile1-txt-L7 but i get undefined method `size' for #<ImageResponse:0x0055689059f9b8>
[04:18:22] fragamus: has joined #RubyOnRails
[04:23:47] uks: has joined #RubyOnRails
[04:25:14] srinidhi: has joined #RubyOnRails
[04:27:54] elomatreb: xco: That used to be done by testing if the correct view instance variables were assigned, but it got deprecated/removed in Rails 5. (assert_assigns)
[04:29:23] xco: elomatreb: you know how to test the count of objects from say @users = User.all for example?
[04:30:05] elomatreb: You could parse the rendered response I guess? There's a gem that adds the assign asserts back (rails-controller-testing)
[04:42:12] bronson: has joined #RubyOnRails
[05:17:47] elcontrastador: has joined #RubyOnRails
[05:22:10] LambdaSource: has joined #RubyOnRails
[05:23:29] matthewd: acmeraptor: If following the project's installation instructions gives you an error, that sounds like a bug in either the project or the instructions
[05:28:14] acmeraptor: matthewd: Yea it definitely looks like they overlooked a step in the instructions
[05:29:38] matthewd: My guess is they've made a code change that works in an already-deployed copy of the application, and not noticed that it breaks initial setup
[05:31:30] jphase: has joined #RubyOnRails
[05:32:15] acmeraptor: It's open source, but they are definitely pushing a hosted deployment option. It's just so pretty that I wanted to try it on a vm server.
[05:37:33] tpendragon: has joined #RubyOnRails
[05:42:59] bronson: has joined #RubyOnRails
[05:51:50] acmeraptor: Am I just doing it with the wrong user? Should these commands be run from some other interface? and run the ff commands from the console:
[05:51:57] acmeraptor: er "and run the ff commands from the console:"
[05:53:11] acmeraptor: I assumed it was talking about from their deployment console and could be run the same way from my own server on the command line
[05:58:45] kies: has joined #RubyOnRails
[06:04:56] snickers: has joined #RubyOnRails
[06:18:32] ur5us: has joined #RubyOnRails
[06:25:57] acmeraptor: has left #RubyOnRails: ()
[06:42:46] dionysus69: has joined #RubyOnRails
[06:45:42] conta: has joined #RubyOnRails
[06:54:43] blackcross: has joined #RubyOnRails
[06:58:49] srinidhi: has joined #RubyOnRails
[07:03:03] mjuhl: I have one controller, but I want to access it from two different routes. I have defined scope 'v0.1' and scope 'v0.2'. One of my methods in the controller rely on app_run_path, this path maps ONLY to 'v0.1' and no method is defined for 'v0.2'. How can I define one for v0.2?
[07:10:56] defsdoor: has joined #RubyOnRails
[07:23:02] rgr_: has joined #RubyOnRails
[07:34:08] jphase: has joined #RubyOnRails
[07:43:54] bronson: has joined #RubyOnRails
[07:51:01] hive-mind: has joined #RubyOnRails
[07:52:11] dionysus70: has joined #RubyOnRails
[07:57:34] marr: has joined #RubyOnRails
[08:06:21] rgr: has joined #RubyOnRails
[08:08:07] dionysus69: has joined #RubyOnRails
[08:22:13] srinidhi: has joined #RubyOnRails
[08:34:10] blackmesa1: has joined #RubyOnRails
[08:37:43] cabotto: has joined #RubyOnRails
[08:40:34] lxsameer: has joined #RubyOnRails
[08:46:40] op84: has joined #RubyOnRails
[08:47:27] op84: hey there - i was wondering why i do get a empty page with a link inside when i’m using redirect_to root_path, status: :permanently_moved ?
[08:57:56] Technodrome: has joined #RubyOnRails
[09:05:35] op84: ah solved - its called moved_permanently ;)
[09:10:28] workmad3: has joined #RubyOnRails
[09:20:41] kapil___: has joined #RubyOnRails
[09:36:23] jphase: has joined #RubyOnRails
[09:40:36] conta: hey folks
[09:43:18] conta: so when I have `customer` to `accepts_nested_attributes_for :customer_identities` I can't use `Customer.create(cutsomer_params)`? customer params also have customer_identities_attributes. I am getting customer_identities.customer_id is missing error
[09:43:42] conta: should I first create Customer and then CustomerIdentity?
[09:44:48] bronson: has joined #RubyOnRails
[09:48:31] conta: Ah, fixed it. Removed validation on CustomerIdentity for customer_id
[09:53:12] FernandoBasso: has joined #RubyOnRails
[09:58:32] tbuehlmann: conta: you should be able to keep the validation and instead just add the inverse_of option to (one or both sides of the) the association
[09:59:33] rgr_: has joined #RubyOnRails
[10:01:39] mynameisdebian: has joined #RubyOnRails
[10:01:40] srinidhi: has joined #RubyOnRails
[10:02:21] mynameisdebian: Is there a way to create a Rails DB as an ERD diagram and then export it to Rails?
[10:02:31] mynameisdebian: I mean, "as an ER diagram"
[10:05:47] sevenseacat: mynameisdebian: you want rails-erd or railroady
[10:06:25] conta: tbuehlmann: I'll try
[10:06:27] mynameisdebian: sevenseacat: rails-erd does the opposite of what I'm trying to do (it takes an existing DB and generates an ER diagram from the DB)
[10:06:47] sevenseacat: ohhh right. yeah, no tools to go the other way
[10:06:49] tbuehlmann: mynameisdebian: I don't know of any lib that does what you want
[10:14:09] hfp_work: has joined #RubyOnRails
[10:16:44] dionysus69: has joined #RubyOnRails
[10:18:23] paranoicsan: has joined #RubyOnRails
[11:01:55] Tempesta: has joined #RubyOnRails
[11:30:18] Ergo: has joined #RubyOnRails
[11:33:05] jphase: has joined #RubyOnRails
[11:34:08] srinidhi: has joined #RubyOnRails
[11:36:45] tcopeland: has joined #RubyOnRails
[11:44:39] hammer065: has joined #RubyOnRails
[11:45:58] Jameser: has joined #RubyOnRails
[11:46:30] bronson: has joined #RubyOnRails
[11:59:28] Tempesta: has joined #RubyOnRails
[12:04:21] brendan-: has joined #RubyOnRails
[12:19:06] jphase: has joined #RubyOnRails
[12:22:51] ShalokShalom_: has joined #RubyOnRails
[12:25:35] ayonkhan: has joined #RubyOnRails
[12:41:58] ayonkhan: has joined #RubyOnRails
[12:44:49] apparition: has joined #RubyOnRails
[12:52:30] keegnotrub_: has joined #RubyOnRails
[12:55:09] tlaxkit: has joined #RubyOnRails
[12:56:48] mostlybadfly: has joined #RubyOnRails
[13:00:47] rfoust: has joined #RubyOnRails
[13:04:10] truenito: has joined #RubyOnRails
[13:09:58] bratsche: has joined #RubyOnRails
[13:15:30] fmcgeough: has joined #RubyOnRails
[13:19:14] chouhoulis: has joined #RubyOnRails
[13:47:35] bronson: has joined #RubyOnRails
[13:48:26] chouhoulis: has joined #RubyOnRails
[13:51:17] rgr: has joined #RubyOnRails
[13:55:10] dblessing: has joined #RubyOnRails
[13:56:51] quirkycoders: has joined #RubyOnRails
[14:01:59] ShalokShalom_: has joined #RubyOnRails
[14:02:53] quirkycoders: has joined #RubyOnRails
[14:10:10] DrYockel: has joined #RubyOnRails
[14:15:32] ayonkhan: has joined #RubyOnRails
[14:17:43] xco: has joined #RubyOnRails
[14:23:07] Skull0Inc: has joined #RubyOnRails
[14:26:24] Skull0Inc: Hey All. I'm creating a multi-role based user model and have seen mentioned somewhere the use of storing enums into the DB as integers to represent each role. Just wondering, what might be the 'preferred' way of doing such a thing and is it worth storing multiple roles as a single enum rather than a string type? Any design advice?
[14:28:02] Skull0Inc: Its pretty open ended question, but just looking for way how things may be generally done. Any advice is appreciated.
[14:36:41] tcopeland: I usually do it with users <=> role_assignments <=> roles
[14:37:38] tcopeland: a little more machinery, but it helps if someone asks “hey when did Fred get the senior_salesmanager role” or whatever
[14:42:23] Skull0Inc: tcopeland: Seems cool. And do you store the role name as a string value?
[14:42:58] tcopeland: so roles is just (id, timestamps, name)
[14:43:21] tcopeland: and role_assignments can have assigner_id for tracking purposes
[14:45:38] Skull0Inc: Ok, thats the main thing. I did the role_assignments through account. But in my case: company --> accounts, user --> accounts, roles --> accounts
[14:45:54] quirkycoders: has joined #RubyOnRails
[14:46:03] Skull0Inc: so Accounts would have (company_id, user_id, role_id)
[14:47:05] Skull0Inc: The tricky part is that, I need to be able to set our company as super-admin and allow all records, while the other company can have admin access and only be admin of their records.
[14:47:27] Skull0Inc: -allow all records- = edit all*
[14:48:28] Skull0Inc: tcopeland: have you ever used enum role based storage?
[14:49:39] tcopeland: I’ve done it using a bitmask for the roles, yup
[14:50:33] brendan-: has joined #RubyOnRails
[14:50:56] Skull0Inc: tcopeland: is there significantly more setup for that and if so, is it worth it over just using a string based value?
[14:52:54] Skull0Inc: not sure what bitmasking is, so will first look into that.
[14:53:00] tcopeland: to me it just seems a little more opaque to use bitmasks there - in situations like this where there is only going to be a small-ish amount of data, I try to make the data representation as obvious as possible
[14:53:54] tcopeland: oh for bitmasks, I mean something like https://coderwall.com/p/hpkbra/using-bitmasks-to-store-settings
[14:56:12] quirkycoders: has joined #RubyOnRails
[14:57:32] mustmodify: has joined #RubyOnRails
[14:57:43] LambdaSource: has joined #RubyOnRails
[14:59:36] conta2: has joined #RubyOnRails
[15:01:28] mustmodify: a User can have a profile... and let's say it's polymorphic so that user can be a Customer, Technician, Client, etc. Users don't always have profiles. Users have email addresses because password resets. A Customer may or may not have a User... they may or may not be allowed to log in, or set up for that. But Customers have email addresses.
[15:02:06] mustmodify: If a customer does have an email address AND does have a user, and I change one email address, then they are out of sync.
[15:02:31] Skull0Inc: tcopeland: Haven't seen that before. That's quite clever.
[15:03:13] orbyt_: has joined #RubyOnRails
[15:03:36] tcopeland: yeah definitely tightens things up a bit
[15:04:06] mustmodify: Should I (a) create a mechanism in the controller to keep them in sync, (b) create a callback to keep them in sync (I have sworn off multi-model callbacks... ) (c) automatically create inactive users when a customer is created and only store email address in the user (d) create an 'emails' table and have both link to it via foreign key or (e) some other option I hadn't thunk up.
[15:07:41] troys: has joined #RubyOnRails
[15:11:23] DTZUZO: has joined #RubyOnRails
[15:19:30] rfoust: has joined #RubyOnRails
[15:22:39] Tempesta: has joined #RubyOnRails
[15:23:23] ayonkhan: has joined #RubyOnRails
[15:25:24] mtkd: has joined #RubyOnRails
[15:30:05] orbyt_: has joined #RubyOnRails
[15:31:21] Skull0Inc: tcopeland: This is how I meant using the Enum. Haven't seen the Bitmask before but seems just as cool. http://vaidehijoshi.github.io/blog/2015/02/03/when-enough-is-enough-how-to-know-when-to-use-enums/
[15:31:58] nogic: has joined #RubyOnRails
[15:36:01] cagomez: has joined #RubyOnRails
[15:36:02] tcopeland: cool, that does seem less opaque than bitfields
[15:38:32] chouhoulis: has joined #RubyOnRails
[15:40:18] Skull0Inc: tcopeland: yea, would have to explore both to really see the differences.
[15:42:34] kuwze: has joined #RubyOnRails
[15:46:17] jphase: has joined #RubyOnRails
[15:47:23] FernandoBasso: has joined #RubyOnRails
[15:48:30] bronson: has joined #RubyOnRails
[15:48:36] slothbear: has joined #RubyOnRails
[15:50:20] _ritchie_: has joined #RubyOnRails
[15:52:05] Technodrome: has joined #RubyOnRails
[15:54:05] kuwze: what's the difference between running 'bundle' vs 'bundle install'?
[16:03:01] marr: has joined #RubyOnRails
[16:05:30] Gizmokid2005: has joined #RubyOnRails
[16:06:27] mcr1: has joined #RubyOnRails
[16:09:35] orbyt_: has joined #RubyOnRails
[16:17:39] EXCHGR: kuwze: nothing
[16:20:47] benjaminwil: has joined #RubyOnRails
[16:21:49] kuwze: exchgr: there seems to be a difference for me. Bundle ran instantly, bundle install actually seemed like it was installing stuff.
[16:22:05] EXCHGR: which one did you run first?
[16:22:39] _ritchie_: has joined #RubyOnRails
[16:24:10] nickjj: Skull0inc, if you do use enums saved as integers you'll probably want to map them as a hash instead of an array
[16:24:47] nickjj: this way you're free to re-order them as you please
[16:24:57] nickjj: and even add/remove new ones without affecting the previous values
[16:26:53] havenwood: kuwze: it's an alias
[16:30:57] havenwood: also, the bundler /exe convention is like toothpicks stabbing my eyes
[16:31:38] havenwood: i with they'd accepted the rubygems /bin convention
[16:32:13] havenwood: this idea that you put "./bin" in your PATH is hogwash
[16:42:37] Skull0Inc: nickjj: for sure! dont want to have everything break because I or someone inserted record at beginning. Thanks for pointer
[16:44:11] LambdaSource: has joined #RubyOnRails
[16:44:28] nickjj: Skull0inc, exactly, so something like enum roles: { member: 0, admin: 1 } , would work a lot better than enum roles: [:member, :admin]
[16:45:50] Skull0Inc: would be like: class User < ActiveRecord::Base
[16:45:50] Skull0Inc: enum role: { superadmin:0,admin:1, accountant:2, analyst:3}
[16:45:55] ShalokShalom: has joined #RubyOnRails
[16:46:42] nickjj: yeah, then at the db level you can have it default to 2 or 3, whatever makes sense for your app
[16:46:45] havenwood: >> %i[admin accountant superadmin].each_with_index.to_h
[16:48:53] nickjj: havenwood, the problem with that is if you remove accountant then superadmin becomes 1
[16:48:58] rgr: has joined #RubyOnRails
[16:49:09] Skull0Inc: its better to be more explicit in this case.
[16:49:22] nickjj: but if you hardcode the key/value then superadmin will always be a 2, even if you remove accountant
[16:49:38] havenwood: nickjj: yeah, i suppose it's a hard map - also me changing the order is highly suspect ;-P
[16:52:34] Sylario: I have a NamespaceOne::Foo with a foreign key to NamespaceTwo::Bar . should I name it namespace_two_bar_id or bar_id according to rails conventions?
[16:54:21] nickjj: what's cool is you could even save them as an array of ints instead of an int, and now suddenly it supports multiple roles or whatever
[16:57:13] dblessing: has joined #RubyOnRails
[16:57:56] one_zero: has joined #RubyOnRails
[17:00:40] rgr: has joined #RubyOnRails
[17:02:07] moei: has joined #RubyOnRails
[17:03:28] ResidentBiscuit: has joined #RubyOnRails
[17:07:51] gusrub: has joined #RubyOnRails
[17:11:10] orbyt_: has joined #RubyOnRails
[17:11:58] chouhoulis: has joined #RubyOnRails
[17:22:46] hahuang65: has joined #RubyOnRails
[17:32:51] Skull0Inc: has joined #RubyOnRails
[17:34:51] lacour: has joined #RubyOnRails
[17:45:47] srkska: has joined #RubyOnRails
[17:49:47] bronson: has joined #RubyOnRails
[17:58:02] orbyt_: has joined #RubyOnRails
[18:03:45] xcesariox: has joined #RubyOnRails
[18:16:39] mcr1: has joined #RubyOnRails
[18:42:10] daveomcd: can i update a instance variable on my page using Action Cable from Active Job?
[18:42:51] mustmodify: has left #RubyOnRails: ()
[18:48:20] LambdaSource: has joined #RubyOnRails
[18:52:49] LambdaSource: has joined #RubyOnRails
[18:54:19] NoGodDamnIdea: has joined #RubyOnRails
[19:00:48] orbyt_: has joined #RubyOnRails
[19:03:07] atrius: has joined #RubyOnRails
[19:07:17] kristofferR: has joined #RubyOnRails
[19:07:36] LambdaSource: has joined #RubyOnRails
[19:07:53] arup_r: has joined #RubyOnRails
[19:08:36] arup_r: I did `rails g model Media` and created model name as 'Medium'. I would like to keep it as `Media`. What inflector rule I should write for this?
[19:11:37] Skull0Inc: has joined #RubyOnRails
[19:13:33] arup_r: figured it
[19:13:55] LambdaSource: has joined #RubyOnRails
[19:14:39] LambdaSource: has joined #RubyOnRails
[19:14:52] chouhoulis: has joined #RubyOnRails
[19:21:18] LambdaSource: has joined #RubyOnRails
[19:21:55] LambdaSource: has joined #RubyOnRails
[19:28:25] LambdaSource: has joined #RubyOnRails
[19:35:21] LambdaSource: has joined #RubyOnRails
[19:36:55] jphase: has joined #RubyOnRails
[19:41:37] LambdaSource: has joined #RubyOnRails
[19:50:30] bronson: has joined #RubyOnRails
[19:51:08] kuwze: has left #RubyOnRails: ()
[19:51:25] duderonomy: has joined #RubyOnRails
[19:51:59] srinidhi: has joined #RubyOnRails
[20:26:35] orbyt_: has joined #RubyOnRails
[20:32:45] Skull0Inc: Hey all. Whats the consensus of generating a kind of superadmin status so that Company A has the ability to set superadmin and manage other models of company B,C,D..
[20:34:49] Skull0Inc: but all other companies have only up to admin status. I'm trying to decide whether to just limit other company submission to admin level, by just excluding superadmin from the selection and only enabling it when from company A OR possibly adding a /admin/ path to rails through one of gems such as rails_admin, but would rather not add another gem if possible...what might be a good way to do this?
[20:35:16] ResidentBiscuit: has joined #RubyOnRails
[20:37:28] kr1shnak: has joined #RubyOnRails
[20:43:26] hahuang65: has joined #RubyOnRails
[20:45:53] Guest97372: has joined #RubyOnRails
[20:51:10] Technodrome: has joined #RubyOnRails
[20:51:26] bronson: has joined #RubyOnRails
[20:51:43] ur5us: has joined #RubyOnRails
[20:54:18] kr1shnak: has left #RubyOnRails: ("bye bye")
[20:54:30] ^mtkd: has joined #RubyOnRails
[20:57:06] jobewan: has joined #RubyOnRails
[21:06:31] jphase: has joined #RubyOnRails
[21:19:14] jphase: has joined #RubyOnRails
[21:20:57] srkska: has joined #RubyOnRails
[21:49:19] gusrub: has joined #RubyOnRails
[21:52:31] bronson: has joined #RubyOnRails
[22:09:06] rfoust: has joined #RubyOnRails
[22:11:54] rgr: has joined #RubyOnRails
[22:18:18] orbyt_: has joined #RubyOnRails
[22:19:49] irishfromua: has joined #RubyOnRails
[22:37:51] workmad3: has joined #RubyOnRails
[22:51:07] dionysus69: has joined #RubyOnRails
[22:53:20] bronson: has joined #RubyOnRails
[22:53:26] ur5us: has joined #RubyOnRails
[22:54:41] tcopeland: has joined #RubyOnRails
[22:57:11] hahuang65: has joined #RubyOnRails
[22:59:40] orbyt_: has joined #RubyOnRails
[23:08:40] Technodrome: has joined #RubyOnRails
[23:42:45] kn-928: has joined #RubyOnRails
[23:54:10] bronson: has joined #RubyOnRails