Activity Graph

Page 1 of 2 | Next »



[02:48:36] jaegerca: has joined #RubyOnRails
[02:49:13] jaegerca: How do you all separate your "external" from "internal" controllers (authenticated vs public) - and what terminology do you use?


[01:11:38] jaegerca: has joined #ruby
[01:11:41] jaegerca: If I had a bunch or Articles that belonged to Categories in my Blog - would you perfer Blog::Category and Blog::Article, or Category and Article, or BlogCategory and BlogArticle?
[01:12:41] jaegerca: (I am crossposting this in rails because I am curious about opinions)
[01:12:51] jaegerca: has joined #RubyOnRails
[01:12:52] jaegerca: If I had a bunch or Articles that belonged to Categories in my Blog - would you perfer Blog::Category and Blog::Article, or Category and Article, or BlogCategory and BlogArticle?
[01:15:26] jaegerca: has left #ruby: ()
[01:15:30] jaegerca: has joined #ruby
[01:16:29] jaegerca: Papierkorb: But you would keep article and blog on the "top level" of the Model namespace.
[01:16:37] jaegerca: or article and category rather
[01:17:05] jaegerca: Papierkorb: What if you expect this application to grow quite large - and other things end up with categories?
[01:17:40] jaegerca: I ask because I always seem to regret not namespacing in every project, but I feel I end up just making more namespaces than I should be before I actually need them.
[01:18:33] jaegerca: Papierkorb: I tend to agree, but it seems cluttery to me - just from a ocd sort of viewpoint.
[01:20:07] jaegerca: I think I would like to end up exploring microservices more with my code using docker and DevOps, then using services as "namespaces" instead.
[01:20:21] jaegerca: Papierkorb: That could be true
[01:20:35] jaegerca: What convention is that?
[01:22:39] jaegerca: Papierkorb: How many models do you think you end up with on some of your larger projects?
[01:27:38] jaegerca: Papierkorb: Ok, well I appreciate your answers!
[01:32:04] jaegerca: Papierkorb: "Don't solve local issues globally, and don't solve global issues locally" I like that
[01:32:08] jaegerca: What is SOLID?
[01:33:46] jaegerca: Papierkorb: Oh, I love Gang of Four, I have the ruby version right here!
[14:40:21] jaegerca: Ping timeout: 240 seconds


[00:11:00] jaegerca: Remote host closed the connection


[22:25:26] jaegerca: has joined #RubyOnRails
[22:25:28] jaegerca: If I have action cable running on two servers, and a user is connected on server A, but server B broadcasts the event, how does the user get notified?
[22:55:42] jaegerca: Ah - looks like redis
[22:55:47] jaegerca: Good ole redis


[22:18:33] jaegerca: has joined #RubyOnRails
[22:18:56] jaegerca: Anyone know any good gems to allow users to tag other users, or other things in the application?
[22:21:17] jaegerca: havenwood: I looked at that, but unless I am missing something, a user can't tag another user with that and have a private list of tags for someone else.
[22:22:14] jaegerca: It seems like users just have tags, not tags in respect to other users.
[22:28:48] jaegerca: havenwood: Am I missing something?
[23:11:28] jaegerca: havenwood: I guess I could somewhat see it working by adding it to the join model connecting one user to another.
[23:37:19] jaegerca: Remote host closed the connection


[13:41:17] jaegerca: has joined #RubyOnRails
[13:42:14] jaegerca: So I am building an engine. This engine has a number of different routes - I was to insert certain routes into one part of my applications routes file, and another set of routes into another part of my applications routes file. Can anyone think of a pragmatic way of doing this?
[13:42:23] jaegerca: I want* to insert
[13:44:56] jaegerca: I am thinking of it almost like how rails views do it with content_for and then yielding in the layout. Imagine I am yielding certain types of routes into my routes file that are in routes_for blocks in the engines routes.
[14:57:54] jaegerca: Is there a way to mount some routes of an engine in one place and the others in another place?
[17:17:38] jaegerca: Remote host closed the connection


