NL3limin4t0r

Activity Graph

Page 1 of 4 | Next »

2019-02-05

[12:33:53] NL3limin4t0r: Quit: WeeChat 1.9.1

2019-02-04

[18:40:28] NL3limin4t0r: has joined #ruby

2019-01-08

[16:02:06] NL3limin4t0r: However keep in mind that enum is set on model initialisation. If the model (class) is initialized changes to the external database will not be reflected in the enum.
[16:06:32] NL3limin4t0r: You can ignore the above if your enum is hardcoded. However if you set your enum dynamically you'll have to take this into account. eg. `enum status: SomeModelConnectedWithExternalDb.pluck(:slug, :id).to_h.symbolize_keys`
[16:10:18] NL3limin4t0r: ^ I just realized the symbolize_keys is obsolete in the above example.
[19:33:46] NL3limin4t0r: IGnorAND: In most other languages enums are constants, so that's not really anything worrisome. Ruby doesn't really have enums build-in and instead uses symbols to achieve the same result. Rails introduced them into the models to simplify the state of an record.

2019-01-07

[14:36:08] NL3limin4t0r: has joined #ruby
[14:36:17] NL3limin4t0r: has joined #RubyOnRails

2018-12-20

[15:48:48] NL3limin4t0r: has joined #ruby
[15:56:12] NL3limin4t0r: Hey. I want the inform the maintainers of ruby-community.com that there are two links under resourses > links > tutorials & learning that changed. 1) The CodeCademy link changed, CodeCademy changed their file structure "https://www.codecademy.com/tracks/ruby" should be changed to "https://www.codecademy.com/learn/learn-ruby", "https://tryruby.org" is bought by Pluralsight and now redirects to
[15:56:14] NL3limin4t0r: "https://www.pluralsight.com/search?q=ruby" this should be changed to "https://ruby.github.io/TryRuby/".
[17:06:57] NL3limin4t0r: Quit: WeeChat 1.9.1

2018-11-19

[16:44:33] NL3limin4t0r: has joined #ruby

2018-11-01

[10:14:27] NL3limin4t0r: has joined #ruby
[10:18:12] NL3limin4t0r: Is it possible to use *.so libraries in Ruby? I use a proprietary piece of software that has an API. However this API comes only as *.so library file (plus the Windows variant).
[10:22:00] NL3limin4t0r: Not at the moment. I'll have to check if they are provided.
[10:23:55] NL3limin4t0r: I currently wrote a small C program that acts like a daemon, opening a UNIX socket to which it listens. Incomming data is passed to the library and the response is passed back to the socket.
[10:24:37] NL3limin4t0r: It works fine, but I was wondering if it could be done in Ruby itself.
[10:37:32] NL3limin4t0r: Let me phrase that differently. I was wondering if Ruby supports the intergration with *.so files without dirty hacks.
[10:49:25] NL3limin4t0r: al2o3-cr: the so extension stands for Shared Object and is used in the Linux C and C++ languages. Windows uses dll for this.
[10:52:04] NL3limin4t0r: I have no clue about macs.
[11:00:34] NL3limin4t0r: Ah, I can work with that. Didn't know about the ffi gem. ty
[12:48:03] NL3limin4t0r: djellemah: I'll have a look ty for the suggestion.
[12:48:55] NL3limin4t0r: Quit: WeeChat 1.9.1

2018-10-23

[09:22:45] NL3limin4t0r: Quit: WeeChat 1.9.1

2018-10-22

[13:17:35] NL3limin4t0r: has joined #ruby
[13:17:42] NL3limin4t0r: has joined #RubyOnRails
[23:30:45] NL3limin4t0r: Ping timeout: 268 seconds
[23:32:16] NL3limin4t0r: has joined #RubyOnRails

2018-10-05

[10:02:04] NL3limin4t0r: Quit: WeeChat 1.9.1

2018-10-04

[12:33:31] NL3limin4t0r: has joined #ruby
[12:33:40] NL3limin4t0r: has joined #RubyOnRails

2018-09-18

