Activity Graph

Page 1 of 6 | Next »


[11:20:18] suchness: has joined #RubyOnRails
[11:20:37] suchness: I have a bunch of admins using devise. Is it possible to show which admins are currently logged in?
[11:21:10] suchness: Or are active?
[11:22:50] suchness: Yeah, I was wondering about the defaults. I can build something up.
[16:54:16] suchness: Remote host closed the connection


[08:49:07] suchness: has joined #RubyOnRails
[08:49:26] suchness: Anyone know a good gem that grants objects groups and permissions?


[17:30:19] suchness: Remote host closed the connection


[14:52:41] suchness: has joined #RubyOnRails
[14:53:00] suchness: Anyone know a way to have "a".self return self, or "a"?
[14:53:05] suchness: seems like that should work
[15:07:39] suchness: apeiros: Oh look at that
[15:08:08] suchness: apeiros: Ive got it running 2.3
[15:08:13] suchness: That will work fine, thanks!


[10:44:31] suchness: has joined #RubyOnRails
[13:41:40] suchness: Remote host closed the connection


[10:18:46] suchness: has joined #ruby
[10:20:29] suchness: So I have a class with an instance method that returns __FILE__, when I create another class that subclasses the first class and call that method, it gives me back the path from the top level class. Is there a way to get around this?
[13:11:29] suchness: Remote host closed the connection


[14:30:51] suchness: has joined #ruby
[14:32:53] suchness: So, I have a method that takes in any possible arguments (not blocks and such) like this: def method(*args). I want to take those args and make a key out of them. My first thought was alright, I will just flatten a call .hash. Problem is, I need this key to be consistent. There are other ways I could do this, like inspect the args and do a base64 or something, but I am curious if anyone here has a better idea.
[14:33:35] suchness: array[2..-1].join()
[14:38:25] suchness: array[1..array.length - 1].join should
[14:38:41] suchness: array[1..(array.length - 1)].join should
[14:39:39] suchness: nixcluster: I think you're right, you don't need the minus one
[14:40:28] suchness: ljarvis: Might make sense, but I don't know how I would sort it
[14:41:09] suchness: ljarvis: The reason for this is I am generating pdfs, which I need to sync to a cdn, and I don't want to persist in my db, so the parameters coming in will just link to a generated file name, if the file is a little to old, I regenerate and sync again
[14:41:20] suchness: ljarvis: So the arguments could be literally anything
[14:43:03] suchness: So I get a request from one user to get his account record since blah, i check for the key cdn/account_pdfs/(user, date), if it's there I send that back, if it's old I recreate and sync, and if it's not there I create and sync
[14:43:19] suchness: that's an artificial example but you get my drift
[14:44:43] suchness: Maybe someone wants a pdf of generate_pdf(user, 'purple',, 234235345, Tricycle.all) or something
[14:46:25] suchness: And after some messing around, inspecting and base64 is way to big in most cases
[14:47:21] suchness: ljarvis: Well the pdfs are specific, I mean, an account pdf is always going to get a user and date, and each pdf can have it's own to_key method that's specifically for that type of pdf
[14:48:05] suchness: if to_key returns one stored in s3 we are good to go
[15:34:43] suchness: has joined #RubyOnRails
[15:37:48] suchness: laodbalncer*
[17:59:51] suchness: mwlang: considering this,d.bGg I would guess not
[18:00:02] suchness: Your client is a classic idiot
[18:00:33] suchness: mwlang: You can tell him that from me
[20:15:05] suchness: Remote host closed the connection


[13:28:02] suchness: has joined #ruby
[13:30:59] suchness: If I have a class with an initialize method that takes a block and instance evals it to create an instance, how can I do something like this: Right now @alpha is complaining it doesn't know what 'variables' are.
[13:31:41] suchness: apeiros: It doesn't need I I realize that.
[13:32:47] suchness: apeiros: Alright, thanks!
[13:33:27] suchness: toretore: What is the other 'version'?
[13:34:30] suchness: toretore: Ah I see
[13:35:02] suchness: toretore: So basically yield 'self'
[18:48:56] suchness: How can I detect what class a method was called from?
[18:50:43] suchness: I can only type so fast.
[18:52:41] suchness: norc_: Haha, I am well aware. Here is my issue. I am building an extension for Prawn to detect when content is split between pages, the extention basically adds a method to the pdf class which takes a block, I am trying to figure out a way to detect what pdf class I am in without expressly passing it, given the nature of how this detection needs to be made the original class is essential.
[18:52:45] suchness: I think I will just pass it.
[18:53:29] suchness: Oh wow I am an idiot
[18:53:34] suchness: I am included, I know my class
[18:53:44] suchness: I have been at this desk too long
[18:55:28] suchness: spudowiar: I hear you
[18:55:53] suchness: I have been to far into a metaprogramming rabbit hole today to remember the basics of just normal programming.
[18:59:02] suchness: Besides ?
[21:00:16] suchness: Remote host closed the connection


