« Back to channel list

#RubyOnRails - 14 November 2018

« Back 1 day Forward 1 day »
[00:08:09] Dimik: has joined #RubyOnRails
[00:11:37] Exuma: has joined #RubyOnRails
[00:24:15] dviola: has joined #RubyOnRails
[00:36:53] Exuma: has joined #RubyOnRails
[00:45:38] Tempesta: has joined #RubyOnRails
[00:47:59] hnanon: has joined #RubyOnRails
[00:50:14] hnanon: I have a CollectionProduct join model between Collection and Product models.
[00:50:57] hnanon: Within an admin namespace (/admin/products/1/) I have the line: <%= link_to 'Remove', @product.collections.destroy(collection), method: :delete, data: { confirm: 'Are you sure?' } %>
[00:51:33] hnanon: When I go to that page, the actual collection is destroyed (without clicking the link!).
[00:51:56] hnanon: How can I just destroy the record within the joins table?
[00:52:54] hnanon: In other words, just visiting the page calls the destroy method.
[00:54:36] Radar: Well, yeah, that's what you're telling it to do.
[00:54:53] Radar: You're telling it to delete that item immediately. That link should go to an action that runs that destroy code.
[00:55:25] hnanon: Which controller should the destroy action be in?
[00:55:29] sevenseacat: has joined #RubyOnRails
[00:55:31] hnanon: Products?
[00:55:56] Radar: Are you deleting the link between a product and its collection? Is that the intention?
[00:56:04] hnanon: Yes, exactly.
[00:56:50] Radar: Then I would put it in the products controller
[00:57:03] Radar: and it doesn't necessarily have to be called destroy. It could be called something like "unlink"
[00:58:50] hnanon: What about using creating and using a collection_products controller?
[00:59:07] hnanon: *creating and using
[01:00:46] Radar: Sure, you could do that too.
[01:01:57] blackmesa1: has joined #RubyOnRails
[01:04:43] hnanon: Can I pass two arguments to its named path...something like: admin_collection_products_path(@product, collection)?
[01:06:12] orbyt_: has joined #RubyOnRails
[01:09:42] hnanon: It looks like I can pass params to the path.
[01:10:57] hnanon: So, something like admin_collection_product_path(product: @product, collection: collection).
[01:11:17] hnanon: Then I can access those params like normal in the destroy action.
[01:11:42] hnanon: Or, is that convoluted and I'm overthinking it?
[01:28:47] jetchisel: has joined #RubyOnRails
[01:28:50] dviola: has joined #RubyOnRails
[01:33:00] SteenJobs: has joined #RubyOnRails
[01:36:35] jane_booty_doe: has joined #RubyOnRails
[01:38:18] Exuma: has joined #RubyOnRails
[01:40:01] akosednar: has joined #RubyOnRails
[01:48:41] truenito: has joined #RubyOnRails
[01:58:52] uks: has joined #RubyOnRails
[02:29:14] Saukk: has joined #RubyOnRails
[02:37:54] blackmesa: has joined #RubyOnRails
[02:38:42] hnanon: has joined #RubyOnRails
[02:40:49] ivanskie: has joined #RubyOnRails
[02:42:44] bambanx: has joined #RubyOnRails
[02:47:18] blackmesa: has joined #RubyOnRails
[03:01:34] jetchisel: has joined #RubyOnRails
[03:11:04] jetchisel: has joined #RubyOnRails
[03:15:38] jetchisel: has joined #RubyOnRails
[03:16:02] Exuma: has joined #RubyOnRails
[03:23:04] jetchisel: has joined #RubyOnRails
[03:26:59] elcontrastador: has joined #RubyOnRails
[03:28:58] Xiti`: has joined #RubyOnRails
[03:41:07] SteenJobs: has joined #RubyOnRails
[03:54:02] Xiti: has joined #RubyOnRails
[04:08:04] kapil____: has joined #RubyOnRails
[04:10:00] braincrash: has joined #RubyOnRails
[04:11:53] darkhanb: has joined #RubyOnRails
[04:16:30] roshanavand1: has joined #RubyOnRails
[04:23:32] zwliew: has joined #RubyOnRails
[04:23:39] hnanon: has joined #RubyOnRails
[04:25:10] hnanon: has joined #RubyOnRails
[04:27:40] hnanon: has joined #RubyOnRails
[04:39:36] MoritaShinobu: has joined #RubyOnRails
[05:16:06] SteenJobs: has joined #RubyOnRails
[05:43:29] Xiti: has joined #RubyOnRails
[06:08:41] lankanmon: has joined #RubyOnRails
[06:22:29] conta: has joined #RubyOnRails
[06:27:08] IanMalcolm: has joined #RubyOnRails
[06:30:37] umpc: has joined #RubyOnRails
[06:44:49] bga57: has joined #RubyOnRails
[07:13:58] whysthatso: has joined #RubyOnRails
[07:22:03] dogweather: has joined #RubyOnRails
[07:22:49] Exuma: has joined #RubyOnRails
[07:31:55] roshanavand: has joined #RubyOnRails
[07:46:29] roshanavand: has joined #RubyOnRails
[07:50:25] za1b1tsu: has joined #RubyOnRails
[08:20:14] Exuma: has joined #RubyOnRails
[08:30:28] kapil____: can i get all columns of type in postgresql ?
[08:36:40] gavit: has joined #RubyOnRails
[08:41:23] JamieD: has joined #RubyOnRails
[08:42:36] jetchisel: has joined #RubyOnRails
[08:48:12] gavit: has joined #RubyOnRails
[08:56:11] ur5us: has joined #RubyOnRails
[08:59:51] srinidhi: has joined #RubyOnRails
[09:03:26] roshanavand: has joined #RubyOnRails
[09:25:26] Terens: has joined #RubyOnRails
[09:45:02] whysthatso: has joined #RubyOnRails
[10:04:45] morantron: has joined #RubyOnRails
[10:05:15] morantron: hi! is there a gem that provides an admin panel for managing translation YML files?
[10:05:31] morantron: how do you handle this so translations can be changed without dev intervention?
[10:06:06] dionysus69: https://stackoverflow.com/questions/32600912/rails-4-manage-file-based-translations-at-admin-end
[10:22:43] lxsameer: has joined #RubyOnRails
[10:26:29] voolik: has joined #RubyOnRails
[10:37:22] sevenseacat: has joined #RubyOnRails
[11:19:17] gregf_: has joined #RubyOnRails
[11:33:01] conta: has joined #RubyOnRails
[11:53:53] MoritaShinobu: has joined #RubyOnRails
[12:05:33] lankanmon: has joined #RubyOnRails
[12:13:05] kapil____: has joined #RubyOnRails
[12:19:36] za1b1tsu: has joined #RubyOnRails
[12:28:34] reber: has joined #RubyOnRails
[12:46:36] lxsameer: has joined #RubyOnRails
[12:50:11] roshanavand: has joined #RubyOnRails
[12:53:48] Ergo: has joined #RubyOnRails
[12:55:52] conta: has joined #RubyOnRails
[12:59:03] blassin: has left #RubyOnRails: ("The Lounge - https://thelounge.chat")
[13:06:52] mlt-: has joined #RubyOnRails
[13:10:19] roshanavand: has joined #RubyOnRails
[13:14:42] voolik: has joined #RubyOnRails
[13:18:12] roshanavand: has joined #RubyOnRails
[13:22:54] za1b1tsu: has joined #RubyOnRails
[13:24:39] dminuoso: has joined #RubyOnRails
[13:24:49] dminuoso: has left #RubyOnRails: ("WeeChat 2.0.1")
[13:57:14] za1b1tsu: has joined #RubyOnRails
[14:07:28] za1b1tsu: has joined #RubyOnRails
[14:22:16] andywww: has joined #RubyOnRails
[14:25:17] dviola: has joined #RubyOnRails
[14:25:53] andywww: has joined #RubyOnRails
[14:37:37] lexileo: has joined #RubyOnRails
[14:53:47] conta1: has joined #RubyOnRails
[14:58:01] whysthatso: has joined #RubyOnRails
[15:05:52] whysthatso: has joined #RubyOnRails
[15:07:07] Fridtjof: has joined #RubyOnRails
[15:20:45] nertzy: has joined #RubyOnRails
[15:30:15] Inside: has left #RubyOnRails: ()
[15:34:01] dviola: has joined #RubyOnRails
[15:37:23] conta2: has joined #RubyOnRails
[15:55:11] andywww: has joined #RubyOnRails
[16:16:51] logik-bomb: has joined #RubyOnRails
[16:17:57] gavit: has joined #RubyOnRails
[16:18:17] logik-bomb: I'm trying to add a published_at to my model when the attribute is_published gets set. How can I execute this from my model? I'm trying with after_save :set_published_date, :if => Proc.new{ self.published_changed? } without much success. Thanks
[16:21:02] jhass: before_save ?
[16:21:16] jhass: after the save it's obviously not changed anymore
[16:24:26] logik-bomb: jhass: thanks
[16:38:41] pavelz: anyone knows about turbolinks? i had to upgradet to versions 5 and now when going over to older pages I get servied a cached version and a few seconds later it refreshes
[16:38:56] pavelz: can't seen to enalbe progress bar either
[16:49:59] fryguy: has joined #RubyOnRails
[16:59:18] ivanskie: has joined #RubyOnRails
[17:01:21] roshanavand: has joined #RubyOnRails
[17:01:31] Exuma: has joined #RubyOnRails
[17:03:15] ivanskie: has joined #RubyOnRails
[17:14:14] Saukk: has joined #RubyOnRails
[17:28:32] darkhanb: has joined #RubyOnRails
[17:29:16] _aeris_: has joined #RubyOnRails
[17:29:20] _aeris_: hello here!
[17:29:29] _aeris_: i have trouble with strong parameters
[17:29:38] _aeris_: [13] pry(main)> ActionController::Parameters.new.permit(settings: {}).fetch(:settings, {}).to_hash
[17:29:40] _aeris_: ActionController::UnfilteredParameters: unable to convert unpermitted parameters to hash
[17:30:03] _aeris_: strange to have this error because i allow anything on settings with the permit…
[17:31:06] _aeris_: I can use `[:settings] || {}` instead of fetch, but current behavior is strange
[17:34:40] jetchisel: has joined #RubyOnRails
[17:35:52] kapil____: has joined #RubyOnRails
[17:40:54] Dimik: has joined #RubyOnRails
[17:46:57] Puffball: has joined #RubyOnRails
[17:49:13] jetchisel: has joined #RubyOnRails
[18:15:04] orbyt_: has joined #RubyOnRails
[18:31:33] za1b1tsu: has joined #RubyOnRails
[18:31:35] JamieD: has joined #RubyOnRails
[18:33:07] schneider: has joined #RubyOnRails
[18:39:39] Puffball: has joined #RubyOnRails
[18:41:29] whysthatso: has joined #RubyOnRails
[18:46:13] JamieD: has joined #RubyOnRails
[18:53:35] safetypin: has joined #RubyOnRails
[19:00:59] za1b1tsu: has joined #RubyOnRails
[19:14:00] Puffball: has joined #RubyOnRails
[19:14:38] whysthatso: has left #RubyOnRails: ()
[19:14:58] whysthatso: has joined #RubyOnRails
[19:15:40] tdy: has joined #RubyOnRails
[19:23:13] ryandv: has joined #RubyOnRails
[19:24:29] ryandv: Hi all - I'm reading through the Rails 5 source and am curious about the class attribute `attributes_to_define_after_schema_loads` - how is it used? From what I can tell, a cursory glance over the source suggests that it is unused
[19:24:45] ryandv: Is this something that is configurable by the user? I somehow doubt this as there is an internal annotation on the attribute
[19:25:03] eckhardt_: has joined #RubyOnRails
[19:29:38] ryandv: nevermind, I am mistaken
[19:33:00] ryandv: it appears to contain all those activerecord attributes defined in an `attribute` class macro call
[19:33:38] ryandv: which I guess is distinguished from those attributes coming straight from the model schema
[19:36:35] dviola: has joined #RubyOnRails
[19:38:11] defsdoor: has joined #RubyOnRails
[19:51:05] merzu: has joined #RubyOnRails
[19:54:28] Dbugger: has joined #RubyOnRails
[19:58:04] merzu: has joined #RubyOnRails
[20:19:30] chouhoulis: has joined #RubyOnRails
[20:34:56] ur5us: has joined #RubyOnRails
[20:42:51] lomex: has joined #RubyOnRails
[20:44:42] beanish: has joined #RubyOnRails
[20:56:17] ellcs: has joined #RubyOnRails
[21:23:04] Radar: GOOD MORNING
[21:25:03] dviola: has joined #RubyOnRails
[21:27:10] Dimik: has joined #RubyOnRails
[21:27:42] Ergo^: has joined #RubyOnRails
[21:46:19] tdy1: has joined #RubyOnRails
[21:54:09] roshanavand: has joined #RubyOnRails
[22:10:08] tdy1: has joined #RubyOnRails
[22:13:01] akosednar: has joined #RubyOnRails
[22:14:04] dionysus69: has joined #RubyOnRails
[22:16:21] safetypin: has joined #RubyOnRails
[22:30:09] wethu: has joined #RubyOnRails
[22:31:59] Exuma: has joined #RubyOnRails
[22:40:04] ss_much: has joined #RubyOnRails
[22:42:41] Maletor: has joined #RubyOnRails
[22:43:04] Maletor: I'm getting undefined method `close' for #<String:...> when using config.cache_store = :file_store.
[22:43:19] Maletor: from activesupport-5.2.1/lib/active_support/core_ext/file/atomic.rb:24:in `atomic_write'
[22:51:40] Radar: maletor: is there a larger stacktrace than that?
[22:55:56] Maletor: Radar: sure is
[22:56:13] Radar: maletor: !gist
[22:56:13] helpa: maletor: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[22:56:45] Maletor: Radar: https://gist.github.com/maletor/cb99d963ea6e0198e23d6e68a7020278
[22:56:52] Radar: thank you
[22:57:11] Radar: maletor: Can you add # ./app/models/user.rb:895 and the containing method to the Gist too please?
[22:57:18] Maletor: Radar: doing now
[22:58:04] Maletor: Radar: for context i run Rails.cache.fetch in other places of my test suite with no issue
[22:58:06] Maletor: updated with 895
[22:58:12] Radar: Thank you
[22:58:40] Radar: Nothing seems to be amiss here. Should be fine. Can you repro in a new app?
[22:58:57] Maletor: i... will try
[22:59:09] Maletor: just an app from 2010
[22:59:13] Maletor: so ... lol
[22:59:31] Radar: Right, but there's only a few moving parts here. Set the cache_store, copy over the method...
[23:01:03] Maletor: do you have any other ideas?
[23:01:08] Radar: not right now
[23:01:17] Radar: not without being able to view the app myself
[23:01:23] Maletor: i snuck a debugger into rails and called close successfully
[23:01:31] Maletor: but it bombed whenever i contineued
[23:01:42] Maletor: i think maybe when block ends it's tripping up
[23:02:13] Maletor: ya, totally understand
[23:02:35] Radar: The block there shouldn't be returning a string. iirc, it should be returning a Tempfile.
[23:02:40] Radar: For it to be returning a string is very wrong.
[23:03:13] Radar: https://github.com/rails/rails/blob/v5.2.1/activesupport/lib/active_support/core_ext/file/atomic.rb#L24
[23:03:42] Maletor: Radar: yup
[23:03:50] Maletor: that's around where i've been debugging
[23:03:54] Maletor: it's a tempfile as far as i can see
[23:04:52] Maletor: Radar: also this
[23:05:13] Maletor: caused by:
[23:05:14] Maletor: undefined method `binmode' for #<String:0x00000000175b8080>
[23:05:30] Maletor: atomic.rb:25
[23:06:07] Maletor: i wonder if zipcode is colliding in a weird way on the FS?
[23:06:37] Radar: what is the string at that point?
[23:06:47] Radar: I can't interpret what "0x00000000175b8080" means :)
[23:07:12] Radar: Looks like a zipcode to me.
[23:07:16] Maletor: in atomic.rb?
[23:07:28] Radar: maybe. Now track back along the stacktrace to see how it arrives at that point
[23:07:42] Maletor: ya, i did that
[23:08:07] Maletor: well. no luck.
[23:08:15] Maletor: need more harder digging
[23:08:18] Maletor: bigger shovel
[23:08:36] Radar: Ok, but how does the string 99016 arrive in there? Did you follow it all the way from user.rb?
[23:08:42] Radar: Debugging at each line in that stacktrace?
[23:08:52] Maletor: oh the 99016 is in user.rb
[23:09:06] Radar: Yes, we have an A point and a Z point. What's the middle bits?
[23:09:07] Maletor: within rails/atomic it's tempfile
[23:14:29] Maletor: so far seeing 3 writes within the spec to the cache, the one we care about is "/app/tmp/cache/10A/2E0/99016"
[23:21:38] Maletor: Radar: https://gist.github.com/maletor/cb99d963ea6e0198e23d6e68a7020278#gistcomment-2759915
[23:24:16] Maletor: Radar: this one is seriously weird: https://gist.github.com/maletor/cb99d963ea6e0198e23d6e68a7020278#gistcomment-2759918
[23:29:36] Maletor: Radar: oh fudge. someone stubbed File.open to return something
[23:29:43] Radar: maletor: that'll do it ;)
[23:29:50] Radar: maletor: is it iwthin tests?
[23:30:09] Maletor: yes, but of course buried in required file
[23:30:51] Maletor: now i'm just mad at myself for not looking there first