« Back to channel list

#RubyOnRails - 31 May 2019

« Back 1 day Forward 1 day »
[00:09:46] lankanmon: has joined #RubyOnRails
[00:10:36] skryking: has joined #RubyOnRails
[00:31:40] orbyt_: has joined #RubyOnRails
[00:50:05] sevenseacat: has joined #RubyOnRails
[01:01:33] bambanx: has joined #RubyOnRails
[01:06:21] brandoncc: has joined #RubyOnRails
[01:12:36] octos: has joined #RubyOnRails
[01:13:12] beholders_eye: has joined #RubyOnRails
[01:26:01] ariedler: has joined #RubyOnRails
[01:36:19] orbyt_: has joined #RubyOnRails
[01:47:46] choke: has joined #RubyOnRails
[02:18:41] srinidhi: has joined #RubyOnRails
[02:30:40] duderonomy: has joined #RubyOnRails
[02:59:03] xco: has joined #RubyOnRails
[03:11:24] braincrash: has joined #RubyOnRails
[03:37:00] xco: has joined #RubyOnRails
[04:02:44] srinidhi: has joined #RubyOnRails
[04:04:32] xco: has joined #RubyOnRails
[04:18:02] brandoncc: has joined #RubyOnRails
[04:20:08] MrCrackPotBuilde: has joined #RubyOnRails
[04:23:19] weteamsteve1: has joined #RubyOnRails
[04:38:22] haxx0r: has joined #RubyOnRails
[04:50:31] weteamsteve2: has joined #RubyOnRails
[04:54:22] weteamsteve: has joined #RubyOnRails
[05:00:29] srinidhi: has joined #RubyOnRails
[05:06:40] weteamsteve1: has joined #RubyOnRails
[05:07:19] srinidhi: has joined #RubyOnRails
[05:08:11] weteamsteve2: has joined #RubyOnRails
[05:36:00] sevenseacat: has joined #RubyOnRails
[05:44:13] duderonomy: has joined #RubyOnRails
[05:46:41] duderonomy: has joined #RubyOnRails
[05:52:28] defsdoor: has joined #RubyOnRails
[06:18:00] Ergo: has joined #RubyOnRails
[06:36:20] DoctorMonocular: has joined #RubyOnRails
[06:37:37] DoctorMonocular: I have an overbroad question -- I want to learn more about devops. I want to Do It Actually Right when it comes to deployment -- I can hack and slash my way through setting up a VPS and deploying a rails app, but I know that Doing It Right means not having to do that, but instead setting up some way of being automated
[06:38:21] DoctorMonocular: but it's daunting to get into. I know most of the alternatives, but I have no idea howto evaluate them or how to get something working that I
[06:38:27] DoctorMonocular: m confident I'm not fucking up
[06:38:48] DoctorMonocular: is there a good guide? I have CircleCI set up to build, and I want to get it to deploy to a staging VPS
[06:54:59] ZAJDAN: has joined #RubyOnRails
[06:55:43] ZAJDAN: I have problem attach to button_to html id: <%= button_to "SEARCH", {:controller => :commissions, :action => 'search', :id => 'search' } %>
[06:56:16] ZAJDAN: could anyone give me a hint?
[06:56:39] DoctorMonocular: what is the problem?
[06:57:23] ZAJDAN: when I use this declaration of id as above ....in HTML I do not see the ied
[06:58:09] ZAJDAN: I need on the input which is generated from the button_to....some the id, so that I could reach the element via js
[06:59:04] DoctorMonocular: I think you need to put the id declaration into html_options
[06:59:19] DoctorMonocular: I think what you're asking is howto make a button with the html id of 'search', right?
[07:00:27] ZAJDAN: ok ok...I found it: <%= button_to "SEARCH", {:controller => :commissions, :action => "search" }, {id: 'search'} %> ...this is correctly
[07:01:20] Dbugger: has joined #RubyOnRails
[07:02:34] jefffrails35: has joined #RubyOnRails
[07:08:48] defsdoor_: has joined #RubyOnRails
[07:12:32] schne1der: has joined #RubyOnRails
[07:28:20] Xogium: so how do I fix whatever is going on please ? I don't even understand… I'm a sysadmin not a programmer x)
[07:32:09] xco: General question: Are there any methods in Ruby that were “copied” from Rails? I’m very curious.
[07:32:49] sevenseacat: some stuff has probably been copied into core, yeah
[07:35:16] dionysus69: has joined #RubyOnRails
[07:35:39] conta: has joined #RubyOnRails
[07:35:53] xco: sevenseacat: i heard so some time ago, but haven’t really seen such methods. i’d like to see a list of those and if there isn’t any online make one
[07:56:04] sameerynho: has joined #RubyOnRails
[08:14:14] ZAJDAN: when I instal some gem...do I have to also do bundle install ?
[08:15:40] deepreds1: has joined #RubyOnRails
[08:55:48] blackmesa: has joined #RubyOnRails
[09:00:35] planigan: has joined #RubyOnRails
[09:21:04] mikecmpbll: has joined #RubyOnRails
[09:33:53] ZAJDAN: I installed jquery rails...where I should place my js record?
[09:42:12] NL3limin4t0r: xco: One I know of is #slice, made it from RoR to the Ruby core.
[09:42:57] xco: NL3limin4t0r: thanks :)
[09:44:14] NL3limin4t0r: Now I think about it, if I'm not mistaken #transform_keys and #transform_value for Hash are originally from RoR too.
[09:44:29] NL3limin4t0r: #transform_values*
[09:58:57] jarr0dsz: has joined #RubyOnRails
[09:59:22] jarr0dsz: hello everyone im struggling with a route that has 2 params, 1 conditional. a route that should work with the conditional param and without it.
[10:00:12] jarr0dsz: so i tried something like organisation_vogs GET /vogs(/:division_id(/:id))(.:format) but it does not work if i supply /organisation/division_id/id it works but not when i do /organisation/id it throws the id value in the division_id param
[10:00:42] jarr0dsz: how could i make it work so that if there is no division_id param the /organisation/id_here id_here part would become the param[:id]?
[10:00:51] Xogium: has left #RubyOnRails: ("leaving channel")
[10:03:16] jarr0dsz: organisation GET /(/:division_id)(/:id)(.:format) also gives same issue. /organisation/id throws the id value inside division_id param
[10:05:19] jarr0dsz: would it require 2 routes so that i first make a route that triggers /organisation/division_id and then a 2nd route to trigger the /organidation/division/id ? i cannot find any solution on how to remove the division_id else on /organisation/division_id/id
[10:07:49] ams__: has joined #RubyOnRails
[10:07:57] blackmesa: has joined #RubyOnRails
[10:09:24] NL3limin4t0r: jarr0dsz: Why are you adding brackets around all parameters? Normally routes are specified like so: `get 'some/static/path/:dynamic/:id(.:format)'` The brackets denote that `.:format` is optional.
[10:09:36] jarr0dsz: because its a conditional route NL3limin4t0r
[10:11:24] jarr0dsz: so this seems to work for a bit: https://gist.github.com/voordev/2c31f6748c0315c9103a18b1343bfecb
[10:11:56] jarr0dsz: the problem is that when i do /organisations/id with no division_id like /organisations/division_id/id the ID param is not set but instead division_id is set.
[10:12:28] jarr0dsz: so is there a way i can have route /organisation/id that puts the id into the params[:id] ?
[10:12:38] NL3limin4t0r: What is the condition? Normally you would use the `:constraints` option, to add a condition upon the incoming route.
[10:12:46] NL3limin4t0r: https://guides.rubyonrails.org/routing.html#segment-constraints
[10:13:09] jarr0dsz: NL3limin4t0r the condition is that i require 2 routes /org/division_id /org/id that both work at the same time
[10:13:29] jarr0dsz: sorry that is incorrect i ment /org/division_id/id and /org/id
[10:15:05] NL3limin4t0r: The reason it's set as `params[:division_id]` is because `get '/organisations(/:division_id)'` is the first route that hits if you only pass 1 id.
[10:15:48] NL3limin4t0r: Routes are specified from top to bottom, the first route that matches the incomming request path is used.
[10:15:51] jarr0dsz: yes im really confused, how i can have both?
[10:16:39] jarr0dsz: ok so you suggest i change the routes reverse them
[10:17:56] NL3limin4t0r: Ask yourself this. If I where to send a request to `/organisations/1` how would you know if my intention is to use 1 as :devision_id or as :id?
[10:19:04] NL3limin4t0r: I would not hardcode the path, but use dynamic parameters. Simply send a request to `/organisiations?division_id=1`
[10:19:29] NL3limin4t0r: This way a simple `/organisations` route is all you need.
[10:21:02] NL3limin4t0r: This can be done in the controller/view by using for example the `organisations_path(division_id: 1)` helper.
[10:22:52] NL3limin4t0r: Assuming you've the route `resources :organisations, only: :index` or `get '/organisations', to: 'organisations#index'`.
[10:33:09] deathwishdave: has joined #RubyOnRails
[10:36:02] gregf_: has joined #RubyOnRails
[10:51:43] ur5us: has joined #RubyOnRails
[10:53:58] ur5us: has joined #RubyOnRails
[10:54:51] ur5us: has joined #RubyOnRails
[10:55:44] ur5us: has joined #RubyOnRails
[10:56:18] Croata: has joined #RubyOnRails
[10:59:36] jasmin: has joined #RubyOnRails
[10:59:44] lankanmon: has joined #RubyOnRails
[11:01:56] jasmin: I can't install pg gem with bundle install,
[11:01:56] jasmin: I got this message : "RuntimeError: The compiler failed to generate an executable file.
[11:01:56] jasmin: You have to install development tools first."
[11:09:29] ur5us: has joined #RubyOnRails
[11:15:34] jarr0dsz: thank you NL3limin4t0r i fixed it
[11:15:56] jarr0dsz: would there also be a way to set a default action for a resource? for example i want /organisation/profile#edit to be accessible true /organisation/profile instead?
[11:16:36] jarr0dsz: that must be /organisation/profile/edit should work as /organisation/profile and it would render edit action by default.
[11:19:55] ur5us: has joined #RubyOnRails
[11:24:24] ur5us: has joined #RubyOnRails
[11:34:03] ur5us: has joined #RubyOnRails
[11:40:37] ur5us: has joined #RubyOnRails
[11:41:21] ur5us: has joined #RubyOnRails
[11:42:36] NL3limin4t0r: jarr0dsz: You can assign any route to any action. `get '/organisation/profile', to: 'profiles#edit', as: 'edit_profile'` should do the job.
[11:42:59] jarr0dsz: ok thank you NL3limin4t0r
[11:43:07] NL3limin4t0r: Keep in mind that nested resources should be kept to a minimum. Shallow nesting is prefered.
[11:43:11] jarr0dsz: any thoughts on when rails 6 will be out? im most interested in multiple db support
[11:43:27] NL3limin4t0r: https://guides.rubyonrails.org/routing.html#shallow-nesting
[11:45:03] NL3limin4t0r: I haven't informed myself about Rails 6 yet. So I can't comment on that.
[11:46:06] ur5us: has joined #RubyOnRails
[11:46:51] ur5us: has joined #RubyOnRails
[11:50:44] conta: has joined #RubyOnRails
[11:51:46] ur5us: has joined #RubyOnRails
[11:52:08] bijan_: has joined #RubyOnRails
[11:56:00] ur5us: has joined #RubyOnRails
[11:56:34] ur5us: has joined #RubyOnRails
[11:57:17] ur5us: has joined #RubyOnRails
[12:07:28] ur5us: has joined #RubyOnRails
[12:10:12] ur5us: has joined #RubyOnRails
[12:10:27] Sylario: has joined #RubyOnRails
[12:10:33] ur5us: has joined #RubyOnRails
[12:11:23] ur5us: has joined #RubyOnRails
[12:11:41] blackmesa: has joined #RubyOnRails
[12:14:23] ZAJDAN: I would like to search just string in concrete column in table via active record
[12:15:24] ZAJDAN: @commission = Commission.where("commission_num = params[:commission][:commission_num]") ...but can not find the right syntax
[12:16:49] Guest60: has joined #RubyOnRails
[12:17:34] Guest60: hi folks! any ideas where ActiveRecord instance attribute can be reset to a some arbitrary value?
[12:18:10] Guest60: has left #RubyOnRails: ()
[12:18:13] Guest60: has joined #RubyOnRails
[12:21:42] bijan_: has joined #RubyOnRails
[12:21:43] ur5us: has joined #RubyOnRails
[12:21:45] ZAJDAN: Guest: I would like to help, but Iam novice with RoR
[12:23:26] KevinSjoberg_: has joined #RubyOnRails
[12:25:35] mclee: has joined #RubyOnRails
[12:25:44] arooni: has joined #RubyOnRails
[12:26:18] bijan_: has joined #RubyOnRails
[12:26:22] russt: has joined #RubyOnRails
[12:27:08] raz: has joined #RubyOnRails
[12:27:22] lato: has joined #RubyOnRails
[12:27:55] jtperreault: has joined #RubyOnRails
[12:29:24] jhill: has joined #RubyOnRails
[12:30:56] bijan_: has joined #RubyOnRails
[12:31:32] miah: has joined #RubyOnRails
[12:31:40] NL3limin4t0r: ZAJDAN: `@commission = Commission.where(commission_num: params[:commission][:commission_num])` might be what you're looking for.
[12:34:44] NL3limin4t0r: ZAJDAN: https://guides.rubyonrails.org/active_record_querying.html
[12:34:53] bijan__: has joined #RubyOnRails
[12:36:56] haxx0r: has joined #RubyOnRails
[12:38:52] bijan_: has joined #RubyOnRails
[12:40:44] bijan_: has joined #RubyOnRails
[12:40:57] beholders_eye: has joined #RubyOnRails
[12:45:34] srinidhi: has joined #RubyOnRails
[12:59:48] deathwishdave: has joined #RubyOnRails
[13:02:05] defsdoor_: has joined #RubyOnRails
[13:03:06] s00pcan: has joined #RubyOnRails
[13:04:22] ZAJDAN: NL3.....this works: @commission = Commission.where(:commission_num => params[:commission][:commission_num]).first
[13:31:13] octos: has joined #RubyOnRails
[13:51:06] xco: in a Rails , how can i return the attributes and values of an active record model for value that a not empty? example of what i’m trying to achive here https://gist.github.com/xcobar/6195a9596f00d17d35b7e1b966802e9f
[14:06:30] havenwood: xco: record.serializable_hash.compact
[14:07:05] havenwood: xco: or: record.attributes.compact
[14:15:24] lankanmon: has joined #RubyOnRails
[14:19:33] brandoncc: has joined #RubyOnRails
[14:20:03] brandoncc: has joined #RubyOnRails
[14:39:37] FrankDW2: has joined #RubyOnRails
[14:49:59] MrCrackPotBuilde: has joined #RubyOnRails
[15:36:07] ZAJDAN: how to make comment in *.html.erb ?
[15:39:26] haxx0r: <%-# this is a comment %>
[15:39:30] haxx0r: or in haml
[15:39:33] haxx0r: -# this is a comment
[15:42:20] bijan_: has joined #RubyOnRails
[15:44:19] ZAJDAN: when I create new view something.html.erb ....do I have to somehow inicialize?
[15:52:16] haxx0r: but i recommend to use haml or slim anyways, rather than html.erb
[15:52:39] bijan_: has joined #RubyOnRails
[15:52:40] haxx0r: all you need do ist `def method` in your controller and have it `method.html.erb` in your view
[15:52:43] haxx0r: that's all
[15:53:57] xco: havenwood: record.serializable_hash.compact and record.attributes.compact remove attributes that are “nil”, returns values with empty strings too
[15:54:33] choke: has joined #RubyOnRails
[15:55:05] ZAJDAN: haxx0r ...thnx
[15:56:17] mikecmpbll: has joined #RubyOnRails
[15:56:29] bijan__: has joined #RubyOnRails
[16:00:19] bijan_: has joined #RubyOnRails
[16:00:58] tdy: has joined #RubyOnRails
[16:01:12] weteamsteve: has joined #RubyOnRails
[16:04:40] bijan__: has joined #RubyOnRails
[16:09:33] bijan_: has joined #RubyOnRails
[16:13:33] bijan__: has joined #RubyOnRails
[16:17:06] ZAJDAN: I have a button on which via jQuery I do on click :$("#prod-manage").attr('action', '/commissions/search');
[16:17:41] ZAJDAN: first click switch it to right method, but next click to another one
[16:18:02] bijan_: has joined #RubyOnRails
[16:18:37] ZAJDAN: I think that each click should switch it to same method
[16:19:03] weteamsteve1: has joined #RubyOnRails
[16:21:55] weteamsteve2: has joined #RubyOnRails
[16:22:40] bijan__: has joined #RubyOnRails
[16:26:24] bijan_: has joined #RubyOnRails
[16:30:35] bijan__: has joined #RubyOnRails
[16:32:40] havenwood: record.attributes.compact.reject { |attribute| attribute.respond_to?(:empty?) && attribute.empty? }
[16:33:27] xco: oh nice
[16:33:31] xco: did is what i did
[16:33:37] xco: record.attributes.select {|k, v| v.present? }
[16:34:26] bijan_: has joined #RubyOnRails
[16:37:13] brandoncc: has joined #RubyOnRails
[16:38:34] bijan_: has joined #RubyOnRails
[16:39:16] weteamsteve: has joined #RubyOnRails
[16:40:12] bijan_: has joined #RubyOnRails
[16:44:47] bijan_: has joined #RubyOnRails
[16:45:01] weteamsteve1: has joined #RubyOnRails
[16:48:42] bijan_: has joined #RubyOnRails
[16:51:06] weteamsteve: has joined #RubyOnRails
[16:52:40] bijan__: has joined #RubyOnRails
[16:56:46] bijan_: has joined #RubyOnRails
[16:59:56] havenwood: xco: ah, good Rails trick!
[17:00:44] bijan_: has joined #RubyOnRails
[17:00:46] havenwood: xco: also, I forgot to destructure - good catch
[17:01:14] Iarfen: has joined #RubyOnRails
[17:01:25] havenwood: Iarfen: halloooo
[17:01:31] benlieb: has joined #RubyOnRails
[17:01:57] Iarfen: inside Ruby on Rails which is the way that validation works? I'm trying to correct a bug which sends an error that says that the email is empty although it's not. I think it's related to the way the validation is being used
[17:04:19] havenwood: Iarfen: There's an ActiveRecord::Validations which includes most if its validations from ActiveModel::Validations. You can look at those for the implementation.
[17:04:33] havenwood: Iarfen: What's the validation that not working? How's it not working? Show the code?
[17:04:54] bijan_: has joined #RubyOnRails
[17:09:20] haxx0r: is it possible to run a transaction on the parent together with the child while the child is created?
[17:09:29] bijan_: has joined #RubyOnRails
[17:09:31] haxx0r: deduct from parent balance, if child is created?
[17:10:53] haxx0r: Uploaded file: https://uploads.kiwiirc.com/files/c83aa581babe13601cfe40927d9384f6/pasted.txt
[17:11:10] haxx0r: i wonder if we can have this logic in the Bet model with inside a transaction
[17:13:03] duderonomy: has joined #RubyOnRails
[17:13:24] bijan_: has joined #RubyOnRails
[17:17:24] Iarfen: havenwood: where are the validation rules specified? I'm confused inside the code
[17:18:04] bijan_: has joined #RubyOnRails
[17:22:09] bijan_: has joined #RubyOnRails
[17:24:41] ams__: has joined #RubyOnRails
[17:26:14] bijan_: has joined #RubyOnRails
[17:28:22] uks: has joined #RubyOnRails
[17:30:43] bijan_: has joined #RubyOnRails
[17:32:28] Dbugger: has joined #RubyOnRails
[17:34:15] benlieb: has joined #RubyOnRails
[17:34:38] bijan__: has joined #RubyOnRails
[17:38:52] bijan_: has joined #RubyOnRails
[17:43:20] bijan__: has joined #RubyOnRails
[17:43:39] beholders_eye: has joined #RubyOnRails
[17:46:15] freezzo: has joined #RubyOnRails
[18:15:30] weteamsteve1: has joined #RubyOnRails
[18:18:31] ravenous_: has joined #RubyOnRails
[18:19:22] weteamsteve2: has joined #RubyOnRails
[18:32:40] Saukk: has joined #RubyOnRails
[18:44:18] gambl0re: has joined #RubyOnRails
[18:48:34] emachnic: has joined #RubyOnRails
[18:55:19] beholders_eye: has joined #RubyOnRails
[19:03:53] tdy1: has joined #RubyOnRails
[19:11:31] dslegends: has joined #RubyOnRails
[19:31:11] bijan_: has joined #RubyOnRails
[19:38:49] Technodrome: has joined #RubyOnRails
[19:55:58] AlHafoudh: has joined #RubyOnRails
[20:00:46] emachnic: has joined #RubyOnRails
[20:07:48] deepreds1: has joined #RubyOnRails
[20:18:04] dopie: has joined #RubyOnRails
[20:18:59] dopie: Good day all... Using active storage here and its great but now how cna I define lets say a title for each document...
[20:21:20] dopie: how can I give it a new attribute like title: ?
[20:38:39] deepredsky: has joined #RubyOnRails
[20:48:58] deepredsky: has joined #RubyOnRails
[20:49:06] ravenousmoose: has joined #RubyOnRails
[20:58:27] DoctorMonocular: has joined #RubyOnRails
[20:59:07] DoctorMonocular: hey can someone talk to me about multitenant apps? I'm making srchitectural decisions right now that will be hard to go back from
[20:59:33] DoctorMonocular: how fucked am I if I decide to try to use apartment with multiple pg databases? I've already seen that multiple schemas is a bad idea
[20:59:58] DoctorMonocular: but maybe the whole tyhing is a bad idea, maybe I should just use a fk and deal with it when some data leaks inevitably
[21:19:47] dopie: https://gist.github.com/staycreativedesign/c49a4718fd7302e05cf51a4df46d7726
[21:31:41] weteamsteve: has joined #RubyOnRails
[21:32:35] xhoy: has joined #RubyOnRails
[21:32:55] xhoy: maybe a weird question but do cars in the US have a normal 9v sigaret lighter plug?
[21:33:38] xhoy: where youc an plugin something like: https://image.allekabels.nl/image/1207787-0/usb-autolader-2x-usb-2100-ma-aanbieding-uitgaande-stroomsterkte-2x-usb-1050-ma.jpg
[21:46:41] emachnic: has joined #RubyOnRails
[21:52:08] trebor8: has joined #RubyOnRails
[21:52:40] trebor8: Hi all ! How can I verify an attribute was changed (marked as dirty) after save has been called and the object has been persisted ?
[21:53:35] trebor8: I was reading the documentation and it looks like Rails resets the dirty tracking after a successful save, I could go with after_validation but then that doesn't guarantee the record will pass database constraints.
[21:53:57] trebor8: is after_validation the best option i have ?
[21:54:36] trebor8: Thank you :)
[21:55:24] weteamsteve: has joined #RubyOnRails
[22:04:55] agent_white: has joined #RubyOnRails
[22:14:28] schne1der: has joined #RubyOnRails
[22:17:57] weteamsteve: has joined #RubyOnRails
[22:18:19] ariedler: has joined #RubyOnRails
[22:31:45] weteamsteve1: has joined #RubyOnRails
[22:35:37] benlieb: has joined #RubyOnRails
[22:45:32] gambl0re: has joined #RubyOnRails
[22:46:36] emachnic: has joined #RubyOnRails
[22:58:15] trebor8: i figured it out... there is #saved_changes and #saved_change_to_<column>? Thank you anyway!
[23:03:52] benlieb: has joined #RubyOnRails
[23:11:48] weteamsteve: has joined #RubyOnRails
[23:19:43] weteamsteve1: has joined #RubyOnRails
[23:27:32] bambanx: has joined #RubyOnRails
[23:47:07] brool: has joined #RubyOnRails
[23:50:51] benlieb: has joined #RubyOnRails