« Back to channel list

#RubyOnRails - 24 May 2019

« Back 1 day Forward 1 day »
[00:09:30] octos: has joined #RubyOnRails
[00:10:35] skryking: has joined #RubyOnRails
[00:12:03] xco: has joined #RubyOnRails
[00:21:24] jstrong: has joined #RubyOnRails
[00:31:55] Haydos: has joined #RubyOnRails
[01:01:10] kapilp: has joined #RubyOnRails
[01:17:49] orbyt_: has joined #RubyOnRails
[01:18:21] haxx0r: has joined #RubyOnRails
[01:23:56] jstrong: has joined #RubyOnRails
[01:26:24] duderonomy: has joined #RubyOnRails
[01:51:43] jstrong: has joined #RubyOnRails
[02:05:06] jstrong: has joined #RubyOnRails
[02:06:46] Linuus: has joined #RubyOnRails
[02:29:19] jstrong: has joined #RubyOnRails
[02:46:38] tdy: has joined #RubyOnRails
[02:50:55] jstrong: has joined #RubyOnRails
[02:52:20] Technodrome: has joined #RubyOnRails
[03:09:29] octos: has joined #RubyOnRails
[03:12:09] braincrash: has joined #RubyOnRails
[03:22:13] MrCrackPotBuilde: has joined #RubyOnRails
[03:27:45] MrCrackPotBuilde: has joined #RubyOnRails
[03:28:42] jstrong: has joined #RubyOnRails
[03:54:43] ltd: has joined #RubyOnRails
[04:18:31] gambl0re: has joined #RubyOnRails
[04:28:39] jstrong: has joined #RubyOnRails
[04:37:56] uksio: has joined #RubyOnRails
[04:41:00] skryking: has joined #RubyOnRails
[04:41:05] matthewd: has joined #RubyOnRails
[04:41:08] Technodrome: has joined #RubyOnRails
[04:56:13] sevenseacat: has joined #RubyOnRails
[05:00:16] alexeev: has joined #RubyOnRails
[05:01:11] xco: has joined #RubyOnRails
[05:20:20] alexeev: has joined #RubyOnRails
[05:20:54] conta: has joined #RubyOnRails
[05:36:12] alexeev: has joined #RubyOnRails
[05:43:56] alexeev: has joined #RubyOnRails
[05:45:48] alexeev_: has joined #RubyOnRails
[05:50:18] ltd: has joined #RubyOnRails
[06:06:23] alexeev: has joined #RubyOnRails
[06:11:28] hd1: has joined #RubyOnRails
[06:11:30] hd1: has left #RubyOnRails: ()
[06:18:27] Technodrome: has joined #RubyOnRails
[06:35:57] blackmesa: has joined #RubyOnRails
[06:36:31] alexeev: has joined #RubyOnRails
[06:36:56] schne1der: has joined #RubyOnRails
[06:48:59] lxsameer: has joined #RubyOnRails
[07:11:29] jefffrails35: has joined #RubyOnRails
[07:14:10] hammer065: has joined #RubyOnRails
[07:26:02] alexeev: has joined #RubyOnRails
[07:28:06] jstrong: has joined #RubyOnRails
[07:42:44] Sylario: has joined #RubyOnRails
[07:43:13] Net: has joined #RubyOnRails
[07:43:26] hahuang65: has joined #RubyOnRails
[07:43:57] iamdevnul: has joined #RubyOnRails
[07:44:18] Haydos: has joined #RubyOnRails
[07:44:19] deepredsky: has joined #RubyOnRails
[07:44:40] hahuang65: has joined #RubyOnRails
[07:45:40] uranoss: has joined #RubyOnRails
[08:02:36] mikecmpbll: has joined #RubyOnRails
[08:04:55] arthurnn: has joined #RubyOnRails
[08:07:27] iamdevnul: has joined #RubyOnRails
[08:08:18] ppl: has joined #RubyOnRails
[08:08:50] podman: has joined #RubyOnRails
[08:09:05] uranoss: has joined #RubyOnRails
[08:09:31] Net: has joined #RubyOnRails
[08:09:46] coffeejunk: has joined #RubyOnRails
[08:12:05] miah: has joined #RubyOnRails
[08:20:39] Liothen: has joined #RubyOnRails
[08:28:37] jstrong: has joined #RubyOnRails
[08:32:15] deepredsky: has joined #RubyOnRails
[08:45:08] alexeev: has joined #RubyOnRails
[08:47:20] kapilp: has joined #RubyOnRails
[08:49:52] lxsameer: has joined #RubyOnRails
[09:07:40] jstrong: has joined #RubyOnRails
[09:10:40] conta: has joined #RubyOnRails
[09:15:29] alexeev_: has joined #RubyOnRails
[09:22:54] jstrong: has joined #RubyOnRails
[09:48:18] schne1der: has joined #RubyOnRails
[09:54:28] conta: has joined #RubyOnRails
[10:22:45] deepredsky: has joined #RubyOnRails
[10:24:56] conta: has joined #RubyOnRails
[10:44:58] MrCrackPotBuilde: IGnorAND, thanks the problem was when signing up the user had to have an address but i was pasing the attributes in the wrong way
[10:47:15] srinidhi: has joined #RubyOnRails
[10:55:47] lankanmon: has joined #RubyOnRails
[10:57:54] jstrong: has joined #RubyOnRails
[11:03:29] MrCrackPotBuilde: has joined #RubyOnRails
[11:23:25] jstrong: has joined #RubyOnRails
[11:37:52] alexeev: has joined #RubyOnRails
[11:41:01] Ergo: has joined #RubyOnRails
[11:41:02] conta: has joined #RubyOnRails
[11:42:50] alexeev_: has joined #RubyOnRails
[11:43:23] jefffrails35: has joined #RubyOnRails
[11:47:48] haxx0r: has joined #RubyOnRails
[11:48:20] LenPayne: has joined #RubyOnRails
[11:49:56] jstrong: has joined #RubyOnRails
[11:55:11] spectra: has joined #RubyOnRails
[12:01:53] Shikichiro: has joined #RubyOnRails
[12:05:42] alexeev: has joined #RubyOnRails
[12:27:21] jstrong: has joined #RubyOnRails
[12:30:15] IGnorAND: MrCrackPotBuilde: did you solve it?
[12:33:51] haxx0r: i try to extend ActionView, but the renderer doesn't know the helpers
[12:34:10] haxx0r: Uploaded file: https://uploads.kiwiirc.com/files/d2fad78ce80ed8633364e5029b068e9d/pasted.txt
[12:34:30] haxx0r: basically i wanna call `render partial: "bla"` and this might be available in database otherwise continue as usual
[12:38:41] dionysus69: Have you ever heard of such controller pattern? to have only single action in controller and determine action by passed in param, it could potentially make development faster by eliminating need for extra routes and stuff, all params like action_id, http_method_sym and params could be sent to this one action
[12:39:06] haxx0r: did you ever hear about resource_controller? very fast for development.
[12:39:26] haxx0r: also, your controllerpattern idea is bad because it breaks REST.
[12:39:42] dionysus69: well yea, it does :D
[12:40:09] defsdoor: has joined #RubyOnRails
[12:47:07] haxx0r: can somebody tell me, where exactly rails is reading a template from disk `File.open` must be done somewhere, i can't find it https://github.com/rails/rails/blob/b9ca94caea2ca6a6cc09abaffaad67b447134079/actionview/lib/action_view/template.rb
[12:47:39] defsdoor: has joined #RubyOnRails
[12:55:06] defsdoor: has joined #RubyOnRails
[12:57:21] KeyJoo: has joined #RubyOnRails
[13:06:36] conta: has joined #RubyOnRails
[13:10:24] jstrong: has joined #RubyOnRails
[13:20:54] haxx0r: okay. i've done it :>
[13:21:24] haxx0r: Uploaded file: https://uploads.kiwiirc.com/files/7fb0504717bdd1a4e59ad8f17d23a6f5/pasted.txt
[13:21:39] haxx0r: now templates are looked up in DB first, and fallback to filesystem
[13:21:41] haxx0r: that's neat
[13:24:13] mauro1254: has joined #RubyOnRails
[13:25:23] DTZUZU2: has joined #RubyOnRails
[13:26:51] jefffrails35: has joined #RubyOnRails
[13:29:52] agent_white: has joined #RubyOnRails
[13:30:38] beholders_eye: has joined #RubyOnRails
[13:34:16] haxx0r: doesn't work in production. rails is caching those template queries -.-
[13:45:55] FrankDW: has joined #RubyOnRails
[13:50:17] jstrong: Let me pick y’alls brain on an architecture question.
[13:50:46] jstrong: I’ve built the subscription billing architecture for one of my clients. Most of this billing logic is time dependent, whether it be cron jobs, pro-ration pricing calculation, when bills are compiled, when accounts are suspended for non-payment, etc. This is not hard to test in terms of official unit tests because it’s not hard to emulate a future time through stubbing. But, understandably, management wants a way to b
[13:50:47] jstrong: able to test this manually.
[13:51:00] jstrong: My initial thought was: The vast majority of my code utilizes “DateTime.now” as the anchor point for all schedule based calculations. So, what I could do is replace all relevant references to DateTime.now with a method that instead basically does the following:
[13:51:01] jstrong: returns DateTime.now if Rails.env.production?
[13:51:02] jstrong: returns cached_future_time || DateTime.now if !Rails.env.production?
[13:51:18] jstrong: Where cached_future_time is written to by some simple Admin page.
[13:51:33] jstrong: does anyone have a better suggestion?
[13:54:15] haxx0r: if !Rails.env.production? it's called unless Rails.env.production?
[13:54:17] haxx0r: just saying
[14:03:01] jstrong: I don’t use unless
[14:35:40] alexeev: has joined #RubyOnRails
[14:39:06] zacts: has joined #RubyOnRails
[14:50:09] haxx0r: jstrong, why not? you should do it
[14:51:17] jstrong: more confusing than helpful in all but the simplest use cases
[14:52:04] jstrong: so I just avoid it entirely, just a personal preference. http://www.railstips.org/blog/archives/2008/12/01/unless-the-abused-ruby-conditional/
[14:58:14] beholders_eye: has joined #RubyOnRails
[14:58:21] gambl0re: has joined #RubyOnRails
[15:00:30] MrCrackPotBuilde: IGnorAND, not yet im using an api so its a little different to the tutorials. but what i gather i have has_one :address, as: :addressable, dependent: :destroy. Then belongs_to :addressable, polymorphic: true. Even though im going to have many models use the address model i wont need to have a model_id column. For a comment or say product then i would have a model_id. as for the create method. I'm at a loss. I dont
[15:00:30] MrCrackPotBuilde: have a def new as at the minute its the user sign up. so i have a api json endpoint for user signup. this should create a user and update the adress model. user = User.create!(user_params). its this bit im lost. in the docs it does mention you need to build the address. but in new which i dont have. nor do i have a controller for address as i thought i dont need one. i tried to build the address using address =
[15:00:31] MrCrackPotBuilde: Address.create!(address_params).
[15:01:14] MrCrackPotBuilde: iv tried these params
[15:01:35] MrCrackPotBuilde: params.require(:user).permit(:username, :mobile, :email, :password, :password_confirmation, address_attributes: [:houseno, :aptname, :street, :town, :city, :state, :zip, :country, :addressable_id, :addressable_type])
[15:02:35] MrCrackPotBuilde: params.permit(:username, :mobile, :email, :password, :password_confirmation) params.permit(:houseno, :aptname, :street, :town,:city, :state, :zip)
[15:04:04] MrCrackPotBuilde: i got it working using the has_one belongs_to but id like polymorphic lol too stubburn to give up
[15:13:00] haxx0r29: has joined #RubyOnRails
[15:14:23] jstrong: Is there a method in ruby run at class level after class has been fully evaluated/defined?
[15:14:45] IGnorAND: @MrCrackPotBuilde I am trying uilding with api as well
[15:14:57] jhass: jstrong:no because you simply don't know that point, given you can reopen the class at any point
[15:15:29] jstrong: jhass: yeh, I thought so.
[15:15:51] jstrong: Here’s my use-case scenario. I want to be able to use a bunch of class methods referenced in the class body (kind of like validates_presence_of etc..)
[15:16:00] jstrong: which after all those methods are run it needs to create a new object
[15:16:06] IGnorAND: @MrCrackPotBuilde I think you're confused
[15:16:19] MrCrackPotBuilde: well i can create a user
[15:16:28] MrCrackPotBuilde: and i can create a address
[15:17:08] MrCrackPotBuilde: taking that and then splitting the json request values to the corresponding keys is where im struggling
[15:18:04] jhass: jstrong: common approach is to wrap your "class method DSL" into a block passed to another method. build_validator do; validate_a; validate_b; end; where build_validator does something like: b = Builder.new; b.instance_eval(&block); b.build;
[15:18:10] jstrong: ahhh makes sense
[15:18:13] jstrong: jhass: thanks
[15:20:56] MrCrackPotBuilde: IGnorAND, i think you might be right might need to use address_id in the user model to reference the address polymorphic model
[15:22:56] jstrong: jhass: for storing the state generated by using class body methods, is it common to use class variables?
[15:23:03] jstrong: i know they’re generally avoided but in this aprticular metaprogramming use case
[15:24:09] jhass: no, class level instance variables are more interested. "class methods" actually don't exist in ruby, they're instance methods of the class' #singleton_class
[15:24:17] jhass: eh, more used
[15:24:58] jhass: so any instance variables they reference belong to that singleton class
[15:27:54] kapilp: has joined #RubyOnRails
[15:28:30] jstrong: jhass: like this? https://gist.github.com/laspluviosillas/6933a92c07497a91c83b610dd4875c7a
[15:30:58] jhass: sure why not. I'd add some validations on self.filters and maybe store @filters directly rather than keeping the builder around. Also I assume that's just a simplified example since you don't actually need to know there when "adding filters" is done
[15:31:21] jstrong: just simplified
[15:31:30] jstrong: how would you do getters/setters on the class instance itself?
[15:31:38] jstrong: obviosuly can define manually but wondering if there’s some “attr_accessor” equivalent
[15:32:04] jhass: you can just open the singleton class with class << self;
[15:32:15] jhass: and treat it like you would any other class
[15:35:29] jstrong: interesting
[15:36:01] jstrong: thanks for your help man
[15:36:49] jstrong: jhass: do you know what I’m doing wrong here? https://gist.github.com/laspluviosillas/48e5ebbcd911281e71d07140545c1dde
[15:37:56] jhass: well attr_accessor is just what it is, in a singleton class too. So it defines Custom.search_class and Custom.search_class=
[15:38:23] zacts: has joined #RubyOnRails
[15:38:46] jhass: (the inheritance works here because a child class' singleton class inherits its parent class' singleton class)
[15:39:04] jstrong: ah so I’d have to call search_class= explicitly
[15:39:25] jhass: yeah, self.search_class = :test in the class body context
[15:39:39] jhass: else you're just assigning a local variable
[15:41:31] jstrong: I love this
[15:44:07] Technodrome: has joined #RubyOnRails
[15:45:31] deepredsky: has joined #RubyOnRails
[15:58:54] jstrong: jhass: Sorry for so many questions, but if I wanted to loop through an array and then run a particular method inside a block once for each value in the array
[15:59:02] jstrong: is string interpolation the only option here?
[15:59:38] jhass: no idea how you would arrive at string interpolation for that problem statement :D
[16:00:00] jhass: array.each {|e| particular_method(e) }
[16:00:08] jhass: guess I didn't fully get ya ;)
[16:01:23] skryking: has joined #RubyOnRails
[16:01:30] jstrong: jhass: one sec
[16:02:51] jstrong: https://gist.github.com/laspluviosillas/d346a2fadffad59dd5f6aa52aa15df8c
[16:03:26] jstrong: jhass: ^ I don’t think I can. do the syntax I’ve shown in the first section because the “define” method performs instance_eval which means that it’s going to evaluate everything inside the block as part of the instance
[16:03:30] jstrong: ignoring the stuff outside the block
[16:04:15] jstrong: so my thought was to build a string then just run eval(string) inside the “define” block
[16:05:05] jhass: iirc instance_eval also yields the receiver, so you could do 'do |e| foo.each {|v| e.argument v }; end
[16:05:19] jhass: if not you could of course capture self before the each into a local
[16:05:24] tdy: has joined #RubyOnRails
[16:05:49] jhass: or if the call is really that simple you could also do .each(&method(:argument))
[16:06:04] jstrong: I’m not following the full context unfortunately
[16:06:07] jhass: there's also a new shortcut syntax for that, let me look it up...
[16:07:22] skryking: Anyone have a nice easy way to fetch gmail messages and push them into actionmailbox?
[16:09:57] jstrong: jhass: wait wtf it worked lol
[16:10:02] jhass: https://carc.in/#/r/6yyk
[16:10:28] jhass: eh ignore the |b| in the second example
[16:10:42] jstrong: that’s pretty cool
[16:11:12] jhass: with Ruby 2.7 you can also do .each(&.:add)
[16:11:28] jhass: &. is just a shorthand for &method()
[16:11:50] jhass: well kinda
[16:13:07] havenwood: a twin, not to be mistaken for the lonely person operator
[16:14:00] skryking: was thinking maybe I could use fetchmail to the relay ingress that postfix would use...does that sound right?
[16:21:56] istrasci: has joined #RubyOnRails
[16:23:55] jstrong: jhass: part of the issue here is I’m constrained to using the ‘define’ method as defined by the graphql gem
[16:25:19] Tempesta: has joined #RubyOnRails
[16:26:31] jstrong: NVM got a solution
[16:27:22] gambl0re: has joined #RubyOnRails
[16:28:20] zacts: has joined #RubyOnRails
[16:36:58] orbyt_: has joined #RubyOnRails
[16:41:27] uks: has joined #RubyOnRails
[16:53:03] istrasci: I'm using Devise for authentication using a Users model. In my SessionsController, I'm overriding the #create method, but it appears a new User record is being created (if they've never logged in before) before I even get to the #create method. How is this happening? Because I need to preempt the record creation.
[17:02:45] jstrong: jhass: Thanks for your help. Because of your help. I converted this monstrosity: https://gist.github.com/laspluviosillas/e7389c096b2b3829d860d47c0402ec34
[17:02:59] jstrong: into this: https://gist.github.com/laspluviosillas/def7c5e000a5ecf1ef8e07ae95acf211
[17:04:11] jstrong: jhass: one last question. I noticed by using the &block format, it only works if I use “do ||"
[17:04:14] xco: has joined #RubyOnRails
[17:04:15] octos: has joined #RubyOnRails
[17:04:22] jstrong: what would I need to do to allow these “filters” to also accept { |args| } instead?
[17:04:24] jstrong: for one-liners
[17:05:42] jhass: the difference between do/end and braces is binding precedence. foo bar do end is foo(bar) do end; foo bar { } is foo(bar do end)
[17:06:23] jstrong: well but block_given? evals to false if I use braces
[17:06:24] jstrong: for some reason
[17:06:50] jhass: yes because the block binds to the closer expression with braces
[17:07:02] jhass: of you do foo(bar) { } it's the same as foo bar do end
[17:07:42] jhass: so foo(bar) { } and foo bar do end are equivalent, so is foo(bar do end) and foo bar { }
[17:08:16] zacts: has joined #RubyOnRails
[17:08:20] jstrong: jhass: haha, nice
[17:08:27] jstrong: so just gotta wrap the func call with ()
[17:08:44] jhass: well, argument list
[17:14:05] NL3limin4t0r: jstrong: Adding a reference to what jhass already said. http://ruby-doc.org/core-2.6.3/doc/syntax/calling_methods_rdoc.html#label-Block+Argument
[17:14:51] xco: Hi I’m going through this article that says to install `react-rails` gem https://medium.freecodecamp.org/how-to-create-a-rails-project-with-a-react-and-redux-front-end-8b01e17a1db with Rails 6 do we need to install a separate react gem? I thought adding the --webpack=react flag was enough?
[17:15:57] duderonomy: has joined #RubyOnRails
[17:19:06] NL3limin4t0r: xco: The command `rails new rails-react-tutorial --webpack=react` is merly to simplify the setup of an project Running rails and Node, this should add the `react-rails` gem to your gemfile. Having the gem installed is still needed.
[17:19:46] xco: NL3limin4t0r: ooooh interesting! Thanks!
[17:20:54] havenwood: xco: Afaik, having WebPack install React just installs the package but doesn't provide further integrations. React-Rails and ReactOnRails both go further. I don't recall details of how they differ.
[17:21:12] havenwood: xco: https://github.com/shakacode/react_on_rails
[17:21:52] havenwood: xco: Both React-Rails and ReactOnRails existed before the WebPacker integration, but both carry on after it.
[17:23:07] xco: havenwood: thank you i’m looking into both gems now
[17:24:21] zacts: has joined #RubyOnRails
[17:24:39] havenwood: xco: I'd not seen this before, but it looks related: http://ruby-hyperloop.org/
[17:25:09] havenwood: I guess they have a whole React/Rails thingy going. Dunno! ¯\_(ツ)_/¯
[17:28:18] uks: has joined #RubyOnRails
[17:31:19] xco: havenwood: the hyperthing is interesting, but i’m already tired with all these frameworks coming up each day. i can’t keep up 😂
[17:31:30] havenwood: ACTION nods
[17:32:13] antong: has joined #RubyOnRails
[17:34:07] jstrong: can I bind a block to a different context?
[17:34:46] jhass: that's what instance_eval does
[17:36:01] jstrong: well I’ve got nested blocks
[17:36:08] jstrong: @filter_builder.instance_exec(types, &block) receives my “filters” list
[17:36:14] havenwood: jstrong: show your code?
[17:36:22] jstrong: sure one sec
[17:36:41] jstrong: let me trim it for ease of readability
[17:38:19] uks: has joined #RubyOnRails
[17:39:08] jstrong: havenwood: https://gist.github.com/laspluviosillas/d9d9d7e5ba055116002d23ac0f202e0a
[17:39:33] jstrong: line 5# on usage.rb. define_filters receives a block which it passes to the “FilterBuilder” defined in the BaseSearch class
[17:40:03] jstrong: which means that the block that “filter” receives is binded to FilterBuilder, when I really want it to be binded by the class that’s calling "define_filters"
[17:40:06] jstrong: binded to*
[17:40:23] jstrong: in this case the call to woof! throws NoMethodError woof! on FilterBuilder
[17:43:10] havenwood: jstrong an aside, but base.rb line 28 - block will be nil if no block is given, so: block: block
[17:43:24] jstrong: I trimmed some of the fat that handles the nil cases
[17:43:36] jstrong: just for the purpose of slimming the code down
[17:43:56] jstrong: I see what you’re saying
[17:44:29] jstrong: havenwood: I also trimmed where Filter.eval is called, but it’s whenever Filter.eval is called that I would like the block that is evaluated to be binded to the different context.
[17:45:45] havenwood: jstrong: without really getting what's going on here, my first thought is to pass a lambda that has a binding to where woof is defined
[17:46:10] dviola: has joined #RubyOnRails
[17:46:38] jstrong: yeah that’s roughly the idea
[17:50:21] jstrong: havenwood: can’t a lambda imitate a block somehow?
[17:55:07] havenwood: jstrong: https://gist.github.com/havenwood/8e27cbb30d0e4548bf8268284f14fd9c
[17:55:28] havenwood: jstrong: that's ^ one way
[17:55:58] havenwood: jstrong: (Just using `[abs2, bar.wombat]` to show bindings to both working.)
[17:56:02] jstrong: so you’re just explicitly passing the context in?
[17:56:14] havenwood: jstrong: yes
[17:56:23] havenwood: jstrong: I'm assuming you need two contexts, for whatever reason.
[17:56:35] jstrong: Nope. Really just need the context to be the higher class
[17:56:45] jstrong: Think like the lambda’s you can pass to Rails validation methods
[17:56:53] jstrong: you expect them to be able to run methods inside your ActiveRecord object
[17:56:57] jstrong: similar ordeal
[17:57:29] havenwood: jstrong: Then why are you #instance_exec'ing on @filter_builder if you don't need the context there?
[17:58:05] jstrong: I read online instance_exec = instance_eval except you can pass in more params
[17:58:10] jstrong: only reason I’m using instance_exec vs instance_eval
[17:58:15] havenwood: jstrong: Call instance exec on the context you want the block run in.
[17:59:03] jstrong: OK, I guess I can just scrap the “FilterBuilder” class entirely and define its methods directly on the class I want the binding to be on
[17:59:16] havenwood: Simple is good!
[17:59:17] jstrong: just surprises me that there’s no way to explicitly set the binded context, I guess.
[17:59:28] havenwood: You can set the binding context!
[17:59:34] havenwood: I just don't follow, I guess.
[18:00:23] havenwood: I don't get why you're instance_exec'ing on @filter_builder if you don't want the context to be there?
[18:00:45] octos: has joined #RubyOnRails
[18:01:22] havenwood: You can pass bindings around or instance exec on whatever you want. I think I just don't follow since I'm multitasking.
[18:01:30] jstrong: I was just encapsulating the functionality of building filters into a class because I thought it would be a good idea.
[18:01:40] jstrong: but really the “filters” themselves need to be available outside of “filter builder”
[18:01:55] jstrong: the real context of the “filters” is not filter builder but the BaseSearch class that is running FilterBuilder
[18:02:10] jstrong: so I’ll just nuke the “FilterBuilder” idea entirely, and separate code into modules if necessary
[18:02:14] havenwood: I'd suggest the simplest thing that can possibly work, as a first step. Then see if refactoring improves or if simple is readable, fast and concise.
[18:04:50] jstrong: thanks for the help!
[18:18:33] sameerynho: has joined #RubyOnRails
[18:19:13] Technodrome: has joined #RubyOnRails
[18:34:51] beholders_eye: has joined #RubyOnRails
[18:35:08] amperry: has joined #RubyOnRails
[18:36:59] amperry: Hey folks, I've got a page I want to reload on a change to a select tag, passing the selected value back to the same controller. (A query might return several results, and I want the user to be able to select one). How is that done?
[18:38:41] amperry: I don't see how form_with, link_to, or button_to would do it, and I've tried to create a jquery event listener, but I'm hoping there's a more rails-idiomatic way because I suck at js.
[18:55:39] octos: has joined #RubyOnRails
[19:06:06] octos: has joined #RubyOnRails
[19:10:16] schne1der: has joined #RubyOnRails
[19:45:36] uks: has joined #RubyOnRails
[19:50:51] octos: has joined #RubyOnRails
[19:55:19] antong: has joined #RubyOnRails
[19:59:09] antong: has joined #RubyOnRails
[20:00:26] antong: has joined #RubyOnRails
[20:13:16] octos: has joined #RubyOnRails
[20:18:48] srinidhi: has joined #RubyOnRails
[20:26:43] tdy: has joined #RubyOnRails
[20:33:00] jstrong: has joined #RubyOnRails
[20:44:19] lupine: has joined #RubyOnRails
[20:49:10] jstrong: has joined #RubyOnRails
[21:15:36] octos: has joined #RubyOnRails
[21:19:55] xco: has joined #RubyOnRails
[21:25:35] jstrong: has joined #RubyOnRails
[21:30:11] octos: has joined #RubyOnRails
[21:39:51] jstrong: has joined #RubyOnRails
[21:41:34] xco: i’m trying to use activesupport in just one ruby file; inside the file i have require 'activesupport'
[21:41:42] xco: and when i do “gem list activesupport”
[21:41:50] xco: i get activesupport (6.0.0.beta3, 5.0.7.2, 4.2.0)
[21:42:03] xco: but when i run my “file_name.rb”
[21:42:30] xco: “`require': cannot load such file -- activesupport (LoadError)”
[21:42:41] xco: i’ll appreciate some tips :D
[21:51:40] schne1der: has joined #RubyOnRails
[21:53:24] weaksauce: xco https://github.com/rails/rails/blob/master/railties/lib/rails.rb#L7
[21:53:46] xco: holy shit!
[21:53:53] xco: thanks!
[21:56:02] weaksauce: also xco https://edgeguides.rubyonrails.org/active_support_core_extensions.html
[22:06:18] xco: weaksauce: awesome!
[22:12:43] defsdoor: has joined #RubyOnRails
[22:14:34] orbyt_: has joined #RubyOnRails
[22:20:43] _aeris_: has joined #RubyOnRails
[22:22:54] Fernando-Basso: has joined #RubyOnRails
[22:23:04] jstrong: has joined #RubyOnRails
[22:25:43] octos: has joined #RubyOnRails
[22:59:46] tdy: has joined #RubyOnRails
[23:11:31] defsdoor: has joined #RubyOnRails
[23:11:51] orbyt_: has joined #RubyOnRails
[23:13:55] jstrong: has joined #RubyOnRails
[23:16:24] duderonomy: has joined #RubyOnRails
[23:33:04] jstrong: has joined #RubyOnRails
[23:36:49] shtirlic: has joined #RubyOnRails
[23:49:11] jstrong: has joined #RubyOnRails
[23:52:45] amperry: has joined #RubyOnRails
[23:58:23] amperry: I have a class, Lease, with several date attributes ('start_date', 'end_date', et al); if I wanted to assign them in a loop, how would I do that, assuming I have those keys in a hash? (I can't use lease_params at this point.)
[23:59:36] bambanx: has joined #RubyOnRails