[09:18:34] jaegerca: has joined #ruby
[09:20:04] jaegerca: Hello. Anyone aware of a way or a strategy for making it so your models composable in a non-permanent fashion? I would like to make engines for the different parts of my application that extend the functionality of my main models, but I don't want engines to be able to use eachothers added functionality.
[09:20:22] jaegerca: I think this is impossible in Ruby, at least the way I am thinking about it.
[10:27:59] jaegerca: Mon_Ouie: I actually did have a look over refinements, but decided they weren't up to the challenge as the are messy, and they also don't allow you to modify the class itself.
[10:28:17] jaegerca: muzik: I would be very curious to be pointed in the right direction!
[10:30:17] jaegerca: muzik: So, I have my main application, and I have a Dog model. This has basic support for things like color and name. But perhaps I add an engine that allows my Dog model to sleep in a doghouse or something.
[10:30:40] jaegerca: Inside the Sleep engine I am adding methods to dog instances and class related to sleeping, doghouses, etc
[10:31:00] jaegerca: But those methods are not accessible to the rest of the application, or engines, because they are not concerned about sleeping.
[10:31:36] jaegerca: I am hoping that in this way I can break out common pieces and compose the dog model appropriately depending on where I am at in my application.
[10:32:39] jaegerca: muzik: Well - if that were the case I would just extend the instance in the right place
[10:33:36] jaegerca: Well - this is in the context of a rails application - so generally in the controller I would just extend that instance with the desired traits
[10:33:57] jaegerca: The issue is really how to deal with things like active record relations
[10:34:13] jaegerca: dog.doghouse is defines by has_one :doghouse on a class level
[10:34:29] jaegerca: Which means it's shared immediately to the whole app, I don't want that
[10:34:42] jaegerca: I only want the sleep engine to understand that relationship
[10:35:01] jaegerca: No worries - I really do think this is impossible in ruby
[10:40:11] jaegerca: mnemon: Yes - the issue is just what I referenced before. This Sleep engine may supply an active record relation on Dog. Dog.has_many :doghouses. On an instance level this is all fine and well, just extend as you said, but class level things are my issue. Refinements are the closest I have seen to dealing with this but they don't seem to be exactly what I want.
[10:41:55] jaegerca: mnemon: Because I don't want the modifications available to the rest of the application
[10:42:58] jaegerca: mnemon: Right now I am just including a SleepyDog module - but the rest of my app understands these things when I want this behaviour isolated.
[10:44:02] jaegerca: I only want my dog to be capable of sleep in the engine
[10:47:10] jaegerca: mnemon: I think the easiest way to explain this would be: I want to add an active record relationship to Dog, and I want this relationship to only exist in the engine, not the rest of the application, even though the Dog class is in the applications.
[10:50:58] jaegerca: mnemon: Ok, so I extend dog with SleepyDog, how do I get the activerecord relationships that would need to be defined on the class?
[10:51:17] jaegerca: I can't add a has_many :blah to an instance
[10:56:44] jaegerca: mnemon: Oh - I don't know, that sounds possible!
[10:56:49] jaegerca: Let me have a look at the doc
[10:57:45] jaegerca: mnemon: Sure yes - do you have a link to that method? I am not seeing it
[10:59:45] jaegerca: mnemon: Ah okay I see what you mean, I thought you found an instance method add_relations. This is a class method, the second I use it the relationship is available to all instances of dog across the app.
[11:00:11] jaegerca: Which is what I am attempting to avoid.



[19:08:40] jaegerca: What do people use to post code these days?
[19:13:02] jaegerca: Can anyone explain to me why the following code raises an error instead of just creating a validation error? https://pastebin.com/NezVJaRk
[19:16:36] jaegerca: al2o3-cr: That's what google thought I was asking too.
[19:29:44] jaegerca: Actually, it seems that my validation does work so long as my number is small enough. Why would that error raise before checking validations?
[19:30:04] jaegerca: Shouldn't it just tell me the number is too big and not try and force it?
[19:34:00] jaegerca: jackjackdripper: One of your pipes looks weird
[19:34:07] jaegerca: might be my monitor
[19:34:12] jaegerca: I can't see anything else
[19:34:33] jaegerca: I think the pipe to the right of h isn't a pipe
[20:29:10] jaegerca: So I used to think the best way to validate user input was model validations, but that doesn't seem to be that case with integer sizes anymore. What's the best way to make sure your users aren't sending larger values than the db can handle now?
[20:34:33] jaegerca: Cross posting
[20:35:00] jaegerca: So I used to think the best way to validate user input was active record model validations, but that doesn't seem to be that case with integer sizes anymore. What's the best way to make sure your users aren't sending larger values than the db can handle now?