[09:02:37] NL3limin4t0r: has joined #ruby
[09:03:17] NL3limin4t0r: has joined #RubyOnRails
[13:10:22] NL3limin4t0r: TvL2386: Joining tables from different databases is possible as long as they are on the same server. https://stackoverflow.com/a/11427098/3982562
[13:12:10] NL3limin4t0r: However a join is a query to be submitted through 1 of the 2 connections you have. That connection user need to have at least read rights for both tables in both databases.
[13:15:07] NL3limin4t0r: As far as I know Arel doesn't account for different databases, so you might need to write the query yourself.
[17:08:34] NL3limin4t0r: Quit: WeeChat 1.9.1

2018-09-17

[15:56:03] NL3limin4t0r: has joined #ruby
[16:08:26] NL3limin4t0r: athough you can get and set a method too
[16:08:41] NL3limin4t0r: `some_object.method(:some_method)` would be the getter
[16:12:35] NL3limin4t0r: nfk: You have to see getters and setters as the api to the variable. If some developer is going to change the internals of some class, variables may change but the getters and setters might stay the same.
[16:12:58] NL3limin4t0r: The "interface" as you will.
[16:32:52] NL3limin4t0r: rgr: I guess that question is better asked in the apache or pessenger irc channel (#httpd). Since it's the job of those programs to route the initial incomming requests.
[16:39:14] NL3limin4t0r: nfk: Ruby is pretty hackable, it's not the intention of Ruby to make anything inaccessible. It's more like the waranty on your computer. You can screw it open if you want, change parts, whatever. But if you want the "simple" and intended experiance you just use the IO given to you by the developers.
[16:40:20] NL3limin4t0r: That's why Ruby has methods like `send` and `instance_variable_{set,get}` which allows anyone access to almost anything.
[16:59:36] NL3limin4t0r: So should car manufacturers also solder the hood of an car, just you can't tinker with the insides?
[17:12:41] NL3limin4t0r: I recently encountered some anoying behaviour of Ruby. So when a module A is included in class Foo all instance method changes to A are reflected in the instances of Foo. However say I want to extend A. In my opinion the "clean" way to do this is to create a new module B and prepend that to A. However classes that already incuded A will never call the updated version in B unless they include A again, after B is
[17:12:43] NL3limin4t0r: prepended to A. My example can be found here: https://gist.github.com/3limin4t0r/fa7c4f39c55c5e75269ca7050094ca85. Is there a clean way to resolve this problem? I though of the following solutions. 1) Include to Foo instead (after the inclution of A ofcourse). 2) Don't make module B and instead just open up A. (Saving the method in a variable, than calling that from my newly defined method.)
[17:18:26] NL3limin4t0r: nfk: A is a module defined by a framework so I don't have any influence on that.
[17:19:07] NL3limin4t0r: RedNifre: In C input is often terminated when EOF (Ctrl+D) is send.
[18:16:19] NL3limin4t0r: If every log entry is just one line it's as simple as checking for the newline character at the end of the file. If it's there the last line was written succesfully, if it's not there the last line got currupted and should be overwritten. If a log entry may contains more than one line you can still use this, since the likelyhood of breaking after exactly a newline is not that large. However if mind the fact
[18:16:21] NL3limin4t0r: that in a rare case a few lines could not be there you'll have to look for another aproach.
[18:21:19] NL3limin4t0r: I've to go, it's getting late.
[18:22:03] NL3limin4t0r: Quit: WeeChat 1.9.1

2018-09-14

[08:49:18] NL3limin4t0r: Otherwise an exception will be raised.
[08:49:23] NL3limin4t0r: >> module Sumable; def sum; inject(:+); end; end; class Foo; include Sumable; end; Foo.new.sum
[08:49:55] NL3limin4t0r: #=> NoMethodError: undefined method `inject' for #<Foo:0x00556e3c944238>
[08:50:40] NL3limin4t0r: ACTION sighs
[08:50:53] NL3limin4t0r: ruby[bot] has a lot of issues lately
[17:23:42] NL3limin4t0r: blood: Is log.txt created? If the file is made by you try to remove it and run the script again to ensure that it at least can locate/create the file.
[17:30:50] NL3limin4t0r: blood: Does your console command return when ran in a standard cmd terminal?
[17:40:05] NL3limin4t0r: blood: Hmm, that's strange. Are you sure you point to the right direction? You could test if using backticks instead of using Open3 helps.
[17:40:27] NL3limin4t0r: eg. result = `your cmd command here`
[17:41:10] NL3limin4t0r: You might need to escape backslashes
[17:47:22] NL3limin4t0r: blood: There is the "byebug" gem.
[17:48:02] NL3limin4t0r: Once installed you can place `byebug` in your file (after require 'byebug')
[17:48:13] NL3limin4t0r: Execution will stop on that line
[17:53:00] NL3limin4t0r: blood: Hmm, can't help you with the install. I'm currenty in my Ubuntu environment.
[17:55:00] NL3limin4t0r: blood: https://stackoverflow.com/questions/3955688/how-do-i-debug-ruby-scripts might be worth a look. I guess the main question now is why aren't shell commands not executing. It might be due to the fact that you are running ruby on windows tbh.
[17:55:54] NL3limin4t0r: I'm guessing the command is send to a mingw32 shell instead.
[18:10:43] NL3limin4t0r: I once read an article somewhere about this exact issue, comparing MRI and JRuby. However I currently can't seem to find it.
[18:11:36] NL3limin4t0r: Point is that the code breaks when running it in JRuby if you coun't on it being thread safe (which it obviously isn't).
[18:20:52] NL3limin4t0r: resnik2: This might be intresting https://dev.to/enether/rubys-gil-in-a-nutshell
[18:22:33] NL3limin4t0r: blood: You should be able to call `byebug` inside your script to set a breakpoint you can build ruby logic around it if you want `byebug if false` will never break your code.
[18:23:37] NL3limin4t0r: The most important commants are `c` to continue until the next break point, `n` to execute the next statement and `s` to step into a method of the current line.
[18:24:58] NL3limin4t0r: and obviously `exit` and `help`
[18:26:41] NL3limin4t0r: sure, create a gist or use https://dpaste.de/
[19:09:44] NL3limin4t0r: Quit: WeeChat 1.9.1

