Activity Graph

Page 1 of 2 | Next »


[16:13:04] machinewar: has joined #RubyOnRails
[16:13:16] machinewar: is there any way to change the join model used by a has_many through at runtime
[16:13:39] machinewar: so I want to pretty much check a column value and if its true use one join model and if its false use another join model


[16:16:17] machinewar: has joined #RubyOnRails
[16:17:22] machinewar: why would same ruby version (2.5.1) have different results for "irb" v. "rails console" Rack::Utils.escape_path(":"). rails console URL escapes the value while irb doesnt. Does rails monkey patch rack::utils?
[16:19:31] machinewar: or more likely my ruby installed version is different than my rails projects.....
[16:40:01] machinewar: Ping timeout: 260 seconds


[04:33:33] machinewar: has joined #RubyOnRails
[04:34:20] machinewar: if I have a JS library that is loading files with paths like /js/myfile.js the asset pipeline breaks all of this when precompiled. Is there a way to just skip asset pipeline precompilation and have those files served separately


[20:22:32] machinewar: has joined #ruby
[20:22:42] machinewar: anyone know what the FI is on the end of this unicode code point? \u0000FI
[20:35:49] machinewar: yes it just prints FI because its not part of the codeponit
[20:35:51] machinewar: I'm getting this value from Redis
[20:35:56] machinewar: I wonder if redis has a custom encoding?


[15:46:55] machinewar: has joined #RubyOnRails


[15:46:18] machinewar: has joined #ruby
[15:47:01] machinewar: anyone very familiar with RSpec. I have a describe SomeNamespace::SomeClass do... the weird thing is that the class is not namespaced, but this spec does not break.....


[04:28:10] machinewar: has joined #ruby
[04:28:57] machinewar: has joined #RubyOnRails
[04:57:33] machinewar: Remote host closed the connection


[00:35:09] machinewar: Remote host closed the connection


[23:46:38] machinewar: has joined #RubyOnRails
[23:47:20] machinewar: for encrypted credentials in Rails 5.2 does that mean we no longer store these values in ENV variables? Will you need to redeploy every time you want to update one?


[14:36:06] machinewar: has joined #ruby


[04:39:51] machinewar: has joined #RubyOnRails
[04:40:16] machinewar: is there any way in Rails 5.1 to set cache-control no-store?
[04:40:23] machinewar: it keeps setting it to cache-control no-cache, but I need no-store
[04:42:17] machinewar: could this be turbolinks thing
[04:53:38] machinewar: looks like it works with response.set_header("Cache-Control", "no-store")
[04:53:48] machinewar: Radar: beacause I want the browser to request my image every time
[04:54:34] machinewar: Radar: yeah I tried that but it was setting no-cache
[04:56:52] machinewar: Radar: this works response.set_header("Cache-Control", "no-store") in Rails 5.1
[05:05:51] machinewar: hmm so this is just general web dev question and prob not best channel, but anyone know how to make sure browser doesn't cache a content-url downloaded via a css :hover for example
[06:19:18] machinewar: Remote host closed the connection


