Activity Graph

Page 1 of 2 | Next »


[16:24:07] Net: has joined #RubyOnRails
[16:24:11] Net: is it possible to control the render search paths when using render_to_string in an actionmailer?


[08:42:42] Net: *.net *.split
[08:47:56] Net: has joined #elixir-lang
[08:47:57] Net: has joined #ruby
[08:47:58] Net: has joined #elixir-lang
[08:47:58] Net: has joined #ruby
[08:47:58] Net: Changing host


[03:12:45] Net: *.net *.split
[03:18:05] Net: has joined #elixir-lang
[03:18:06] Net: has joined #ruby
[03:18:08] Net: has joined #elixir-lang
[03:18:08] Net: has joined #ruby
[03:18:08] Net: Changing host


[19:23:23] Net: classes I'm monkey patching in an initializer seem to get reset for requests. Why might this be?


[17:07:15] Net: has joined #RubyOnRails
[17:07:38] Net: how do you handle where clauses for tables that are joined more than once
[17:10:32] Net: e.g. company.joins(users: :posts, admins: :posts).where(user_posts: {category: 'foo'}).or(where(admin_posts: {category: 'bar'}))
[17:10:37] Net: obviously, this doesn't work
[17:22:00] Net: seems rails generates some insane alias names
[17:22:07] Net: the question is: are they guaranteed?
[20:48:57] Net: anyone know why my model objects are getting reloaded after calling visit in a capybara spec?


[06:50:39] Net: *.net *.split
[07:16:18] Net: has joined #RubyOnRails
[07:16:22] Net: has joined #elixir-lang
[07:16:23] Net: has joined #ruby
[08:26:27] Net: *.net *.split
[08:36:44] Net: has joined #elixir-lang
[08:36:46] Net: has joined #ruby


[20:12:12] Net: can around/before/after_action be inherited?
[20:38:19] Net: answer: yes


[17:27:26] Net: how do you feel about classes that include many modules resulting in a large public api?
[17:28:25] Net: my problem with them is that it makes it hard to locate the source of a given method as you can't simply open the class and search for the method
[17:29:04] Net: and I'm wondering if this is valid criticism
[18:19:25] Net: NL3limin4t0r: thanks, that's great
[18:21:13] Net: as a more general question: what do you think of modules that are written to be included in a single class for the purpose of breaking a long class file into several files?
[18:21:37] Net: (not to write DRYer code)
[19:21:34] Net: NL3limin4t0r: arguably this pattern does not provide much over simply organizing code into sections in the main class
[19:22:13] Net: add code folding and it seems to be almost the same


[06:08:05] Net: *.net *.split
[06:18:25] Net: has joined #RubyOnRails
[06:18:30] Net: has joined #ruby
[06:18:30] Net: has joined #elixir-lang


[15:33:43] Net: any idea why setting config.force_ssl = true would cause this error in url helpers?
[15:33:44] Net: ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true
[15:38:20] Net: NL3limin4t0r: yeah
[15:38:38] Net: the curious part is I don't seem to need to set host without config.force_ssl = true
[15:44:00] Net: is it okay to set Rails.application.routes.default_url_options[:host] = _ in config/environement/production.rb?
[15:54:00] Net: NL3limin4t0r: thanks, should I put it outside the Rails.application.config block?
[15:54:07] Net: er, Rails.application.configure
[15:57:53] Net: even though it doesn't call #config?
[15:57:54] Net: thanks!
[15:59:48] Net: cool, thanks


[17:53:43] Net: can I set code to be run on rails c without using pryrc?


[03:19:36] Net: Read error: Connection reset by peer
[03:19:49] Net: has joined #ruby
[03:19:49] Net: has joined #elixir-lang
[03:19:49] Net: has joined #RubyOnRails


[18:03:15] Net: can I schedule an activejob for a time in the future?


[17:23:21] Net: A common pattern I encounter is writing a class with only one public method so that instance variables can be shared amongst its private methods. Is there a superior way of handling such cases?
[17:36:12] Net: psql -d <your_db_name>
[17:38:22] Net: wrkrcoop: I would do id, user_id, but it doesn't really matter
[18:04:51] Net: wrkrcoop: #RubyOnRails :)
[18:04:59] Net: oh, you found it
[18:05:12] Net: not sure what you mean by that
[18:07:04] Net: I'd expect it to handle a string fine
[18:07:07] Net: as long as the string is a uuid