2018-09-13

[10:30:04] NL3limin4t0r: titon_: If you're running a development environment you're good to go with just puma. In production it's recommended to use a CDN or file server (like apache or nginx) to serve the assets.
[10:30:34] NL3limin4t0r: For detailed info have a look at: https://guides.rubyonrails.org/asset_pipeline.html#in-production
[10:34:05] NL3limin4t0r: titon_: If you have an API-only application you probably don't have any assets, thus no need to use a CDN or file server.
[14:09:22] NL3limin4t0r: sdegutis: http://ruby-doc.org/core-2.5.1/Enumerable.html#method-i-group_by
[14:10:31] NL3limin4t0r: Never mind, I thought you wanted to group.
[14:10:46] NL3limin4t0r: There is another method that does what you want.
[14:10:49] NL3limin4t0r: Give me a sec
[14:13:14] NL3limin4t0r: Seems like you just want to slice them in parts of 3.
[14:13:30] NL3limin4t0r: >> [0,1,2,3,4,5,6].each_slice(3)
[14:13:35] NL3limin4t0r: >> [0,1,2,3,4,5,6].each_slice(3).to_a
[14:16:19] NL3limin4t0r: >> (0..6).slice_before { |n| n % 3 == 0 }.to_a
[14:16:45] NL3limin4t0r: >> [0,1,2,3,4,5,6].slice_before { |n| n % 3 == 0 }.to_a
[14:17:13] NL3limin4t0r: http://ruby-doc.org/core-2.5.1/Enumerable.html#method-i-slice_before
[14:18:50] NL3limin4t0r: sdegutis: Does #slice_before fit your issue?
[14:22:25] NL3limin4t0r: #map followed by #flatten (flattens recursively) can often be replaced by #flat_map (flattens only one level)
[14:22:43] NL3limin4t0r: http://ruby-doc.org/core-2.5.1/Enumerable.html#method-i-flat_map
[14:30:17] NL3limin4t0r: So the this `.map { |e| some_method(e) }` can be replaced by `.map(&method(:some_method))`.
[14:30:26] NL3limin4t0r: I guess that's what you mean.
[14:31:51] NL3limin4t0r: You can also do that for instance methods if you ever need to.
[14:32:31] NL3limin4t0r: >> str = 'a'; %w[s d f a k e a].map(&str.method(:==))

2018-09-11