[21:43:52] machinewar: has joined #ruby
[21:44:05] machinewar: is there any way to get all the constants referenced in a .rb file?
[21:44:33] machinewar: other than regex for all words that look like constants and checking if const_defined?
[21:55:12] machinewar: bawNg: ah interesting. (I'm pretty much just wishing for a compiler here haha), but I want to make sure that before I execute a ruby file that any constant or class name exists. even if that classname or constant is referenced in a method in the file
[21:56:59] machinewar: havenwood: woah really cool idea I haven't dig into Ripper too much but seems really cool - just what I'm looking for
[21:57:58] machinewar: but ripper would make it simpler
[22:04:30] machinewar: haha awesome thank you


[13:53:31] machinewar: has joined #ruby
[13:57:11] machinewar: has joined #RubyOnRails
[13:57:44] machinewar: getting a template error when rendering an email template from within a mailer action. it works in rails console, but not on server. any ideas?
[13:57:51] machinewar: It must be that something isn't loaded
[14:26:37] machinewar: Remote host closed the connection
[14:56:56] machinewar: has joined #RubyOnRails
[19:15:08] machinewar: has joined #ruby


[16:47:29] machinewar: has joined #ruby


[20:41:45] machinewar: has joined #ruby
[21:21:21] machinewar: Algebr`: a gem is a Ruby library, rake is a build tool - think command line scripts in Ruby, bundler is for managing Ruby libraries (gems)
[21:40:13] machinewar: if you don't have a gemfile you can gem install libraries
[21:41:06] machinewar: for example if you just want to play around with some library
[21:41:39] machinewar: most Ruby projects will use a Gemfile + bundler though because then if I want to work on your project, I just git clone it, and run bundle install


[17:13:26] machinewar: has joined #ruby


[20:14:39] machinewar: has joined #ruby


[17:18:10] machinewar: has joined #RubyOnRails
[17:18:22] machinewar: when I run bundle show rails, how can I can only see the guides and readme in that directory?
[17:18:27] machinewar: where is rails actually installed locally?
[17:22:16] machinewar: has joined #ruby


[17:42:31] machinewar: has joined #ruby
[17:43:59] machinewar: has left #ruby: ()


[17:32:52] machinewar: has joined #ruby


[21:41:19] machinewar: has joined #RubyOnRails
[21:41:35] machinewar: any way to turn off a validation for a specific model instance


[17:21:26] machinewar: has joined #ruby


[17:48:18] machinewar: has joined #ruby


[19:55:16] machinewar: has joined #ruby


[17:58:38] machinewar: has joined #ruby
[18:22:41] machinewar: has left #ruby: ()


[19:04:48] machinewar: has joined #ruby
[21:17:28] machinewar: Read error: Connection reset by peer


[19:43:07] machinewar: has joined #ruby


[15:03:42] machinewar: has joined #ruby
[15:04:14] machinewar: does rake have command line flags?
[15:04:18] machinewar: i.e. rake something -e
[15:04:30] machinewar: I'm writing a rake task with custom arguments via flags, but looks like some might be reserved?
[15:04:50] machinewar: i.e. if I use -e i get weird rake error, but with any other flags it works
[15:06:04] machinewar: ljarvis: okay thanks, I was using option_parser to parse them
[15:41:59] machinewar: Ping timeout: 250 seconds


[02:28:59] machinewar: has joined #RubyOnRails
[02:29:24] machinewar: I built a custom Rack Middleware that I mounted via mount: in routes.rb. Any idea why it would display the Rack::Builder object when I run rake routes
[02:30:30] machinewar: its not breaking anything, just strange
[03:11:33] machinewar: how can I view documentation or source for rails rake commands?
[04:19:27] machinewar: Ping timeout: 250 seconds
[10:52:50] machinewar: has joined #ruby


[18:37:03] machinewar: has joined #RubyOnRails
[18:37:21] machinewar: is there a way to cal .save and explicitly not update some columns
[18:37:35] machinewar: like lock those columns on an object
[18:39:55] machinewar: Remote host closed the connection


[12:27:26] machinewar: has joined #RubyOnRails
[12:27:59] machinewar: how can Rack middleware be used to modify request before your Rack app is called? I understand using Rack::Builder to modify response, but can't find docs on modifying requet
[12:29:34] machinewar: Oh so do use A; use B; run App; use C end
[12:33:57] machinewar: format needs :
[12:34:03] machinewar: its a key not a function
[12:34:28] machinewar: roelof: format: :json
[12:45:46] machinewar: dminuoso: I mean is there a way to intercept the environment after my Rack app's call method has been executed to modify response on way back to the web server, I can only seem to modify thing before my Rack App's call method is called
[21:19:58] machinewar: has joined #RubyOnRails
[21:20:12] machinewar: how can I use ActiveRecords #joins to do a left join with a parameter for filtering
[21:20:31] machinewar: Model.joins("LEFT JOIN table on table.attr = ?", param)
[21:20:43] machinewar: I want to do something like that but doesnt look like it takes 2 arguments
[21:21:40] machinewar: I have a value I want to interpolate
[21:22:14] machinewar: tubbo: its more of a ("LEFT JOIN table on attr in ?")
[21:22:28] machinewar: where that paramter is an array of ids
[21:23:28] machinewar: tubbo: I understand that
[21:24:27] machinewar: tubbo: I want to filter in the join and not after the fact
[21:24:40] machinewar: the where works, but its super inefficient for what I'm doing
[21:32:32] machinewar: matthewd: thanks
[21:36:43] machinewar: matthewd: oh interesting, cool to know


[13:58:05] machinewar: has joined #RubyOnRails
[13:58:57] machinewar: I know Rails caches queries for single requests, but will it cache first parts of queries that are then built on...... user.friends and then user.friends.some_other_query
[13:59:04] machinewar: will that execute user.friends twice
[14:01:37] machinewar: Scient: okay thanks! and getting a bit more specific, (might be too specific), but what about using pagination with kaminari.... and then
[14:02:40] machinewar: Scient: or do you know if theres method to check if a query is being read from cache v. going to the db
[14:08:36] machinewar: matthewd: not sure, possibly
[14:13:50] machinewar: matthewd: correct, thanks!


[20:18:49] machinewar: has joined #ruby
[21:20:52] machinewar: Remote host closed the connection


[13:37:21] machinewar: has joined #ruby


[22:23:03] machinewar: has joined #ruby
[22:23:21] machinewar: anyone know what Rack#BodyProxy class is used for?


[13:38:21] machinewar: has joined #RubyOnRails
[13:40:00] machinewar: is anyone familiar with Memcached + Rails. Trying to find a way to access the configured URL at runtime
[13:40:37] machinewar: Thinking of something like this but not sure Rails.application.config.cache_store.some_attribute or method
[13:46:18] machinewar: Remote host closed the connection
[20:21:57] machinewar: has joined #RubyOnRails
[20:22:35] machinewar: if I build a gem, is there a way to check if someone is using it with Rails v. in just a normal ruby script. i..e if Rails.exists?
[20:23:22] machinewar: adam12: that seems pretty nice
[20:28:54] machinewar: matthewd: can you explain, thanks
[20:29:30] machinewar: ah that's true
[20:30:23] machinewar: matthewd: the exact use case is that if the gem is used in Rails I want to access the Rails.cache, otherwise the user has to specify a different configuration
[20:30:42] machinewar: or if you know if I can access memcached in Rails explicitly without Rails.cache
[20:30:50] machinewar: i.e. with something like Dalli
[20:31:17] machinewar: like get the address, port its running on (which should be known by some object
[20:32:45] machinewar: matthewd: yea I was looking through some gems and it seems pretty common, but totally get the possible issues thanks for the heads up
[20:35:43] machinewar: yea guess simplest way would just to be to check that the classes I'm looking for are defined if defined?(Rails) && Rails.respond_to?(:cache) && defined?(Rails::Cache)
[20:38:35] machinewar: matthewd: you're right


[20:41:14] machinewar: has joined #ruby
[20:41:38] machinewar: I get the whole ampersand to_proc stuff except the call part, does map send #call to procs?
[20:41:44] machinewar: [1,2,3].map(&:upcase)
[20:41:49] machinewar: what actaully sends call to the proc?
[20:43:34] machinewar: so upcase is calling the block? I think I'm just confused because it seems implicit
[20:43:40] machinewar: I mean calling the Proc
[20:44:22] machinewar: i..e why doesn't [1,2,3,4,].map(some_proc) return [,,, etc.]
[20:44:46] machinewar: its realling returning [,]
[20:45:32] machinewar: so map is calling it
[20:45:45] machinewar: damn totally makes sense now
[20:59:11] machinewar: workmad3: definitely just meant to show its an instance of Proc, which is was some_proc would be
[20:59:19] machinewar: but totally get what you're saying
[21:34:04] machinewar: Remote host closed the connection


[03:49:57] machinewar: has joined #ruby
[03:50:15] machinewar: anyone have idea why minitest doesn't work in tests on rails 3.2
[03:50:25] machinewar: but works with > 3.2?
[04:12:33] machinewar: has joined #RubyOnRails
[04:12:57] machinewar: anyone know why I can't load minitest in rails 3.2 but it works in > 4.0
[04:13:08] machinewar: I can't load minitest/test
[14:55:43] machinewar: has joined #RubyOnRails
[14:56:06] machinewar: what version of rails was minitest added as a dependency to rails?
[14:57:31] machinewar: has joined #ruby
[14:57:43] machinewar: anyone know what version of rails minitest was added as dependency over test unit?
[15:06:56] machinewar: Remote host closed the connection


[01:18:49] machinewar: has joined #ruby
[01:19:04] machinewar: if i include a module in a class how can I have those methods be defined after the methods in the class its included in?
[01:19:09] machinewar: it seems to define them above the other methods
[02:45:21] machinewar: nofxx: thanks
[02:45:40] machinewar: anyone used Rake::TestTask to include tests with pattern _test.rb and the test_helper.rb
[02:46:02] machinewar: hard since have different patterns and expect to give pattern of file to load with patterns
[21:51:39] machinewar: has joined #ruby
[21:52:27] machinewar: so I have a class that is expected to respond to a method and I want to run the code in that method when its called (which sets instance variables) and then run method by same name in an included module with logic that depends on those instance variables being set
[21:52:29] machinewar: is this possible?
[21:53:36] machinewar:
[21:53:39] machinewar: here's an example of what I'd like
[21:57:11] machinewar: I can still call super and it will call the included modules method
[21:57:22] machinewar: but I'm wondering if there's a *smarter* way to do this somehow from within the module
[21:57:36] machinewar: having it call something on the class (i.e. some way to open up a classes method and add to it)
[22:01:40] machinewar: jhass: thanks! am currently using prepend actually and was curious if another way
[22:02:05] machinewar: jhass: that's fine I actually want the class to implement the setup and then have it run the module method which assumes some instance vars were initialized
[22:02:36] machinewar: and prepend works since it hides the super from the class which is something I liked, just looks cleaner


[17:40:19] machinewar: has joined #ruby
[17:40:29] machinewar: anyone know if can create Tempfile where uniq_id is only integers?
[17:41:20] machinewar: or if maybe it does only use numbers?


[18:07:02] machinewar: has joined #ruby
[18:07:29] machinewar: is it possible to connet to sftp w/ ruby's FTP module and not using sftp gem
[18:08:04] machinewar: maybe with net::SSH?
[18:08:45] machinewar: jhass: ah alright that's where I was confused thanks, any relatively simple way to do it with standard library
[18:09:16] machinewar: jhass: kk thanks
[18:10:24] machinewar: jhass: lol not exactly


[12:09:24] machinewar: has joined #ruby
[12:10:54] machinewar: anyone know of convention for setting up mini-test in a ruby gem project? i.e. so that all of my classes are when tests run? Do I need to make a spec_helper and add to LOAD_PATH? or do you explicitly require the classes in your specs?
[12:12:38] machinewar: RazorX: you can use const_set(constant_name, val)
[12:13:14] machinewar: if you have instance of the class then you'd do obj =; obj.class.const_set("MY_CONST", "value")
[12:13:42] machinewar: raz: ^ sorry tagged someone else
[12:14:25] machinewar: raz: then you can do stuff like obj.class::MY_CONST
[12:16:46] machinewar: raz: you don't need the .new on line 9 you already have an instance
[12:16:50] machinewar: since you called .new on line 1
[12:17:01] machinewar: klass.class.const_set 'MY_CONST',
[12:19:54] machinewar: raz: you need to not make an instance on first line and instead open up the class
[12:20:05] machinewar: class Class def hello puts MY_CONST end end
[12:20:25] machinewar: klass = Class.const_set("MY_CONST", "val")
[12:20:35] machinewar:
[12:20:37] machinewar: that works for me
[12:21:12] machinewar: yes constants are defined on a class level


[22:22:40] machinewar: I know the previous app does in the initialize and call returns an arrray not the env hash?
[22:24:58] machinewar: cnk: hm that's what I would think but all I see a rack app returning is the array [status, headers, body]
[22:25:08] machinewar: and don't see how the env hash gets passed i.e. in Rack::Builder
[22:28:54] machinewar: cnk: so you're saying that Rack Middleware call method should only return the env and the last middleware you use should return the status headers and body?
[22:31:23] machinewar: cnk: awesome thanks
[22:33:51] machinewar: cnk: totally, what doesn't make sense to me is that middleware returns the triple, but call gets passed the env hash. Is the env hash global and you're just mutating it on the way down the middleware stack?
[22:35:11] machinewar: cnk: thanks. and it is implictly passed by rack right?