[15:06:41] suchness: has joined #ruby
[15:07:08] suchness: Can anyone explain to me why my "variable" is not getting set here: ?
[15:08:17] suchness: Ok I am crossposting
[15:08:20] suchness: has joined #RubyOnRails
[15:08:46] suchness: Crosspost from ruby: Can anyone explain why my "variable" is not getting set here:
[15:09:11] suchness: has left #ruby: ()
[15:09:12] suchness: has joined #ruby
[15:09:28] suchness: Yes I realize that, which is why I would expect instance eval to set it
[15:09:41] suchness: but variable is not set
[15:10:43] suchness: Hold on let me get my head around what you are saying
[15:11:19] suchness: So I suppose then the real question is
[15:11:34] suchness: Is there any way to make it so I do not need to call self.variable=
[15:12:25] suchness: jhass: And what, define a method variable(value) that sets it?
[15:12:41] suchness: jhass: I like that, I think that's a clean solution
[15:12:49] suchness: Excellent, thanks!
[15:13:46] suchness: apeiros: That's a good tip, I can see how that would be useful, thanks!
[15:15:18] suchness: apeiros: Oh don't worry, I will make it magical
[15:20:47] suchness: jhass: Oh yes, my eagerness to get back to it made me forgetful.
[15:21:12] suchness: I found my answer in the ruby channel
[15:21:55] suchness: instead of setter methods, creating a method that takes the value as an argument and assigning it to an instance variable
[19:11:26] suchness: Remote host closed the connection


[12:55:50] suchness: has joined #RubyOnRails
[12:57:17] suchness: I have a yard that has many trees. I also have an after destroy hook on trees. when I do @yard.update(tree_ids: []), they are all deleted correctly, but my after destroy hook is never being called on tree. How can I fix this? (activerecord)
[13:03:03] suchness: deur-: But in the case I have @yard.trees => [1, 3] and I do @yard.update(tree_ids: [1, 4]) it should (and does) keep the tree id 1, and deletes 3, and adds 4. There is no way with this approach for Tree 3 to have its hook called?
[13:05:26] suchness: norc: But I want to keep tree 1 and add tree 4?
[13:05:50] suchness: norc: Like overwrite the tree_ids method
[13:06:41] suchness: norc well active record already supplies the relationship_ids= method and handles the deleting what needs to be deleted and adding what is not there already, but it seems to skip over the destroy callbacks on the ids that are no longer in the array
[13:07:17] suchness: norc: Hrm, alright, I will have to dive into it a little bit more.
[13:08:18] suchness: norc Alright
[19:00:11] suchness: Remote host closed the connection


[14:26:49] suchness: has joined #ruby
[14:26:49] suchness: has joined #RubyOnRails
[14:27:12] suchness: Does anyone know what this syntax is actually called? <<-EOF a bunch of text EOF
[14:28:06] suchness: Oh cool! Thanks!
[20:40:28] suchness: Remote host closed the connection


[11:51:10] suchness: has joined #RubyOnRails
[11:52:44] suchness: I have a rails application that serves as an api to an angular2 from end. The api/rails side also hosts the admin area. so basically an and a I am curious if anyone knows a good way to set the url_for host depending on whether I am linking to the api or the frontend?
[18:21:50] suchness: How can I get access to the currently set default_url_options for action mailer?
[18:23:46] suchness: Nevermind, jeez, I was mispelling something
[22:47:07] suchness: Remote host closed the connection


[15:46:53] suchness: has joined #RubyOnRails
[15:48:27] suchness: some logic in each mail method?
[15:48:27] suchness: So I have a bunch of different email types, and users can select whether they want to receive them or not. I am trying to determine the best way to have an email not send if a particular user doesn't want them. I am leaning towards having an interceptor, but the interceptor doesn't exactly know which email I am sending, just who sent it (by email) and who is receiving it (by email). Anyone handled this before? Perhaps I should just put
[16:01:02] suchness: Just trying to determine a good approach for selectively sending emails to people without the code ending up terrible
[16:01:40] suchness: Maybe having a class that takes the mailer, action, and arguments, checks what we are sending, then determines if it should be sent, and if so forwards the args to the right mailer
[16:02:05] suchness: So where to put the logic in that case?
[16:03:09] suchness: There is a strange thing in my app though that would prevent that. Some users receive emails intended for other users, so it would need to come after.
[16:04:55] suchness: Ok, that's pretty much in line with my first thought of sending the Mailer and args into a place that forwards them if they check out
[16:05:13] suchness: Sounds good to me! Thanks!
[19:00:04] suchness: Remote host closed the connection