[17:43:11] Net: Is there a more idiomatic equivalent to the Model.where('false') in `model = Model.where('false'); clauses.reduce(model) { |memo, clause| memo.or(Model.where(clause)) }`?
[21:08:27] Net: hahuang65: I'm dynamically concatenating OR clauses


[17:40:02] Net: how do I express this in activerecord? foo = $1 AND (bar = $2 OR baz = $3)
[17:42:30] Net: NL3limin4t0r: I see, there's an implicit parenthesis around each call?
[17:44:16] Net: Thank you!
[17:45:39] Net: how about @company.where(bar: $2).or(Model.where(baz: $3))? Will the @company clause be ANDed with both ORs or just the first?
[17:48:01] Net: I must say, I think this would be a lot cleaner with a .and and block arguments where self is the query
[17:51:20] Net: makes sense
[17:55:12] Net: interesting
[17:57:38] Net: that's nicer
[17:59:02] Net: I think I prefer that over the implicit parens


[21:46:38] Net: What's the idiomatic way to return the status of a method call?
[21:46:58] Net: e.g. :email_sent, :email_blocked, :no_connection, etc.


[07:47:51] Net: *.net *.split
[07:52:44] Net: has joined #RubyOnRails
[07:52:49] Net: has joined #elixir-lang
[07:52:50] Net: has joined #ruby
[12:48:52] Net: Ping timeout: 252 seconds
[12:53:22] Net: has joined #ruby
[12:53:22] Net: has joined #elixir-lang
[12:53:22] Net: has joined #RubyOnRails


[06:45:43] Net: How should I handle creating private helper methods in a subclass that don't override private methods of the same name in the parent class?
[07:04:42] Net: phaul: I have running into naming collisions with a subclass' parent
[07:04:46] Net: *I am running into
[07:05:27] Net: where the parent has some private methods defined with a common name
[07:05:49] Net: I could just name the subclass's methods something else
[07:05:54] Net: but the parent class has a lot of methods
[07:06:07] Net: and I would rather just have a more reliable solution
[07:06:15] Net: to what seems like should be a fairly common problem
[07:07:21] Net: phaul: agreed
[07:07:56] Net: phaul: unfortunately, "good design" is not the description I would use for this project :)
[07:18:06] Net: phaul: thanks!
[07:18:40] Net: phaul: what do you think of just prefixing method names?
[07:19:54] Net: I can imagine why
[07:19:56] Net: thank you'


[16:19:12] Net: Ping timeout: 248 seconds


[07:38:45] Net: Ping timeout: 252 seconds
[07:43:13] Net: has joined #ruby
[07:43:13] Net: has joined #elixir-lang
[07:43:13] Net: has joined #RubyOnRails
[08:04:36] Net: Ping timeout: 252 seconds
[08:09:31] Net: has joined #ruby
[08:09:31] Net: has joined #elixir-lang
[08:09:31] Net: has joined #RubyOnRails


[21:53:13] Net: anyone use interactor?


[16:03:04] Net: Is there a stdlib method that will get a value from a hash by key, or, if not value exists, will set the value using a block then return it?
[16:03:48] Net: basically I want foo[bar] ||= baz(...) but respecting `false`


[14:23:35] Net: has left #RubyOnRails: ()
[14:31:21] Net: has joined #RubyOnRails


[15:45:23] Net: I've refactored some code to make a few database queries in parallel via Threads. All our test are run in transactions, so this breaks some existing tests. What is my best option for resolving this?
[15:49:23] Net: lupine: I wish we could upgrade to the latest right now, but that will take some time
[15:50:25] Net: the only native way to handle this is to perform the cleanup manually?
[15:51:44] Net: Ah, yes we are
[15:51:55] Net: can I do that per test file?
[15:53:31] Net: You work on gitlab?


[02:57:20] Net: is it possible to write a custom join clause for a has_many association?
[02:58:21] Net: specifically, I want to have `has_many :bars, -> { where(' = ANY (foo.bar_ids)') }`


[20:58:21] Net: Ping timeout: 252 seconds
[21:08:30] Net: has joined #ruby
[21:08:30] Net: has joined #elixir-lang
[21:08:30] Net: has joined #RubyOnRails