[08:54:33] NL3limin4t0r: Hey all, I'm trying to write a gem for Rails. (Don't worry this question is not specificly Rails related.) I want to prepend my module to an existing Rails module. This works fine, however the module is included before my gems prepends itself to that module. This in turn means that my prepended module is never called. What's the best way to resolve this? Should I just prepend the class that includes the module?
[08:54:35] NL3limin4t0r: Or is there some way to make an inclution more like a reference (adopting futere changes to the module)?
[08:54:44] NL3limin4t0r: Let me provide you with an easy example:
[08:55:07] NL3limin4t0r: >> module A; def hello; puts 'hello from a';
[08:55:26] NL3limin4t0r: ^ oops, wasn't done yet
[08:57:30] NL3limin4t0r: >> module A; def hello; puts 'hello from a'; end; end; class Foo; include A; end; module B; A.prepend self; def hello; super; puts 'hello from b'; end; end; Foo.new.hello
[08:58:51] NL3limin4t0r: ACTION pokes ruby[bot]
[09:00:32] NL3limin4t0r: #=> hello from a
[09:02:47] NL3limin4t0r: So this negates the prepended module, because A was included before B was prepended. If I were to reopen Foo and include A again the result would be: "hello from a\nhello from b"
[09:16:24] NL3limin4t0r: Formated example: https://dpaste.de/UREw
[09:59:14] NL3limin4t0r: mememeIAMME: Your if statement is incorrect. You currently have `if vowels.include? str[i] && i.odd?` This will first execute `str[i] && i.odd?` which has either `true` or `false` as result. Than checks if `vowels` include this result.
[09:59:24] NL3limin4t0r: This is always false
[09:59:47] NL3limin4t0r: The line should be `if vowels.include?(str[i]) && i.odd?`
[10:02:43] NL3limin4t0r: mememeIAMME: Your while isn't very ruby-ish. You can replace it with `str.each_char.with_index do |c, i|`
[10:06:09] NL3limin4t0r: mememeIAMME: see http://ruby-doc.org/core-2.5.1/String.html#method-i-each_char, http://ruby-doc.org/core-2.5.1/Enumerator.html#method-i-with_index
[10:07:59] NL3limin4t0r: It loops through all characters, `with_index` part adds the index to the loop starting from 0 by default.
[10:09:43] NL3limin4t0r: Is ruby[bot] up??
[10:10:28] NL3limin4t0r: mememeIAMME: yep
[10:12:13] NL3limin4t0r: pradhvan: in your question above you say that you've added the path to "bashrc" I guess you mean ".bachrc"
[10:13:04] NL3limin4t0r: have you already restarted the terminal, or sourced ".bashrc" from the terminal? Otherwise changes aren't in effect.
[10:14:23] NL3limin4t0r: pradhvan: yep, now I'm making typos myself xD
[10:20:25] NL3limin4t0r: The exports in my .bashrc do it in a single line and have quotes, I don't know if that makes a differance: `export PATH="$PATH:$HOME/.gem/ruby/2.5.0/bin"`
[11:22:53] NL3limin4t0r: Quit: WeeChat 1.9.1
[11:25:16] NL3limin4t0r: has joined #ruby
[11:25:23] NL3limin4t0r: has joined #RubyOnRails

2018-09-10

[15:10:12] NL3limin4t0r: has joined #ruby
[15:10:21] NL3limin4t0r: has joined #RubyOnRails

2018-09-07