[15:14:58] suchness: has joined #RubyOnRails
[15:15:58] suchness: Anyone know how to query jsonb for an array containing all values? Right now I can do this: TransportRequest.where("metadata -> 'events' ? '2005'") and get all records where the array of events contains 2005, but what if I want 2005 and some other id(s)?
[16:28:54] suchness: How can a do a has many through with active record and not create a model for the join table, just have it know to go through that table?
[16:30:29] suchness: Yeah I suppose
[16:31:14] suchness: I have something like this:
[16:31:30] suchness:
[16:31:45] suchness: Just seems pointless to create a model for the join
[16:31:52] suchness: At this stage at leas
[16:32:34] suchness: Right, but when I do I just pop it in no problem. More of a code clutter thing really.
[16:33:01] suchness: Fair enough, one oddly named join model coming up!
[16:33:35] suchness: Yeah that's true
[16:35:04] suchness: Well... I do prefer HMT 100% of the time...
[19:41:02] suchness: Remote host closed the connection


[14:51:40] suchness: has joined #RubyOnRails
[14:52:46] suchness: What is the proper way to set asset_host in rails 4? I was under the impression that the action_mailer and action_controller asset_host settings were both unified, but everywhere I look I see people setting action_controller.asset_host=, I have done the same, but my mailers are not prepending the correct host.
[14:53:33] suchness: Also, should I just additionally set action_mailer.asset_host= to be the same?


[13:31:21] suchness: has joined #RubyOnRails
[13:31:56] suchness: Anyone know if it's possible to left join a scope in active record? Model.scope1.left_join(Model.scope2)
[13:32:19] suchness: Basically getting all results of the first scope where there isn't a result in the second scope?
[13:37:02] suchness: How should I approach it?
[13:37:45] suchness: Do you know off hand if that will generate 1 or 2 queries?
[13:38:02] suchness: Also I was under the impression that a join of some sort would be much faster than an id not in.
[13:38:47] suchness: It will generate multiple queries?
[13:39:30] suchness: Apparently not
[13:42:28] suchness: Ok great, it looks like it works for me so I will use that, thanks!
[17:37:25] suchness: Ping timeout: 268 seconds


[15:42:28] suchness: has joined #RubyOnRails


[12:37:18] suchness: has joined #RubyOnRails
[21:06:08] suchness: Remote host closed the connection


[20:47:55] suchness: Remote host closed the connection


[15:06:30] suchness: has joined #ruby
[15:06:41] suchness: has joined #RubyOnRails
[16:41:26] suchness: Ping timeout: 246 seconds


[11:02:55] suchness: has joined #RubyOnRails
[11:03:40] suchness: I am curious what you all call your different environments. I usually have three environments, production, beta, and a development server environment. What do you all call them?
[11:04:19] suchness: Just the two huh?
[11:05:15] suchness: I would like to have that, we currently have 6!
[11:05:43] suchness: I am trying to get our business development team to understand it's way to many
[11:06:32] suchness: I wonder though, if you had to have three, would you call the one furthest away from production the beta, or the staging server, or something else?
[11:06:56] suchness: Hates_: Yeah that's pretty much what I have setup now, with one additional server for longer term development
[11:07:53] suchness: Yeah, that's kind of my thought as well.
[11:08:25] suchness: I can't really think of a better name than development, but I don't want that to clash with local development and all of those configurations.
[11:08:56] suchness: How do you differentiate between 'server development' and 'local development' environments?
[11:09:30] suchness: I might just call it server development, that wouldn't be too bad.


[16:34:15] suchness: has joined #RubyOnRails
[16:34:17] suchness: has joined #ruby
[20:01:33] suchness: Remote host closed the connection


[15:16:50] suchness: Ping timeout: 246 seconds


[11:24:06] suchness: has joined #ruby


[10:14:02] suchness: has joined #ruby
[10:14:04] suchness: has joined #RubyOnRails
[10:34:48] suchness: *.net *.split


