« Back to channel list

#RubyOnRails - 20 May 2019

« Back 1 day Forward 1 day »
[00:03:52] _aeris: has joined #RubyOnRails
[00:07:53] weird_error: has joined #RubyOnRails
[00:10:56] skryking: has joined #RubyOnRails
[00:14:43] NeXTSUN: has joined #RubyOnRails
[00:19:12] weird_error: has joined #RubyOnRails
[00:26:24] MrCrackPotBuilde: has joined #RubyOnRails
[00:35:30] tf2ftw: has joined #RubyOnRails
[00:37:55] weird_error: has joined #RubyOnRails
[00:54:47] orbyt_: has joined #RubyOnRails
[00:57:12] planigan: has joined #RubyOnRails
[01:07:50] orbyt_: has joined #RubyOnRails
[01:26:27] bambanx: has joined #RubyOnRails
[01:48:03] Technodrome: has joined #RubyOnRails
[02:00:05] NeXTSUN: has joined #RubyOnRails
[02:25:04] haxx0r: has joined #RubyOnRails
[02:25:38] haxx0r: i have a 200 LoC StateMachine. i would like to split my model up into several fights for readability. concerns seem not to work for me.
[02:26:21] haxx0r: (because class methods and isntance methods)
[02:30:16] haxx0r: ah, nevermind. need to wrap it into included {} block. now it's working. sweet
[02:47:36] tf2ftw: has joined #RubyOnRails
[02:58:31] elcontrastador: haxx0r; glad we could help man
[03:11:43] braincrash: has joined #RubyOnRails
[03:13:57] elcontrastador: Any help on this has many, through form issue? https://gist.github.com/elcontrastador/3cd55f5dd065da00992cee65c5f0e87a
[03:14:24] elcontrastador: prob something simple...i'm getting tired now...blown a lot of time
[03:43:41] orbyt_: has joined #RubyOnRails
[03:55:08] elcontrastador: Any experts out there that take venmo, apple pay, etc. and could spare a 1/2hr of time to help me on this?
[04:08:41] gambl0re: has joined #RubyOnRails
[05:16:32] bga57: has joined #RubyOnRails
[05:18:55] conta: has joined #RubyOnRails
[05:31:14] zacts: has joined #RubyOnRails
[05:33:30] srinidhi: has joined #RubyOnRails
[05:36:43] elcontrastador: $100 for someone to help me thru this jam...My brain is mush and I need to finish this tonight
[06:20:29] conta: has joined #RubyOnRails
[06:21:02] zacts: has joined #RubyOnRails
[06:47:27] ziyadb: has joined #RubyOnRails
[06:47:34] coffeejunk: has joined #RubyOnRails
[06:47:34] pitastrudl: has joined #RubyOnRails
[06:47:36] podman: has joined #RubyOnRails
[06:47:41] uranoss: has joined #RubyOnRails
[06:47:41] frewsxcv: has joined #RubyOnRails
[06:48:03] mostlybadfly: has joined #RubyOnRails
[06:48:12] hahuang65: has joined #RubyOnRails
[06:48:12] Liothen: has joined #RubyOnRails
[06:48:33] jhill: has joined #RubyOnRails
[07:04:19] octos: has joined #RubyOnRails
[07:20:44] zacts: has joined #RubyOnRails
[07:27:32] jefffrails35: has joined #RubyOnRails
[07:29:04] Ergo: has joined #RubyOnRails
[07:33:14] s2013: has joined #RubyOnRails
[07:44:11] lxsameer: has joined #RubyOnRails
[07:53:51] deepredsky: has joined #RubyOnRails
[07:56:23] sirensari__: has joined #RubyOnRails
[08:13:28] schneider: has joined #RubyOnRails
[08:28:23] Norore: has joined #RubyOnRails
[08:48:36] planigan: has joined #RubyOnRails
[08:53:50] ephemer0l_: has joined #RubyOnRails
[08:57:16] xco: has joined #RubyOnRails
[09:06:35] conta: has joined #RubyOnRails
[09:26:14] sagax: has joined #RubyOnRails
[09:41:36] _aeris_: has joined #RubyOnRails
[09:48:02] gregf_: has joined #RubyOnRails
[09:51:10] orbyt_: has joined #RubyOnRails
[09:59:26] conta: has joined #RubyOnRails
[10:09:07] davidh38: has joined #RubyOnRails
[10:26:46] yottanami: has joined #RubyOnRails
[10:27:11] ur5us: has joined #RubyOnRails
[10:29:11] yottanami: I am trying to write a custom generator. Is anyway to add a generator template file into an existing class?
[10:30:33] yottanami: Something like inject_into_file but accept a template file except a striing variable
[10:32:08] apparition: has joined #RubyOnRails
[10:53:29] pd09041999: has joined #RubyOnRails
[10:54:19] lankanmon: has joined #RubyOnRails
[10:55:56] freddykiks: has joined #RubyOnRails
[10:59:14] tdy: has joined #RubyOnRails
[11:19:32] pd09041999: has joined #RubyOnRails
[11:19:55] freddykiks: has left #RubyOnRails: ("Leaving")
[11:24:07] haxx0r: has joined #RubyOnRails
[11:37:45] blackbaba: has joined #RubyOnRails
[12:15:07] blackmesa: has joined #RubyOnRails
[12:15:48] RiPuk: has joined #RubyOnRails
[12:19:25] weird_error: has joined #RubyOnRails
[12:21:57] xco: has joined #RubyOnRails
[12:30:39] conta1: has joined #RubyOnRails
[12:43:53] NL3limin4t0r: elcontrastador: The issue is quite simple. The select form elements are named `phone[line_ids]`, Rails will use the last value if multiple values for the same key are given.
[12:45:51] NL3limin4t0r: elcontrastador: Your select element should have the name `phone[line_ids][]` (notice the opening and closing square brackets at the end). This marks the parameter name as array, resulting in `params #=> { phone: { line_ids: [1, 2, 3] } }` when converted by Rails.
[12:51:38] NL3limin4t0r: yottanami: A file can be converted into a string. So you could first load in your template file as string. Then use `inject_into_file` to put the result into a class.
[12:59:50] tmm88: has joined #RubyOnRails
[13:09:07] s2013: has joined #RubyOnRails
[13:11:16] status402: has joined #RubyOnRails
[13:22:43] mXr: has joined #RubyOnRails
[13:25:27] mXr: hi hello everyone :) im searching for *current* information on how to deploy rails in a subdirectory. none of the "official" methods seem to work for me. disclaimer: im currently trying with rails 6.0.0rc1 (but i had the same experience with 5* before) and im using nginx to proxy_pass to puma
[13:25:45] mXr: none of the methods i can find with google seem to work
[13:27:14] tf2ftw: has joined #RubyOnRails
[13:32:02] srinidhi: has joined #RubyOnRails
[13:43:21] mXr: specifically, i used a --user systemd job with Environment=RAILS_RELATIVE_URL_ROOT=/gw
[13:43:25] mXr: to run puma
[13:43:55] mXr: i tried stuff in config.ru, i tried adding config.relative_url_root = "/gw" to config/application.rb
[13:44:11] mXr: and a few other things but i always get No route matches [GET] "/gw"
[13:44:50] mXr: (the latter being the "official" way as documented in https://edgeguides.rubyonrails.org/configuring.html#deploy-to-a-subdirectory-relative-url-root
[13:48:53] Technodrome: has joined #RubyOnRails
[13:52:24] tdy: has joined #RubyOnRails
[14:03:49] haxx0r: what you mean in a subdirectory/
[14:12:36] choke: has joined #RubyOnRails
[14:22:54] havenwood: mXr: Which part isn't working? Is Rails generating the appropriate routes with the nesting path prepended? (That's the part `config.relative_url_root =` handles.)
[14:23:34] blackmesa: has joined #RubyOnRails
[14:25:44] havenwood: mXr: If you manually start your app on a port locally, is `/gw/` prepended to links Rails generates?
[14:26:10] havenwood: mXr: If so, #relative_url_root= is working.
[14:26:23] blackmesa1: has joined #RubyOnRails
[14:46:55] Dbugger: has joined #RubyOnRails
[14:48:18] blackmesa1: has joined #RubyOnRails
[14:55:36] tf2ftw: has joined #RubyOnRails
[14:58:14] tf2ftw: has joined #RubyOnRails
[15:02:53] Technodrome: has joined #RubyOnRails
[15:04:08] blackmesa1: has joined #RubyOnRails
[15:19:01] MrCrackPotBuilde: has joined #RubyOnRails
[15:19:48] tf2ftw: has joined #RubyOnRails
[15:25:37] maryo: has joined #RubyOnRails
[15:25:56] choke: has joined #RubyOnRails
[15:28:34] conta: has joined #RubyOnRails
[15:36:33] MrCrackPotBuilde: has joined #RubyOnRails
[15:38:18] Saukk: has joined #RubyOnRails
[15:48:50] NeXTSUN: has joined #RubyOnRails
[15:58:45] brool: has joined #RubyOnRails
[16:04:17] choke: has joined #RubyOnRails
[16:09:33] Technodrome: has joined #RubyOnRails
[16:13:11] tf2ftw2: has joined #RubyOnRails
[16:17:45] tf2ftw: has joined #RubyOnRails
[16:19:12] lato: has joined #RubyOnRails
[16:22:37] VSpike: Hi ... I still have this odd situation with a Puma test app not producing any log output when spawed by rspec, but working fine when called directly. Also, problem occurs in Ruby 2.5.x but not 2.4.x.
[16:23:16] VSpike: I've figured out the key difference ... whether there is a TTY or not. Calling `bundle exec rails server puma -e production | cat` will not produce any output ...
[16:23:30] VSpike: Calling `bundle exec rails server puma -e production` will work fine
[16:23:59] tf2ftw: has joined #RubyOnRails
[16:24:04] VSpike: I used a `faketty` wrapper that i stole from StackOverflow, i.e. `faketty bundle exec rails server puma -e production | cat` and it works again.
[16:24:17] VSpike: Has anyone seen anything like this before?
[16:26:45] choke: has joined #RubyOnRails
[16:33:40] happyhans_: has joined #RubyOnRails
[16:36:44] Sylario: has joined #RubyOnRails
[16:44:42] happyhans_: what's good ^___^
[16:47:38] dretnx: has joined #RubyOnRails
[16:58:46] duderonomy: has joined #RubyOnRails
[17:01:55] zacts: has joined #RubyOnRails
[17:02:47] mXr: havenwood: sorry was afk; hmmmm are you referring to the output of "rake routes"?
[17:03:13] mXr: if so, then no, it does not reflect that. for example i have a single (nothing else) line root 'test#index'
[17:03:24] mXr: and rake routes shows root GET / test#index
[17:03:55] maryo: has joined #RubyOnRails
[17:04:52] mXr: also, when i temporarily start puma via "rails s -b 0.0.0.0"
[17:05:07] mXr: and access it via a browser, it will give me the same "no route matches [GET] "/gw"
[17:05:14] mXr: so i would say no, it simply ignores this completely
[17:07:42] mXr: however, i MAY have found a solution now... the first part of https://stackoverflow.com/a/49292134 seems to work (adding "map" to config.ru)
[17:08:33] mXr: at least simple things seem to work with that
[17:11:39] octos: has joined #RubyOnRails
[17:12:49] zacts: has joined #RubyOnRails
[17:14:40] jefffrails35: has joined #RubyOnRails
[17:16:54] s2013: has joined #RubyOnRails
[17:17:09] eddof13: has joined #RubyOnRails
[17:20:33] VSpike: when running `rails server`, can I require an arbirary file via the command line? Doesn't look like it
[17:20:51] VSpike: I'm trying to disable stdout buffering to test if that's the issue
[17:26:12] dretnx: Which is best async library for ruby/rails and how performs in comparision with node.js?
[17:31:30] lupine: just run it in thin and be done with it
[17:47:23] zacts: has joined #RubyOnRails
[17:48:39] NL3limin4t0r: We have a Rails production server running under a subroute/subdirectory but use a slightly different version than you've posted. https://gist.github.com/3limin4t0r/7ee14976eaf1d70b1f8317d0101c7cea
[17:51:52] NL3limin4t0r: Than set `config.relative_url_root` in your environment. If you use the Rails mailer you should also update the the `config.action_mailer.default_url_options` option.
[17:53:02] NL3limin4t0r: `config.action_mailer.default_url_options = { host: 'yourhost', protocol: 'https', script_name: config.relative_url_root }`
[17:58:51] NL3limin4t0r: lupine: Ruby isn't build in the same way as JavaScript. The async way of programming doesn't really work well for Ruby. You can however use fibers (core Ruby) if you want to do some processing in the background.
[17:59:01] NL3limin4t0r: Have a look at: http://ruby-doc.org/core-2.6.3/Fiber.html
[17:59:24] lankanmon: has joined #RubyOnRails
[18:00:50] NL3limin4t0r: lupine: Have a look at the different links and answers provided in: https://stackoverflow.com/questions/6643964/asynchronous-http-request-in-ruby
[18:02:20] NL3limin4t0r: Oops, the above was meant for dretnx
[18:03:31] NL3limin4t0r: Srry lupine 😅
[18:06:44] lupine: there's plenty of evented async frameworks for ruby, but one does have to question why you'd bother when real threads exist
[18:06:51] lupine: event-machine used to be popular
[18:07:46] dviola: has joined #RubyOnRails
[18:08:13] lankanmon: has joined #RubyOnRails
[18:09:14] Saukk: has joined #RubyOnRails
[18:11:36] havenwood: Threaded web servers like Puma and Passenger also use an evented reactor too, and forking as well.
[18:17:21] ravenous_: has joined #RubyOnRails
[18:20:51] NL3limin4t0r: There is nothing wrong with the event-loop architecture. However it's not a one size fits all solution. Furthermore it might be overkill depending on the scenario.
[18:35:32] choke: has joined #RubyOnRails
[18:38:25] tdy: has joined #RubyOnRails
[18:49:53] IGnorAND: I have an array of Hashes. I want to do a .map on the array, but I need to add something to each hash beforehand.
[18:50:15] IGnorAND: Writing this down makes me think maybe I should just split it in several lines of code instead of making one complex line of code
[19:08:02] maryo: has joined #RubyOnRails
[19:16:48] jhass: yep, you answered your own question :D
[19:17:02] jhass: two simple lines are better than one complicated one
[19:23:14] tdy: has joined #RubyOnRails
[19:34:53] gambl0re: has joined #RubyOnRails
[19:36:17] s2013: has joined #RubyOnRails
[19:45:32] choke: has joined #RubyOnRails
[19:50:59] sameerynho: has joined #RubyOnRails
[19:56:26] lankanmon: has joined #RubyOnRails
[19:58:12] _aeris_: has joined #RubyOnRails
[20:11:18] lato: has joined #RubyOnRails
[20:13:19] lankanmon: has joined #RubyOnRails
[20:16:36] happyhans: has joined #RubyOnRails
[20:18:57] choke: has joined #RubyOnRails
[20:30:53] octos: has joined #RubyOnRails
[20:31:20] choke: has joined #RubyOnRails
[20:33:33] christiandsg: has joined #RubyOnRails
[20:34:23] christiandsg: has joined #RubyOnRails
[20:35:09] christiandsg: has joined #RubyOnRails
[20:35:40] choke: has joined #RubyOnRails
[20:36:14] gambl0re: has joined #RubyOnRails
[20:38:08] choke: has joined #RubyOnRails
[20:39:45] deepredsky: has joined #RubyOnRails
[20:41:23] choke: has joined #RubyOnRails
[20:44:58] choke: has joined #RubyOnRails
[20:48:35] choke: has joined #RubyOnRails
[20:55:25] choke: has joined #RubyOnRails
[20:58:10] choke: has joined #RubyOnRails
[21:01:56] choke: has joined #RubyOnRails
[21:03:07] Technodrome: has joined #RubyOnRails
[21:07:11] choke: has joined #RubyOnRails
[21:09:54] christiandsg: has joined #RubyOnRails
[21:13:59] octos: has joined #RubyOnRails
[21:16:30] choke: has joined #RubyOnRails
[21:19:45] choke: has joined #RubyOnRails
[21:21:22] hightower2: has joined #RubyOnRails
[21:33:15] choke: has joined #RubyOnRails
[21:39:11] jimms: has joined #RubyOnRails
[21:46:16] brool: has joined #RubyOnRails
[21:46:31] octos: has joined #RubyOnRails
[21:57:36] benlieb: has joined #RubyOnRails
[21:57:58] benlieb: has left #RubyOnRails: ()
[22:02:40] tjbp: has joined #RubyOnRails
[22:04:13] tjbp: has joined #RubyOnRails
[22:07:50] Fernando-Basso: has joined #RubyOnRails
[22:19:24] xco: has joined #RubyOnRails
[22:23:22] xco: has joined #RubyOnRails
[22:33:47] obzidian: has joined #RubyOnRails
[22:48:02] tdy: has joined #RubyOnRails
[23:00:49] GodFather: has joined #RubyOnRails
[23:03:26] Puffball: has joined #RubyOnRails
[23:09:23] ziyadb: anyone using Pundit for authorisation? I'm having trouble with a pretty basic issue
[23:10:27] weaksauce: ziyadb ask your question and if someone knows the answer they will respond. also, irc takes a while to respond a lot of the time
[23:12:00] ziyadb: the "record" object I'm trying to verify against is empty: Space(id: integer, name: string, description: text, organisation_id: integer, created_at: datetime, updated_at: datetime), so when I do like user.has_role(:moderator, record) it returns false, because record is a new instance, whereas if I try the console with the actual record it works fine.
[23:12:09] christiandsg: has joined #RubyOnRails
[23:13:09] ziyadb: So the problem is the actual object isn't being passed to the "record" on the policy, IDK why that is the case, I have "authorize @object" in the relevant actions, so it shouldn't be a problem...I'm clearly missing something here
[23:13:43] ziyadb: I have resourcify the model in question
[23:13:45] ziyadb: s/the/in the/
[23:14:41] ziyadb: weaksauce: thanks :)
[23:15:50] weaksauce: if you can gist code too that is a help to people
[23:16:08] weaksauce: it's hard to conceptualize what might be going wrong with a small description
[23:24:18] ziyadb: https://gist.github.com/ziyadbasheer/5dfcaf3dd1a34e85a3a7f9c483db034a
[23:25:04] ziyadb: I excluded irrelevant parts, association between spaces <-> users are set up correctly.
[23:26:22] tdy: has joined #RubyOnRails
[23:27:39] weaksauce: and you're sure @space is an object before calling authorize in set_space
[23:29:36] ziyadb: Supposedly? I’ll verify
[23:34:54] ziyadb: weaksauce: pretty sure, since the view would error out if it didn't exist..
[23:35:22] weaksauce: a quick puts @space before that authorize call would show you in the terminal
[23:36:47] ziyadb: yup, I verified it worked fine
[23:38:40] weaksauce: is there an initialize method in spacespolicy
[23:43:48] ziyadb: weaksauce: nope, just the default initialize method application_policy.rb which space_policy inherits from
[23:45:30] weaksauce: oh lol it should be @record not record
[23:47:20] zacts: has joined #RubyOnRails
[23:48:29] ziyadb: weaksauce: close, but not quite:
[23:48:52] ziyadb: pretty much the same.. https://www.irccloud.com/pastebin/Rwhol4t6/record%20vs%20%40record
[23:51:08] ziyadb: Would adding an initializer to the space policy do the trick?
[23:51:17] weaksauce: ah yeah if you have attr_reader it wouldn't matter
[23:52:05] weaksauce: or not. my ruby is a bit rusyt
[23:52:26] ziyadb: That makes two of us
[23:52:42] ziyadb: But this issue is fairly trivial I mean the sensible defaults should kick in
[23:53:24] ziyadb: authorize @space should pretty much do it here but clearly it’s not
[23:54:22] weaksauce: user.has_rsole
[23:54:30] weaksauce: might want to change that
[23:54:44] ziyadb: And I don’t understand pundit well enough to override the record definition
[23:54:54] uks: has joined #RubyOnRails
[23:55:28] ziyadb: That’s intentional to raise the better errors so I can access the instance var “record”
[23:55:51] ziyadb: And see whether it contains the actual record or not (which it doesn’t)
[23:56:27] weaksauce: which request are you testing? edit/show/?
[23:56:35] weaksauce: only update?
[23:58:07] ziyadb: edit which relegates to update
[23:58:21] weaksauce: pundit is pretty simple so it's surprising