[00:56:05] Net: Is there a better way to write `@users[@users.index { |u| == id }] = user`?
[01:02:09] Net: adam12: you're wondering if @users should be a hash?
[01:03:37] Net: adam12: it's not, I'm just lazy. It'll get refactored to a hash later
[01:04:07] Net: my question was solely if there was a better way to update an element on an array based on a condition
[01:04:50] Net: trying to familiarize myself with the stdlib :)
[01:05:53] Net: thanks!
[01:06:59] Net: havenwood: no dupes
[01:08:32] Net: interesting. in this case it's just a hacky way to update some json in redis until I move this data into postgres, but I'll keep that in mind
[01:10:08] Net: Any recommended books or articles for learning ruby and RoR?
[01:10:42] Net: I've worked with both years ago, but I could use some reading to brush up—I don't remember much.
[01:11:21] Net: Really I just want to get a feel for common idioms and more advanced concepts
[01:12:19] Net: and where might I find nicely written Ruby code? :)
[01:15:32] Net: I've got The Well Grounded Rubyest 3rd ed. on Kindle, What's Kestrels, Quirky Birds, and Hopeless Egocentricity about?
[01:16:04] Net: Looks like haskell in ruby
[01:16:29] Net: any specific GitHub projects?
[01:18:08] Net: Do I need to learn Japanese?
[01:19:18] Net: Worth watching past RubyKaigi talks?
[01:19:23] Net: thanks!
[01:20:04] Net: Will do, thank you!
[01:20:48] Net: great commenting in roda
[01:21:14] Net: 👍🏼


[00:22:51] Net: Ping timeout: 252 seconds
[00:37:59] Net: has joined #RubyOnRails
[00:38:01] Net: has joined #elixir-lang
[00:38:03] Net: has joined #ruby
[00:39:42] Net: Max SendQ exceeded
[00:40:29] Net: has joined #elixir-lang
[00:40:29] Net: has joined #RubyOnRails
[00:40:30] Net: has joined #ruby
[16:49:41] Net: *.net *.split


[18:28:56] Net: What do you think of passing procs around as callbacks. Is that frowned upon in Ruby?
[18:29:36] Net: I suppose the more conventional format would be to take a block, but this needs to be passed inside a hash


[19:54:55] Net: I'm getting undefined local variable or method `csp_meta_tag' when I use csp_meta_tag in a layout. Any advice?
[19:55:00] Net: csrf_meta_tag works fine
[19:56:05] Net: nvm, restarting the server seems to have fixed it
[20:10:28] Net: Does AR support polymorphism with multiple id columns instead of a type column?
[23:59:12] Net: nacsurte: try adding `optional: true` to the belongs_to association and then setting the association to `nil` on the model with belongs_to


[12:14:38] Net: *.net *.split


[17:22:41] Net: setting config.active_record.logger = nil doesn't seem to silence logs on rails 5.1.6. did something change?
[17:49:23] Net: hahuang65: local dev
[17:49:50] Net: ActiveRecord::Base.logger = nil does work
[17:52:30] Net: hmm, seems it was because we moved it out of our config and into an initializer
[17:53:29] Net: into config/initializers
[17:56:24] Net: Why would setting it in a config/initializers not work but setting it in development.rb work?
[21:00:58] Net: jackcambridge: Gemfile
[21:06:29] Net: ahovgaard: Timex


[19:00:42] Net: if I have a `has_one :foo` relation of Bar, does ` = create :foo` delete bar's previous foo?
[20:27:43] Net: jtperreault: thanks


[20:05:55] Net: Ping timeout: 252 seconds
[20:06:36] Net: has joined #ruby
[20:06:36] Net: has joined #elixir-lang
[20:06:36] Net: has joined #RubyOnRails


[19:52:31] Net: any idea why `default: false` would be appearing in our schema.rb?
[19:55:49] Net: looks like the columns are `default: false` in their original migrations
[19:56:01] Net: question is: why aren't they default: false in our local and production databases then
[19:59:01] Net: noob69: See what?
[20:01:53] Net: the db has no default. I don't know what the model defaults to, but I'm not sure that matters
[20:05:21] Net: the model default is nil


[18:31:49] Net: Ankhers: maybe


[19:20:08] Net: markh:
[19:22:50] Net: sylario: what's a group?