[19:12:23] jaegerca: has joined #RubyOnRails
[19:21:04] jaegerca: lt scope colors on user to be published, or scope it in all of my controllers?
[19:21:04] jaegerca: I am curious how some of you would go about dealing with a feature. Say I have a bunch of users, and these users all have many colors which can either be in a published or unpublished state. Now I am displaying users colors all over the site, but I don't ever want to display unpublished colors. The admin is in control of whether a color is published or not. Now the question is, should I just defau
[19:21:20] jaegerca: I feel like scoping in the controllers is the best way, but I am curious everyones thoughts.
[19:48:01] jaegerca: has joined #ruby
[22:23:04] jaegerca: drim: do ... what?
[22:24:48] jaegerca: Yeah I got that - I was asking what you are trying to override it with.
[22:25:03] jaegerca: Why can't you just open the module and override it?
[22:26:59] jaegerca: cant you just module Searchkick; def self.load_records(records, ids); raise;end;end
[22:27:10] jaegerca: Also, it looks like records are already sent in, so records is scoped
[22:27:22] jaegerca: why not just send the right records in and not monkey patch anything?
[22:31:27] jaegerca: drim: Can't you send in with_deleted records as the records argument?
[22:33:29] jaegerca: drim: Do you include Searchkick somewhere?
[22:35:16] jaegerca: drim: I would bet this is your issue then: https://stackoverflow.com/questions/5944278/overriding-method-by-another-defined-in-module
[22:42:42] jaegerca: drim isn't it a class method?
[22:42:52] jaegerca: you did an instance method
[22:44:00] jaegerca: drim: Well, you could always just overwrite it in you actual class after you've included the module.
[22:45:04] jaegerca: That's probably the best approach anyway. Monkey patching makes messes later.
[22:49:10] jaegerca: drim: No, I mean like in whatever class you are including this module, just define the method in the class after you've included it.
[22:51:50] jaegerca: Well, either way it somehow gets included into your classes, I am saying to just override it there
[22:56:54] jaegerca: drim: There is, I don't have the attention right now to walk through it though I am sorry.
[22:57:29] jaegerca: drim: All I can say it make sure your patch is loaded *after* the gem.
[22:57:57] jaegerca: drim: I would probably put the monkey patch in the same initializer.


[16:36:31] jaegerca: has joined #RubyOnRails
[16:37:22] jaegerca: So I am trying to render a javascript from a controller. I have the link that renders it remote: true, and the js.erb file is rendering I can see in the server log, but the js is not actually executing. Any ideas?


[15:26:51] jaegerca: has joined #RubyOnRails
[15:27:38] jaegerca: Does anyone know if there are some current ical/ics gems out there? Seems like the community goes with icalendar but that thing seems fairly dead, 3 years work on an unreleased 2.0 version.
[15:32:02] jaegerca: Oh I am wrong nevermind
[17:34:01] jaegerca: has joined #RubyOnRails
[17:34:04] jaegerca: Anyone have some solid strategies for loading certain rake tasks only when the environment is test?
[20:45:34] jaegerca: Ping timeout: 276 seconds


[01:50:41] jaegerca: Remote host closed the connection


[15:34:07] jaegerca: has joined #RubyOnRails
[15:34:43] jaegerca: Is is possible to do @user.items.joins(:price) or do I always have to do my joins on User?
[15:35:15] jaegerca: I have tried it
[15:35:38] jaegerca: I know it doesn't work - the underlying question is if there is a way to add a joins after the query chain has started.
[18:55:38] jaegerca: has joined #RubyOnRails
[19:06:28] jaegerca: I am doing something like: school.employees.merge(Employee.teacher) - but when I merge Employee.teacher in it seems to be kicking my school_id out so I am just getting all employees that are teachers in any school. Anyone have any ideas?
[20:15:36] jaegerca: sunya7a: No, that's an indication that your queries are not n+1
[20:16:18] jaegerca: sunya7a: Cache is saying "already have that info (because you loaded it with the query) - unless it's the second time you are calling it - in which case you might have an issue
[20:17:57] jaegerca: I would sure hope so
[20:18:14] jaegerca: What else could it be?
[20:18:35] jaegerca: round is a field?
[20:20:53] jaegerca: sunya7a: I am not sure I understand what you mean. Why would you want to do that in the controller? You shouldn't have performance issues with it
[20:21:05] jaegerca: If you do you can adjust the messages being logged on production
[20:26:45] jaegerca: baweaver: I don't think I have ever had my model right
[20:27:26] jaegerca: baweaver: never fun!!
[20:29:28] jaegerca: baweaver: Oh wow - those are the kinds of things that make me really wonder how talented some people are
[20:29:56] jaegerca: I feel like an okay programmer, but those are things I would never do. It amazes me how much people get away with in this field.
[20:33:39] jaegerca: Yeah. One broken window - the whole neighbourhood goes down.
[20:34:18] jaegerca: Slowly but surely!


[20:29:25] jaegerca: has joined #RubyOnRails