[14:42:10] NL3limin4t0r: has joined #RubyOnRails
[15:04:49] NL3limin4t0r: has joined #ruby
[15:30:56] NL3limin4t0r: So I just ran into some anoying RoR logic. I have some incomming data from an external SOAP request and I'd like to use the included id as my own. This works fine for a single record (`Model.create(id: 123)`) but doesn't work when the attribute is nested using the `accept_nested_attributes_for` option. If I provide an id for one of the nested resources it raises an error that it can't be found.
[15:30:59] NL3limin4t0r: https://gist.github.com/3limin4t0r/8383e117700b1c60052737d12ba780d2
[15:31:39] NL3limin4t0r: Is there an easy way to create the nested resources with specified id?
[15:38:59] NL3limin4t0r: I guess I could manually build them, but that seems a bit cumbersome.
[15:42:41] NL3limin4t0r: eg. `Article.create(data.except(:times_attributes)) { |article| data[:times_attributes]&.each { |time_params| article.times.build(time_params) } }`
[17:30:55] NL3limin4t0r: I've got to go. I've created an Stack Overflow question (https://stackoverflow.com/q/52226760/3982562) for any late answers that might be coming in.
[17:31:47] NL3limin4t0r: Quit: WeeChat 1.9.1

2018-08-21

[08:33:09] NL3limin4t0r: Quit: WeeChat 1.9.1

2018-08-17

[17:25:29] NL3limin4t0r: has joined #RubyOnRails

2018-07-20

[10:42:51] NL3limin4t0r: has joined #ruby
[10:44:58] NL3limin4t0r: Hey. Is there an easy way to check if a class is an certain class or has an ancestor that is that class? For instances you have `#is_a?` but I'm looking for something that I can call upon the class itself. Let me provide an example:
[10:46:12] NL3limin4t0r: >> class Foo; end; class Bar < Foo; end; Bar.ancestors.select { |a| a.is_a?(Class) }.include?(Foo)
[10:46:36] NL3limin4t0r: But that seems a bit clumsy
[10:56:01] NL3limin4t0r: tbuehlmann: Ah, ty, I was looking for that can't believed I missed it.
[10:58:49] NL3limin4t0r: >> require 'net/http'; Net::HTTP.const_get('Post')
[10:59:25] NL3limin4t0r: koichirose: ^ however it might be a good idea to whitelist if you use user input
[11:02:41] NL3limin4t0r: It results in an exception if the constant is not present. You can check the presence with `#const_defined?`.
[11:03:02] NL3limin4t0r: See: http://ruby-doc.org/core-2.5.1/Module.html#method-i-const_get and http://ruby-doc.org/core-2.5.1/Module.html#method-i-const_defined-3F
[14:23:06] NL3limin4t0r: Quit: WeeChat 1.9.1

2018-07-13

[08:32:02] NL3limin4t0r: has joined #ruby
[09:27:11] NL3limin4t0r: >> fn = ->(a) { ->(b) { a + b } }; fn[5][7]
[09:27:31] NL3limin4t0r: Alec: You could just use curry for that
[09:28:16] NL3limin4t0r: >> fn ->(a, b) { a + b }.curry; fn[5][7]
[09:28:27] NL3limin4t0r: >> fn = ->(a, b) { a + b }.curry; fn[5][7]

2018-07-12

[13:03:16] NL3limin4t0r: has joined #ruby
[13:11:40] NL3limin4t0r: Quit: WeeChat 1.9.1

2018-07-10

[09:37:42] NL3limin4t0r: has joined #ruby
[17:10:42] NL3limin4t0r: Quit: WeeChat 1.9.1

2018-07-06

[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: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: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:28:16] NL3limin4t0r: Have you tried a different shell?
[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.
[19:28:01] NL3limin4t0r: Quit: WeeChat 1.9.1

2018-07-05

[08:50:24] NL3limin4t0r: has joined #ruby
[08:50:34] NL3limin4t0r: has joined #RubyOnRails
[11:30:21] NL3limin4t0r: drale2k_: Do the same thing as you did when creating the user/posts but instead send it to `PATCH /users/:id` instead of `POST /users` make sure the post id is a permitted param, otherwise new posts will be created.
[11:37:59] NL3limin4t0r: If you use the `form_for @user` helper or `form_with model: @user` in rails 5.2 the path should be set corrently. When using the `fields_for :posts, @user.posts` helper the id is automaticaly set as an hidden field.
[11:38:56] NL3limin4t0r: Than you should pass the id yourself.
[11:40:41] NL3limin4t0r: Yep, if an id is not present than it's not created yet. Therefore it's seen as a new resource.
[11:44:14] NL3limin4t0r: In addition, if you haven't whitelisted the id then it is stripped away after permitting the values, therefor also creating new posts. But you already got that covered.
[12:06:37] NL3limin4t0r: drale2k_: Load the ids based on the provided serial numbers.
[12:08:23] NL3limin4t0r: yep, https://pastebin.com/Qv8VkLFk
[12:09:18] NL3limin4t0r: oops, I made a typo `.map { |post_attributes| post_attributes[:id] }` should be `.map { |post_attributes| post_attributes[:serial_number] }`
[12:10:48] NL3limin4t0r: The other option using the serial number as id instead.
[12:12:26] NL3limin4t0r: But that might be a bit harder to do since it goes against the convention
[12:12:40] NL3limin4t0r: a quick google search give me this article http://ruby-journal.com/how-to-override-default-primary-key-id-in-rails/
[12:13:11] NL3limin4t0r: but you might want to find some better resources on that
[12:14:36] NL3limin4t0r: Keep in mind that incomming params are normaly strings. If your serial number is not a string you might want to `posts_attributes[:serial_number].to_i`.
[12:15:59] NL3limin4t0r: but you'll get the picture
[12:24:47] NL3limin4t0r: drale2k_: https://pastebin.com/XPrshVMB
[12:27:20] NL3limin4t0r: Alternatively you could use `find_by(serial_number: posts_attributes[:serial_number]).id` but than a query is executed for every given serial number.
[12:33:38] NL3limin4t0r: drale2k_: I made the last loop a bit more clear: https://pastebin.com/nGcPtKdL hope it's understandable now.
[12:57:44] NL3limin4t0r: Burgestrand: use flat_map instead, it has a performance advantage over .map.flatten(1)
[12:58:02] NL3limin4t0r: >> [[1,[2,3,4]],[5,[6,7,9]]].flat_map { |(a, b)| [a].product(b) }
[13:01:40] NL3limin4t0r: Bish: Look at my comment above.
[19:39:29] NL3limin4t0r: bsamorim: https://www.ruby-lang.org/en/downloads/ "Here you can get the latest Ruby distributions in your favorite flavor. The current stable version is 2.5.1."
[19:52:25] NL3limin4t0r: AndroidKitKat: I'm a bit late to the party, but you can see hashes basicly as arrays with named indexes. In other languages you encounter them under the name "HashMap" or "Dict" (Dictionary).
[19:53:41] NL3limin4t0r: Although they are a pair you can request an array of only the keys, or only the values. Which you are doing on line 3. By calling `books.values`
[19:53:55] NL3limin4t0r: Than you loop through the array by calling `.each`
[19:54:55] NL3limin4t0r: AndroidKitKat: I don't know how new you are to programming but the `ratings[rate] += 1` is a shortcut for `ratings[rate] = ratings[rate] + 1`.
[19:58:08] NL3limin4t0r: If you have questions about certain classes or methods you find almost everyting explained at http://ruby-doc.org/core-2.5.1/
[19:59:02] NL3limin4t0r: AndroidKitKat: If you don't know where to look you can just ask ruby. For example:
[19:59:39] NL3limin4t0r: >> books = {}; books.method(:values)
[20:00:10] NL3limin4t0r: >> books = {}; books.values.method(:each)
[20:01:10] NL3limin4t0r: zenspider: But you first have to understand what value you call something on, otherwise you don't know where to look.
[20:03:04] NL3limin4t0r: zenspider: It outputs the class and method name.

2018-06-26

[08:07:06] NL3limin4t0r: Quit: WeeChat 1.9.1

2018-06-22

[09:49:53] NL3limin4t0r: has joined #ruby
[09:49:59] NL3limin4t0r: has joined #RubyOnRails
[12:48:45] NL3limin4t0r: nemesit: Try something like this: `validates(*attribute_names, presence: true)`
[12:53:41] NL3limin4t0r: Does anybody know if the delayed_job gem supports blocks/lambda's/procs. Creating the `def self.method(id); find(id).method; end` helpers is quite tiring and clutters the class namespace more than needed.
[12:54:36] NL3limin4t0r: I was looking for something like `delay { |id| SomeClass.find(id).method }.call(1)`
[12:57:49] NL3limin4t0r: Than execute the block by the delayed worker, thus far I'm not able to find any support for delayed blocks, procs or lambda's.
[16:43:12] NL3limin4t0r: For those interested in my delayed job problem, I solved my issue with a small helper. It still doesn't support blocks or lambda's, but follows the public_send design, sending both the method and the arguments. This makes it easier to call delayed methods on instances without serializing the full object. https://gist.github.com/3limin4t0r/0f3ec6cbe59d608a17c26aee015cb685

2018-06-18

[07:58:34] NL3limin4t0r: has joined #ruby
[07:58:42] NL3limin4t0r: has joined #RubyOnRails
[17:26:31] NL3limin4t0r: Quit: WeeChat 1.9.1

2018-06-15

[09:22:56] NL3limin4t0r: In rails 3 assets where undigested and the digestion was given as a path argument.
[09:23:30] NL3limin4t0r: eg. `/stylesheets/global.css?1309495796` (old)
[09:32:41] NL3limin4t0r: I guess just putting the assets in the public folder seems my best option, I can't seem to find an config.assets option that exclude files from digestion.
[09:37:20] NL3limin4t0r: zmo: You can query the migration model just like any other rails model. `if SchemaMigration.where(version: 20180615113713).any?`
[09:38:48] NL3limin4t0r: where the version is the number before the name of the migration that has to be present.
[09:47:49] NL3limin4t0r: I think I might have found something for my problem. I might be able to create an new preprocessor for specific files and set the digest option to false for that specific preprocessor.
[09:47:53] NL3limin4t0r: https://github.com/rails/sprockets/blob/master/guides/how_sprockets_works.md#creating-new-directives
[09:49:53] NL3limin4t0r: Or alternatively don't pull, but push the change with ActionCable.
[09:50:10] NL3limin4t0r: That might be harder to setup though.
[12:04:09] NL3limin4t0r: Is there a way to get a copy of an already loaded ActiveRecord::Base instance, without creating a new record? #dup does create a new record and #clone doesn't allow you to alter attributes without effecting the originals object attributes. This would leaves me with `some_object_copy = SomeObject.find(some_object.id)`
[12:04:50] NL3limin4t0r: But it seems that query shouldn't be needed.
[12:36:25] NL3limin4t0r: blackcross: Yeah, but than I have a new record. The of what I'm trying to do is to have the original object and a copy of the object next to eachother. The copy has some changed attributes that are presented to the user. After the user accepts the changes the copy has to be saved under the same id as the origianl object.
[12:38:47] NL3limin4t0r: both objects are presented to the user* with left the original and right the altered copy.
[15:22:29] NL3limin4t0r: drale2k_: One option is to create a model for Username and have User has_many :usernames than mark their active username or fetch the latest creation date.
[15:23:41] NL3limin4t0r: If you wan't to save an array you should serialize the column, have a look at: http://api.rubyonrails.org/classes/ActiveRecord/AttributeMethods/Serialization/ClassMethods.html#method-i-serialize
[15:26:22] NL3limin4t0r: Although, you might get in trouble if you try to save a large array that doesn't fit (serialized) in the database field.
[15:27:29] NL3limin4t0r: sinjin1985: Have a look at https://stackoverflow.com/q/17311199/3982562
[16:15:22] NL3limin4t0r: timdotrb: I guess you already use the `stylesheet_link_tag` and not try to link to your stylesheet manually.
[16:19:21] NL3limin4t0r: timdotrb: Have you tried clearing old assets rebuilding the newest onces (on the Heroku server)?
[16:20:10] NL3limin4t0r: I'm not familiar with Heroku, but checkout out the assets commando's by executing `rake -T`
[16:21:20] NL3limin4t0r: or if you don't want the junk `rake -T | grep rake assets`
[16:23:47] NL3limin4t0r: If you can reproduce it, you should check the request send by the webbrowser and validate that it's correct.
[16:25:21] NL3limin4t0r: mehh, srry I think I can't help you than.
[16:27:49] NL3limin4t0r: blackcross: I found a solution to my problem btw. `some_object_copy = SomeObject.instantiate(some_object.attributes)` creates a clone without linking the attributes of the two objects together like #clone does and without querying the database.
[16:28:50] NL3limin4t0r: yep, but that creates a new record
[16:29:27] NL3limin4t0r: I want to keep the same record, but just have a copy of the object including a copy of the attributes.
[16:30:34] NL3limin4t0r: `obj_copy = obj.clone` creates a new object, but if you change an obj_clone attribute it's also changed in obj
[17:10:01] NL3limin4t0r: timdotrb: I created an stackoverflow issue if you want to checkout what my problem is in more detail, what my problem with #dup and #clone is and what my current solution is.
[17:10:04] NL3limin4t0r: https://stackoverflow.com/q/50879944/3982562
[17:26:25] NL3limin4t0r: Quit: WeeChat 1.9.1