[11:26:16] suchness: Kartikay: It doesn't mean anything without context
[11:32:46] suchness: matthewd: I thought about that at first, but if I am authenticated, then I load the page again, that 'transaction' isn't happening again since I am already authenticated.
[11:34:14] suchness: The session?
[11:34:28] suchness: I am hoping. Haven't quite jumped into proof of concept yet.
[11:35:42] suchness: Hrm. I suppose up until now I assumed it was the same way a regular rails app does it, but it's not...
[11:35:59] suchness: Yeah, that makes sense.
[18:19:49] suchness: I don't know.
[18:20:15] suchness: I have never had issues with it, you asked what I reccomend not the hivemind.
[18:20:44] suchness: diegoviola: Why don't you find out for yourself.
[18:21:14] suchness: I am not taking ay offense.
[18:21:53] suchness: Just use whatever one whatever blog you read told you to use instead of httparty.
[18:22:46] suchness: diegoviola:
[18:24:53] suchness: ellismarte: You might have better luck in #linux
[18:25:21] suchness: has left #ruby: ()
[18:25:23] suchness: has joined #ruby


[13:08:59] suchness: Read error: Connection reset by peer


[13:07:54] suchness: what do you call a party that is using your api?
[13:11:54] suchness: avril14th: That makes sense


[15:10:57] suchness: Anyone know a way to inherit from an active record model but not allow sti and not allow the inheriting model to persist?
[15:14:28] suchness: Thanks that helps so much.
[15:15:23] suchness: tubbo: It can not unfortunately.
[15:15:48] suchness: I was beginning to suspect as much, thanks!
[15:17:18] suchness: Well, imagine this scenario. Employees belong to entities. Not some employees are class AnonymousEmployee, and they don't have an entity. I wanted to subclass entity and have a overwritten on the anonymous employee model as a benign value.
[15:17:31] suchness: Now some employees*
[15:17:59] suchness: That way anonymous_employee.entity => AnonymousEntity
[15:18:30] suchness: norc: I am doing that same thing and settled on trackable
[15:20:03] suchness: norc: Called it a resource_version
[15:20:08] suchness: tubbo: Correct. And really there is nothing stopping me from just not having AnonymousEntity subclass
[15:20:38] suchness: The disconnect just feels weird, because their functionality is shared. I suppose I could have them both include some sort of entity module
[15:21:18] suchness: tubbo: It's probably not worth the headache hacking around AR anyway, I will just make it it's own class. Thanks!
[15:22:40] suchness: tubbo: Actually, that's an even better approach, I think that's exactly what I will do.
[16:40:41] suchness: I have an array of three procs that return either true or false, is there a way to check if [Proc, Proc, Proc].each(&)
[16:41:12] suchness: So I could call them all and detect if they were all true? I am looking for a slick way, not a map.include?)false) or something
[16:43:44] suchness: I figured a way
[16:43:47] suchness: select { |element| selectors.inject(true) {|result, selector| result && }}
[16:44:36] suchness: arup_r: That looks much slicker, but how do I call the proc in the array with an argument?


[03:39:13] suchness: Ping timeout: 264 seconds


[12:05:42] suchness: spiman: Does your Gemfile specify the right ruby version?
[12:07:21] suchness: spiman: put ruby '2.2.2' in your gemfile
[12:08:47] suchness: If you can resolve it by getting the rbenv bundler working then probably
[12:09:44] suchness: spiman: put this in your .bash_profile: if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
[12:40:30] suchness: Ox0dea: Can't you just gem checkout over the top of it?
[12:41:20] suchness: Ox0dea: Ah, I am not sure you can, I think you need to update the installed version and then checkout over the top. I could be wrong though.
[12:41:35] suchness: Come to think of it I hope I am
[12:41:53] suchness: Seems like you should be able to do it...


[15:36:12] suchness: ProtoJazz: I just wrote a recipe that makes a yaml file from my stack configuration, then my environments just call ServerConfiguration.thing where server configuration is just the class that interfaces with the yaml.
[15:36:38] suchness: ProtoJazz: that lets me change things stack by stack and in development or whatever
[15:57:07] suchness: Anyone away of a way in activerecord to define a has_many that isn't accessible as a method, only to build other relationships?
[15:58:25] suchness: I will probably do do that, but it will make me feel all icky, you know?
[15:59:49] suchness: Yeah, that's very true
[16:00:55] suchness: smathy: I have one has_many that needs at, as well as a has_many through
[16:01:52] suchness: I think you're right, maybe I just need a better name.
[16:02:44] suchness: Yeah. Alright, thanks!


[12:49:04] suchness: has joined #ruby
[14:57:53] suchness: greg: That's a weird question.
[14:58:10] suchness: are you experienced or do you just want to play around with something already built?
[14:58:52] suchness: Seems like "i just read my first ruby book" and "let's hack some open source projects" is a weird leap.
[14:59:48] suchness: greg: The link jhass posted looks interesting
[17:37:01] suchness: hnanon: "Comparison" is a broad term with a broad answer.
[17:37:51] suchness: hnanon: Also, what you decide to do with the data after the comparison...
[17:38:08] suchness: hnanon: But as matthewd 13,000 record is trivial.