[03:36:31] jaegerca: has joined #RubyOnRails
[03:37:56] jaegerca: How do all of you merge a hash into ActionController::Parameters? If I haven't permitted an attribute and then merge it in - it seems to still work but I would imagine that should be unpermitted at that point? I would rather not be using to_unsafe_h everywhere


[16:54:09] jaegerca: has joined #RubyOnRails
[16:54:40] jaegerca: Anyone know how rails gets the parent class of an instance when saving it as a polymorphic association?
[17:30:25] jaegerca: Just trying to learn how rails gets the parent class of an instance when saving it as a polymorphic association.
[17:31:47] jaegerca: If I have class Person and class Adult that inherits from person. Saving polymorphic associations with adult saves the resource_type as Person - I want to know how Person is determined to be the class that is saved to the type
[17:40:19] jaegerca: I figured it out, there is a method called base_class that does it
[23:09:40] jaegerca: Remote host closed the connection



[20:25:44] jaegerca: has joined #ruby
[20:28:11] jaegerca: So lets say I have a model called Community::House, and I have CRUD setup for it in the admin, the path for a new Community::House is new_admin_community_house_path, but when I try to use it in a form like this [:admin, @house] it tries to create a new_admin_community_house which means I can't use this [:admin, @house] convention for both a new and edit form, anyone have any tricks to deal with this?
[20:29:22] jaegerca: Oops, the actual path is new_admin_house_path
[20:29:44] jaegerca: The one it's creating is new_admin_community_house