[21:27:56] Net: I'm getting `find_spec_for_exe': can't find gem irb (>= 0.a) with executable irb when running irb with rbenv
[21:30:14] Net: that's when using the system ruby
[21:30:47] Net: gem install irb fixed it, but seems weird
[21:49:09] Net: I did try rehashing, if that was meant for me
[21:49:40] Net: didn't fix it
[21:49:51] Net: seems like my system irb just got uninstalled somehow
[22:32:27] Net: I believe it's alphabetical
[22:58:23] Net: Zarathu: try increasing max_parallel_workers_per_gather


[23:26:10] Net: Calinou: org_hash is probably [filename, hash]
[23:29:10] Net: davidfetter_work: YourModel.reflect_on_all_associations(:belongs_to).map(&:foregin_key) maybe
[23:39:43] Net: davidfetter_work: that will only show belongs_to associations
[23:40:11] Net: (which, I believe, should be the only columns in the table with fk constraints)


[00:00:56] Net: I have a json column that I'd like to be editable via yaml in a textarea. What's a simple way to implement this?
[16:38:44] Net: What’s the proper way to transform a param for create/update actions?
[16:39:44] Net: In my case I have a param that comes in as a YAML string, and I need to parse it before it’s saved as a JSON attribute.
[17:46:39] Net: Inside: any particular convention?
[17:57:40] Net: is it idiomatic for validators to write attributes?
[18:02:23] Net: this is the way I did it, I don't know if it's better or worse –
[18:03:10] Net: (this is rails 5.0 so no ActiveRecord::Type::Json)


[22:31:35] Net: I'm golfing, can I avoid the assignment in `foo = bar.baz; foo.nil? ? false : foo`?
[22:55:47] Net: havenwood: right, realized I can just do !!bar.baz
[22:56:18] Net: havenwood: I'd rather have a boolean than rely on falseyness
[22:57:04] Net: leftylink's looks fancy, but not sure what it's doing
[23:00:59] Net: Radar: where are you? australia?
[23:01:13] Net: ah nice
[23:05:52] Net: I see, bitwise or with special handling for nil


[00:00:22] Net: Radar: heading out. thanks for the chat. this channel feels pretty dead these days.
[16:19:47] Net: scapegoatee: hi :)
[16:48:45] Net: Is Random::DEFAULT seeded from /dev/urandom when Ruby starts?
[16:48:57] Net: Or should I call srand on load?
[16:52:18] Net: elomatreb: no crypto, just user surveying
[16:54:50] Net: the downside is I'd have to find somewhere to put srand
[17:07:21] Net: elomatreb: I think the seed is generated in the same way as srand
[17:07:44] Net: could anyone with familiarity with the ruby source confirm?
[17:09:45] Net: you're right
[17:21:01] Net: I want to hash one integer to a fraction such that the hashes of an even distribution of integers will be an even distribution of fractions between 0 and 1.
[17:21:06] Net: What's the best way to do this?
[17:21:37] Net:


[23:26:34] Net: or app/models/excel_file/parser.rb ?
[23:27:38] Net: How does the parsed data become an instance of ExcelFile?
[23:29:23] Net: Do you think that's better than the parser constructing the ExcelFile directly?
[23:30:05] Net: I hope I'm not wasting too much of your time. This is extremely helpful for me :)
[23:30:54] Net: When you said "I think it falls apart in a Rails application slightly ... because of the Active Record pattern. There is no real clear separation between structs and database queries.", what did you mean?
[23:31:22] Net: what structs and database queries were you referring to?
[23:37:37] Net: I'm imagining a pattern where models handle DB queries and simple data holding, but where most buisness logic has been moved out of the models to other classes or modules that reside in lib/
[23:40:37] Net: So the models are simple value-holding entity representations—usually tied to a db table—which are acted upon by more conventional logic outside of rails patterns.
[23:40:55] Net: Like how you wouldn't build your buisness logic inside the String class.
[23:42:18] Net: I'd like to treat app/ and certain patterns in it as building blocks for more conventional, less pattern-oriented code.
[23:42:54] Net: It's rare to find people who think this is a good idea, which makes me think it's not.
[23:44:11] Net: sometimes feels that way, but it's less arogant to believe I'm just not in the Rails mindset
[23:45:08] Net: Thanks, I'll watch it later :D