[02:45:09] jaegerca: That's really the best way I can think of.
[02:45:33] jaegerca: What's the new error?
[02:48:44] jaegerca: kfogel: I would `gem unpack json` and move it into your project in (I am assuming rails) vendor/gems/json, then point your gem path there in the gemfile - just to make sure you are applying the patch you think you are (plus you'll need the source of the gem anyway from here on out)
[02:50:27] jaegerca: Yeah, that should do it
[02:50:56] jaegerca: Put that in your project, apply your patch, point to it with path and see if you get the same error as you did in your last paste
[02:53:29] jaegerca: Im not sure at that point that you need to keep the version specified but that should do it
[02:54:09] jaegerca: At least now bundler isn't going to throw any surprises and you have everything you need to work with in your project
[02:55:43] jaegerca: That looks like eventmachine causing issues
[02:55:53] jaegerca: https://www.google.com/search?q=%E2%80%98rb_thread_select%E2%80%99+was+not+declared+in+this+scope&oq=%E2%80%98rb_thread_select%E2%80%99+was+not+declared+in+this+scope&aqs=chrome..69i57.244j0j7&sourceid=chrome&ie=UTF-8
[02:56:12] jaegerca: There are a few github issues related to that so you are in luck - I think you're past your json troubles
[02:57:14] jaegerca: I would guess you are fairly close at this point -
[02:57:36] jaegerca: What ruby version are you using?
[02:58:15] jaegerca: Do you have a Gemfile.lock?
[02:58:32] jaegerca: You should be able to see what is requiring it in there, open it up and search for eventmachone
[02:59:14] jaegerca: Based on the github issues you might be able to fix that by downgrading to ruby 2.1 - but if you don't need it better to keep the more recent ruby and get rid of the gem
[03:00:24] jaegerca: Hm, interesting
[03:00:46] jaegerca: kfogel: Can you paste your lock file
[03:01:47] jaegerca: I think it's thin requiring it
[03:03:34] jaegerca: You might try to update thin, it looks like there is a 1.7.0 version out.
[03:04:25] jaegerca: Although I would hope it's getting the most recent version since it's looking for anything > that 0.12
[03:05:05] jaegerca: I would think upgrading thin would have a very minimal impact, nothing to worry about
[03:05:26] jaegerca: kfogel: Hope not!
[03:06:47] jaegerca: kfogel: Looks like you just need to install imagemagik now
[03:07:39] jaegerca: kfogel: I always do apt-get for that and have never had an issue with the gems finding the files they need
[03:07:45] jaegerca: It's definitely worth a try -
[03:08:06] jaegerca: Though you might just need to update your path to find the Magick-config it's looking for if you know where it is
[03:09:26] jaegerca: I would think that should do it
[03:11:47] jaegerca: has joined #RubyOnRails
[03:13:35] jaegerca: So I have this people resource in my project, and there are a lot of actions that can be taken with them like publish, unpublish, retire - and many more. I am thinking about moving all these non CRUD actions into their own controller. does this make sense to anyone? resources :people {resource :action} and then just putting the actions in the action resource? Seems dirty to me.
[03:15:15] jaegerca: I suppose try libmagik9 ?
[03:16:07] jaegerca: fryguy: Why does it feel dirty? Because It makes it seem like "action" is itself a resource when really it's not
[03:18:13] jaegerca: captproton: It's just a lot of states in eventmachine really
[03:18:39] jaegerca: I am just looking for a smart way to put non crud actions in another controller
[03:19:16] jaegerca: I hope that works - if it doesn't then I would imagine it's a path issue - but there really shouldn't be one
[03:19:56] jaegerca: You have all the -devel libraries?
[03:20:19] jaegerca: Imagemagick-devel as well?
[03:22:07] jaegerca: I have never needed to install anything beyond imagemagick and imagemagick-devel, I wasn't aware so many other packages existed!
[03:23:15] jaegerca: I develop on a mac, and run amazon linux in the cloud
[03:23:33] jaegerca: You have this as well right? graphicsmagick-imagemagick-compat
[03:23:39] jaegerca: Not just the dev-compat
[03:23:52] jaegerca: I bet that's it!
[03:33:52] jaegerca: kfogel: I am not seeing much other than just having the right libraries installed - I feel like you have all the right ones though
[03:39:07] jaegerca: kfogel: That could definitely be it
[03:43:38] jaegerca: Yeah - I am betting you need some header files for that too
[03:43:49] jaegerca: libmysqlclient-dev
[03:43:56] jaegerca: Something like that?
[03:52:46] jaegerca: kfogel: Haha, don't worry about it - I am just looking at these two messages - amusing is right.
[03:53:42] jaegerca: kfogel: Did you attempt a bundle update?
[03:53:55] jaegerca: I am wary of doing that myself -
[03:56:05] jaegerca: do_mysql isn't coming from the delayed job gem is it?
[03:56:40] jaegerca: Oh yes it is
[03:57:44] jaegerca: kfogel: I really think your best bet there is to install the client libraries
[03:58:50] jaegerca: Yeah - bundle update is often a path to more headache - in my experience!
[04:02:06] jaegerca: Looks like you're all set!
[04:09:13] jaegerca: kfogel: Looks like that was dropped a while back, you might need a more up to date do_mysql - but that seems locked in the delayed gem job
[04:09:57] jaegerca: If that's correct you might have to unpack that one too and change the gemspec to require a more up to date version of do_mysql
[04:10:17] jaegerca: kfogel: Ha - those are always the most complicated
[04:11:04] jaegerca: You might be able to just update the do_mysql version in the gemfile first
[04:12:26] jaegerca: kfogel: Yeah - I would be curious to to know what is requiring the do_mysql (I *think* thats the culprit here) - I think it's a dependency of a dependency in the delayed job gem.
[04:16:26] jaegerca: That delayed job gem is really really old, I have no doubt it's outdated!
[04:21:40] jaegerca: kfogel: For sure
[04:30:31] jaegerca: kfogel: If you remove the delayed job gem from the gemfile does that error go away?
[04:31:09] jaegerca: kfogel: The datamapper one
[04:31:27] jaegerca: And then if it still fails might try the other one too
[04:33:42] jaegerca: I wonder if you explicitly require the DATAMAPPER_VESION of dm_mysql, if your other gem isn't depending on a lesser veriosn that will likely work
[04:34:07] jaegerca: gem 'do_mysql', '1.2.0'
[04:36:16] jaegerca: kfogel: Yeah, that should be sage
[04:37:06] jaegerca: Oops, try this version: 0.10.17
[04:37:16] jaegerca: I thought it was in step with the rest of the datamapper gems
[04:46:03] jaegerca: kfogel: Can you try downgrading to ruby 2.1 and see if it works?
[04:48:37] jaegerca: I think that the error you are getting is from that being deprecated in 2.2 - if I am right there is a lot of updating that would need to be done -
[04:49:14] jaegerca: I hate to say it but datamapper is going to continue to be a huge issue as it's been DOA for almost 4 years now.
[04:49:26] jaegerca: Yeah - I really think you need 2.1
[04:49:35] jaegerca: No not at all
[04:50:37] jaegerca: From what I can tell, it's go with ruby 2.1 and datamapper, or keep ruby > 2.1 and probably need to replace datamapper with activerecord (which really needs to be done anyway if there is going to be any amount of ongoing work with this, in my opinion)
[04:52:52] jaegerca: kfogel: I would definitely test on a vm if you can though - that's a lot of hoops to go through, I really think I am right but better to know for sure!
[04:55:11] jaegerca: kfogel: Sounds good! I am here often enough, feel free to ping me! Have a good night, and I am glad you were able to get through the gem installation part!