Activity Graph

Page 1 of 3 | Next »


[00:23:38] ModusPwnens: Quit: Page closed


[23:07:06] ModusPwnens: has joined #ruby
[23:07:24] ModusPwnens: I think i'm trying to do something strange with ruby. Is it valid to do nested inline rescue statements?
[23:08:34] ModusPwnens: Code example here:
[23:09:27] ModusPwnens: OK, here is the gist instead of pastebin:
[23:09:44] ModusPwnens: Seems like you can only do one level of nested inline rescues?
[23:10:56] ModusPwnens: i mean, no because it's contrived to be an example.
[23:11:23] ModusPwnens: oh wow, it was really just the parens.
[23:12:54] ModusPwnens: i hadn't thought to either. normally ruby is pretty smart about order of operations but i guess this time it needs help
[23:13:09] ModusPwnens: so does that mean the second rescue is just... not doing anything?
[23:16:43] ModusPwnens: leftylink: looks like you have to do test = (rawr(2) rescue rawr(4)) rescue rawr(5)
[23:17:27] ModusPwnens: havenwood: this is a contrived example. my real code does something a bit different but still throws an exception with raise "..."
[23:20:14] ModusPwnens: havenwood: I tried using string interpolation and the issue with the nested rescues remains
[23:22:24] ModusPwnens: i'm not sure I follow :(. What do you mean by ruby obfuscation submission?
[23:22:33] ModusPwnens: oh i see. that's clever.
[23:31:07] ModusPwnens: i'm moderately proficient in ruby but that seems a bit unexpected/unintuitive


[01:22:18] ModusPwnens: has joined #ruby
[01:22:53] ModusPwnens: So i'm trying to create a ViewModel for my ruby application. This ViewModel needs to have a field called "method", but I'm finding now that there is already a method called "method" as part of all ruby objects. Is there a way to replace that so I can use my preferred field name?
[01:26:30] ModusPwnens: @Eiam: Yes, i do. This is a ViewModel and I don't actually care if people try to use that "method" method on them. It's more valuable to me to have the "method" method be a getter.
[01:28:51] ModusPwnens: @Eiam: It just returns the corresponding field in the ViewModel. I literally just have attr_reader :method and i had no idea it was failing until I started to get weird argument errors when I tried to use it.
[01:29:19] ModusPwnens: @Eiam: seems that attr_reader silently fails if there is some sort of name conflict.
[01:31:24] ModusPwnens: Yeah, i just discovered that. The question is, how can I achieve my goal? Is it even possible?
[18:46:29] ModusPwnens: Quit: Page closed


[17:46:42] ModusPwnens: has joined #ruby
[17:49:40] ModusPwnens: style question: I have a block of code that I need to share within two different scopes in the same method. This shared block of code does NOT need to be shared outside of that method. Is it bad practice to use a proc/lambda for that to reflect that it doesn't need to be shared outside of the method?
[18:53:48] ModusPwnens: Quit: Page closed


[19:14:50] ModusPwnens: has joined #ruby
[19:15:31] ModusPwnens: can someone explain why I can't do "(".tr('(', '%28')? I can't find any documentation on this anywhere and its driving me nuts
[19:16:13] ModusPwnens: for some reason it unexpectly outputs "%" instead of "%28"
[19:18:19] ModusPwnens: Yeah, i'll have to resort to using gsub then
[19:25:55] ModusPwnens: Quit: Page closed


[04:38:54] ModusPwnens: Ping timeout: 260 seconds


[20:10:14] ModusPwnens: has joined #ruby
[20:10:22] ModusPwnens: How do I initialize a class variable from a self method in ruby?
[20:10:30] ModusPwnens: my googlefu appears to be failing me
[20:16:40] ModusPwnens: havenwood: I just have some complex initialization logic in a self method and I want to initialize a common variable using that logic instead of initializing it in two places. I use a class variable because this entire class is essentially a series of self methods
[20:18:42] ModusPwnens: matthewd:
[20:18:48] ModusPwnens: I've also tried doing:
[20:19:15] ModusPwnens: self.initialized_nested_hash and ClassName.initialize_nested_hash, but neither work.
[20:20:52] ModusPwnens: matthewd: oh. Maybe it's because i come from javaland, but seems like that would mess with the organization of this file as one lone method would be above some field and constant declarations
[20:20:55] ModusPwnens: or is that just ruby style?
[20:23:28] ModusPwnens: Obviously. My question is more: is it considered conventional or otherwise unremarkable to have variable and constant definitions sandwiched between method definitions?
[20:26:37] ModusPwnens: Or is there a way that using instance variables can avoid that type of sandwiching?
[20:30:33] ModusPwnens: oh i forgot about that. you can initialize a ruby variable in its getter method, which would eliminate that issue, wouldn't it?
[20:30:57] ModusPwnens: this class is never initialized, unfortunately.
[20:31:05] ModusPwnens: the only entry point into the class is from a self method.
[20:32:07] ModusPwnens: matthewd: I'm not a ruby expert, so you probably know more than me on this. The reason that it currently isn't is because it just does one thing and the object would never be re-used. There's also no state associated with the object really.
[20:33:21] ModusPwnens: It gets modified during the execution.
[20:33:30] ModusPwnens: but it needs to be initialized to something
[20:34:29] ModusPwnens: well, its state that needs to be maintained during execution. Once execution is over and the method returns, none of that state is needed anymore.
[20:35:40] ModusPwnens: and the reason i'm making it a class variable is that there are actually two entry points, but they are both self methods and i wanted to save the duplication of initialization


[17:08:36] ModusPwnens: has joined #ruby
[17:09:25] ModusPwnens: I'm trying to do an is_a? method call on a class to check it's type (I know this isn't the ruby way). The class I'm checking is defined in another module and I'm having trouble resolving uninitialized constant errors. Is there something I have to do to bring that class in so that I can use its class name?
[18:33:35] ModusPwnens: Quit: Page closed


[19:41:26] ModusPwnens: has joined #ruby
[19:41:55] ModusPwnens: Is it bad practice to refactor a large class by extending some related behaviour into a module that you just include back into that class?
[19:42:05] ModusPwnens: i'm having trouble finding best practices for modules to answer this question.
[19:42:32] ModusPwnens: No, it won't be used by any other class.
[19:43:06] ModusPwnens: it's also because the methods I'm encapsulating out are often changed but the rest of the code is not.
[19:43:33] ModusPwnens: so the idea was to extract all the commonly changed code that are all related so that engineers can just use that class for changes instead of peppering methods all over the other class.
[19:43:57] ModusPwnens: but i'm not sure if that's bad ruby as I'm not that experienced with ruby guidelines and best practices.
[19:44:10] ModusPwnens: in java, it would certainly be wierd, but in java you can't really do mixins like you can in ruby
[21:00:47] ModusPwnens: Quit: Page closed


[17:12:01] ModusPwnens: has joined #RubyOnRails
[17:12:26] ModusPwnens: How can I catch exceptions that bubble up in a rails engine? I want to alias them to a different type of exception.
[17:12:57] ModusPwnens: config.action_dispatch.rescue_responses doesn't work for me in this case because I need to look at something inside the exception to decide how to alias it
[17:33:51] ModusPwnens: tubbo: Where would I do that? Just in the engine.rb file? I know how I would do this for an actual rails app, but I'm not sure how for a rails engine..
[17:38:22] ModusPwnens: tubbo: I mean, I wrote the engine so it's not a problem to modify it
[17:41:27] ModusPwnens: tubbo: but... that's exactly what I want to do.
[17:41:45] ModusPwnens: tubbo: There are certain kinds of exceptions I want to check and re-throw as something else, so I'd like a global way of doing that throughout the engine.
[17:44:11] ModusPwnens: tubbo: No, I'll give the full explanation. This models engine exists to take output from some of our services and convert them into nice rails objects. The services are communciated with using java clients. The java clients will throw an exception for 4xx http errors and a different one for 5xx errors.
[17:44:53] ModusPwnens: tubbo: For the 4xx error ones, I want to look at the exception data to see the exact type of 4xx status and then I want to re-throw that as the corresponding rails exception for that status so that the downstream controllers and javascript handlers can handle the response correctly.
[17:46:04] ModusPwnens: tubbo: because then it would throw a 404 for all 4xx class errors
[17:46:21] ModusPwnens: tubbo: There's one exception for ALL 4xx errors, and then the actual status is inside the exception
[17:47:48] ModusPwnens: tubbo: There's many methods where I make a call that results in one of the java clients making a request. I could put a block in every single one of those places that does it, but i'd rather do it in a DRY way
[17:50:09] ModusPwnens: No, because the engine actually exposes active-record-like interfaces so clients don't actually know that under the hood a java client is being used.
[17:52:12] ModusPwnens: tubbo: Right. Oh, a detail i forgot to mention, the java clients themselves are the ones making the http requests and I don't have control over the java clients really.
[17:52:51] ModusPwnens: tubbo: It's hard to explain this problem without literally explaining the entire architecture.
[17:53:02] ModusPwnens: tubbo: As well as political things that are somewhat out of my control
[17:53:11] ModusPwnens: tubbo: Yeah, I agree. I didn't decide on it.
[17:53:37] ModusPwnens: tubbo: Oh, no.
[17:54:25] ModusPwnens: tubbo: No. My app gets an HTTP request from a web browser. My app then calls something like ModelThatsActuallyBackedByJavaClientsAndNotAR.find({id})
[17:55:02] ModusPwnens: tubbo: that model is located inside this rails engine, which then uses a java client to talk to the service that manages that model, and then the data is returned and the rails engine converts the response into nice rails models.
[17:56:38] ModusPwnens: tubbo: Depends. The incoming HTTP requests or the outgoing HTTP requests to the services?
[17:56:48] ModusPwnens: tubbo: Yes. This is actually Jruby on Rails.
[17:57:24] ModusPwnens: tubbo: Yeah, but none of this would have actually mattered if I didn't have to explain my entire architecture.
[17:57:47] ModusPwnens: tubbo: The fact that this is JRuby changes little. So we can treat it as if it's regular ruby on rails.
[17:59:53] ModusPwnens: tubbo: JRuby barely changes anything when it comes to actually working with the rails stack. It's as if it's not even there. All standard rails guides and practices still apply and are unaffected
[22:46:26] ModusPwnens: Quit: Page closed


[00:19:48] ModusPwnens: has joined #RubyOnRails
[00:20:00] ModusPwnens: How do I intercept exceptions in a rails engine and throw something else instead?
[00:23:15] ModusPwnens: This is actually more of a Jruby on Rails engine. We have some java clients that are making calls and when they fail because of a 404, it ends up getting wrapped in a 500. I want to re-wrap it back in a 404.
[17:18:48] ModusPwnens: Quit: Page closed


[22:57:08] ModusPwnens: has joined #RubyOnRails
[22:57:20] ModusPwnens: Is there a way in rails to pass an array to a select option?
[22:57:38] ModusPwnens: I've been scouring stackoverflow and documentation and I'm turning up nothing.
[22:59:45] ModusPwnens: smathy: What's the usual way? I've tried this:, but it just results in a comma separated string of values
[23:02:09] ModusPwnens: I've also tried this and it resulted in the same comma separated string of values:
[23:11:24] ModusPwnens: smathy: Well, i'd just like to see if there's a nice rails way to do this such that when the server receives those parameters, it knows how to parse them into a native ruby array, saving me the trouble of doing a string split
[23:11:41] ModusPwnens: smathy: Not a big deal if I can't do it, but it seems like something rails has
[23:16:08] ModusPwnens: smathy: Technically nothing, as this is supposed to be reflected in markup that doesn't result in a visible change on the page.
[23:17:10] ModusPwnens: smathy: But I would like to see something like values[]="terminated, aborted, etc", such that rails can convert that into an array. I've done it before by appending [] to the attributes I want parsed as lists, but I'm having less success here.
[23:20:36] ModusPwnens: smathy: No. I am hoping for an option that a user can select called 'not-active', which then maps to all the various non-active states behind the scenes.
[23:24:18] ModusPwnens: smathy: Yeah, precisely.
[23:25:36] ModusPwnens: smathy: This is a filter for accounts and there is no mutation that occurs.
[23:26:21] ModusPwnens: smathy: And gotcha. I'll just have to resort to splitting the string on commas in the controller then.
[23:54:30] ModusPwnens: Ping timeout: 250 seconds


[06:47:46] ModusPwnens: has joined #RubyOnRails
[06:48:58] ModusPwnens: Does anyone know how to click a download link with capybara and poltergeist? Even when the download request seems to hit the server and succeed, when I check the headers they appear to be for the original html request.
[08:08:32] ModusPwnens: Quit: Page closed


[00:12:48] ModusPwnens: has joined #RubyOnRails
[00:13:01] ModusPwnens: Has anyone been able to get poltergeist/capybara to scroll to the bottom of the page?
[00:37:02] ModusPwnens: cnk: Yeah, i know. I'm trying that but it's not working properly. I'm printing screenshots and the viewport doesn't seem to change either.
[00:37:59] ModusPwnens: cnk: sleeping doesn't help. However, printing a screenshot does, for some strange reason
[00:59:37] ModusPwnens: I'm seriously at my wit's end here. I'm trying to get poltergeist to scroll to the bottom of the page so I can test infinite scrolling, but nothing works unless I take a screenshot after the execute_script command. Anyone have any experience with this?
[01:21:37] ModusPwnens: bronson: Actually, i figured out the problem.
[01:23:30] ModusPwnens: bronson: It's because I needed more 'expect' calls to wait for things. I only had an expect for the original page load as well as the elements that I was waiting to be inserted on the page.
[01:24:04] ModusPwnens: bronson: However, on page load, I'm populating a hidden div with prefetched results that I insert into the DOM when the user scrolls to the bottom, and I was not waiting for that to happen
[01:24:23] ModusPwnens: bronson: so the headless browser was scrolling to the bottom of the page before there was anything ready to actually append to the list of items.
[01:31:48] ModusPwnens: cnk: Yep. It was doing exactly what it was supposed to. My assumptions were wrong. If I only had a dollar for every time that happened...
[01:45:06] ModusPwnens: Quit: Page closed
[18:26:13] ModusPwnens: has joined #RubyOnRails
[18:27:01] ModusPwnens: I need to make some async calls in my before(:all) block of an rspec test to setup test data. Would it be bad practice to use capybara expectations in the before block just to use their implicit wait_until functionality?
[21:55:13] ModusPwnens: Quit: Page closed


[18:03:28] ModusPwnens: has joined #RubyOnRails
[18:04:24] ModusPwnens: I have several services that my website talks too and they need several clients configured and setup. As part of that process, we have to make some external network calls. What is the appropriate place for something like that in rails? An initializer?
[18:05:44] ModusPwnens: workmad3: Hmm okay. That's what I'm currently doing. My problem though is that my build host is sandboxed and it fails to build because the build is making network calls (trying to setup the initializers).
[18:28:08] ModusPwnens: Quit: Page closed


[19:23:01] ModusPwnens: has joined #RubyOnRails
[19:23:50] ModusPwnens: My controller received a request to download a pdf, but the underlying resource doesn't exist. I want to redirect to a 404, but no matter what I try, the content type of the response is pdf. This causes the browser to try and use a pdf viewer, which is not the best experience.
[19:24:11] ModusPwnens: How do I get the response type to change to html when the pdf download request fails and I want to show an error view?
[19:24:44] ModusPwnens: I tried that, but with render htm: '<view_name>'
[19:25:30] ModusPwnens: is there a way to change it?
[19:25:35] ModusPwnens: or is that bad form anyways?
[19:25:47] ModusPwnens: it just seems silly to have this pdf viewer with a blank page when it should really be a 404
[19:25:57] ModusPwnens: i've tried a redirect to, but it seems to still keep the original request format
[19:40:22] ModusPwnens: SteenJobs: Hahaha, thanks.
[21:04:31] ModusPwnens: Quit: Page closed


[01:26:15] ModusPwnens: has joined #ruby
[01:27:41] ModusPwnens: If I have'100.5'), how do I convert that to a string where I require two digits after the decimal point? Is there a cleaner solution than this?
[01:28:21] ModusPwnens: I've read the BigDecimal docs but I can't find a way to do this without doing something wonky like the linked answer, or something equally wonky.
[01:40:03] ModusPwnens: I'm not familiar with that expression..
[01:42:53] ModusPwnens: That's unsatisfying. I really wish there was a better way. It makes me nervous to do something like this for a financial application.
[01:52:39] ModusPwnens: Ox0deb: Can't you also represent currency correctly using decimals? I know you're gonna have a bad time if you try to use floats to store currency, but can't you use both decimals and integers to handle currency properly?
[01:58:36] ModusPwnens: bnagy: Why is that nonsense?
[01:58:59] ModusPwnens: Ox0deb: And yes. But to answer your question, the reason that I'm not representing it as an integer is because this is a client and our services represent them using BigDecimals.
[01:59:37] ModusPwnens: bnagy: Agreed that it has nothing to do with arithmetic, but why does that make it nonsense?
[02:00:27] ModusPwnens: bnagy: I suppose that's true, but I want '4.20' which is a string, so as a string it's not nonsense. :/
[02:02:42] ModusPwnens: Ox0deb: Yeah, couldn't you also do'100.5').to_s('F') + '0' if'100.5').modulo(0.1).zero?
[02:03:30] ModusPwnens: Ox0deb: It totally does, which is why i'm here asking lol.
[02:05:09] ModusPwnens: eam: Yeah, I'm familiar with the problems of floats. I just wish BigDecimal would preserve precision when calling to_s.
[02:09:45] ModusPwnens: Ping timeout: 252 seconds


[18:27:58] ModusPwnens: has joined #RubyOnRails
[18:28:48] ModusPwnens: If you want to add the ability to download a CSV representation of a model (or list of models), whose responsibility is that? I've seen a lot of examples of peopple adding a .to_csv method to their model, but is that the model's responsibility? Or is it more the view's?
[21:52:31] ModusPwnens: Ping timeout: 252 seconds


[00:06:35] ModusPwnens: Quit: Page closed


[21:03:59] ModusPwnens: has joined #RubyOnRails
[21:04:55] ModusPwnens: Let's say you have a data-remote form and there is a failure during server-side processing. Is it possible to redirect to an ErrorController and execute some JS in response to the failuire?
[21:05:13] ModusPwnens: I'm trying that currently and it does successfully return some javascript, but the javascript does not actually get evaluted and executed.
[21:22:10] ModusPwnens: I figured out my issue, sort of. Pastie:
[21:23:06] ModusPwnens: Do you have to preserve a content-type header or something across internal redirects in order for this to work?


[00:45:35] ModusPwnens: How do I resolve the error "Unable to autoload constant VERSION, expected <path>"? It was working fine until I upgraded our rails site from 4.0 => 4.2. Autoloading lib in our engine doesn't seem to be working anymore...anyone run into this?
[00:48:09] ModusPwnens: uhh, okay. Here:
[00:49:05] ModusPwnens: full error, with path removed: Unable to autoload constant VERSION, expected <path>/version.rb to define it"
[00:49:22] ModusPwnens: Sorry, it should be model_base. it's a copy paste error.
[00:51:35] ModusPwnens: Radar: Not sure. I haven't tried that yet. It's not trivial for me to do that in the environment that I'm working on so I normally do that as a last resort
[00:52:35] ModusPwnens: Radar: I figured. It was sort of a long shot. I was wondering if anyone knew of any autoloading lib issues with a rails 4.0 => 4.2 upgrade. Looks like i have my work cut out for me then.
[15:34:55] ModusPwnens: *.net *.split


[21:53:23] ModusPwnens: has joined #RubyOnRails
[21:54:23] ModusPwnens: I just upgraded from rails 4.0 to rails 4.2 We have an engine that we are using for this application as well (which is using rails 4 still). After the upgrade, it complains about not being able to find the engine version constant, which is defined in version.rb in the lib folder and should be autoloaded. After the upgrade, it's not autoloaded anymore. Has anyone run into this?


[20:37:08] ModusPwnens: has joined #ruby
[20:37:48] ModusPwnens: How can I modify the PATH for a shell command in a rake task? I can do it within the shell command, but there are several shell commands that I want to modify the path for and it does not seem DRY to duplicate it in each one.
[20:38:16] ModusPwnens: I've tried changing it with another shell command, only to find out each SH command has its own context and so changing the path in one will not affect others. I also tried setting ENV['PATH'], but that did not work either.
[22:02:18] ModusPwnens: Ping timeout: 246 seconds


[00:26:47] ModusPwnens: has joined #RubyOnRails
[00:27:10] ModusPwnens: Our team is implementing the presenter pattern in our rails website. Does it matter if you construct your presenter in your controller vs in your view?
[00:30:18] ModusPwnens: There's no pitfalls of doing it one way vs the other? I didn't think that there was, but I wanted to ask people smarter than me :)
[04:02:24] ModusPwnens: Ping timeout: 246 seconds


[20:04:35] ModusPwnens: has joined #RubyOnRails
[20:05:53] ModusPwnens: I've got a rails engine in which I have a class that has an acronym in it (E.g. OAuth). Seems like rails autoloading expects that to look more like 'Oauth'. I've tried adding a config/initializers/inflections.rb file with an acronym, but that didn't fix the autoloading issue. Any recommendations?
[20:37:30] ModusPwnens: Ping timeout: 246 seconds


[05:41:12] ModusPwnens: Ping timeout: 246 seconds


[22:44:45] ModusPwnens: has joined #RubyOnRails
[22:45:20] ModusPwnens: Is there a reason why you would want to memoize your getters vs just initializing them once in your initialize method? Article I'm referencing:
[22:48:11] ModusPwnens: Yeah, but this is a presenter, so every single one of these instances will always be accessed.
[22:48:29] ModusPwnens: if you know that you will always access your instance variables, is there any value in memoization or lazy initialization?
[22:54:51] ModusPwnens: Ping timeout: 246 seconds
[22:55:07] ModusPwnens: has joined #RubyOnRails
[22:55:28] ModusPwnens: I always disconnect after receiving the first message. how odd.
[22:56:20] ModusPwnens: smathy: Haha, Yeah. I use it enough I probably your question though, what do you mean by two different styles?
[22:58:26] ModusPwnens: smathy: Well, all our presenters will be using the same style. We are just trying to decide if we should do lazy initialization or do it all in the initialize method
[23:00:29] ModusPwnens: No, there are all the other typical RoR components.
[23:02:03] ModusPwnens: Well... I guess it's because we don't just have typical poros we are using besides these. Everything else is either a module we don't instantiate, or a model using ActiveX something, which is initialized using a hash


[03:54:39] ModusPwnens: Ping timeout: 246 seconds
[18:09:45] ModusPwnens: has joined #RubyOnRails
[18:10:17] ModusPwnens: We have a service returning resources with slashes in the id, which is messing up all our routing. Is there some standard rails way of dealing with this?
[18:18:45] ModusPwnens: Disconnected by services
[18:19:37] ModusPwnens: has joined #RubyOnRails
[18:20:05] ModusPwnens: rhizome: We just need to be able to route to show actions properly. Right now the only thing we can think to do is just whitelist all characters in the path
[18:20:22] ModusPwnens: but that means that we won't be able to have any routes nested underneath that, which works for now but is less than ideal.
[21:46:21] ModusPwnens: Ping timeout: 246 seconds


[22:30:38] ModusPwnens: has joined #RubyOnRails
[22:30:58] ModusPwnens: Does anyone know if doing nested presenters is a bad idea? Or if there are alternatives?


[18:07:48] ModusPwnens: Ping timeout: 246 seconds


[22:24:06] ModusPwnens: Ping timeout: 246 seconds
[22:46:14] ModusPwnens: has joined #RubyOnRails


[21:46:06] ModusPwnens: has joined #RubyOnRails
[21:46:20] ModusPwnens: Does someone have a good resource for validation conventions in rails?
[21:46:42] ModusPwnens: I know that if you are doing validations on a model, then that should go in the model. I also know that if you are doing validation on the existence of parameters, you should use strong parameters for that.
[21:49:12] ModusPwnens: But for this case, the user is essentially providing a token in the form. If the environment is production, I want to make a call to a service with that token to verify they have permissions for that action. Should that go in a before_action filter?
[21:50:09] ModusPwnens: smathy: I know it's not 'about' validating presence, but you can basically use it for that by doing params.require(:some_param)
[21:50:31] ModusPwnens: Or is that a misuse of strong params?
[21:51:01] ModusPwnens: smathy: What do you mean, "you can't". You totally can and it works and it results in a 400 error.
[21:51:29] ModusPwnens: smathy: No, but it validates that the attribute exists in the request.
[21:51:48] ModusPwnens: smathy: Yes, I know. I never claimed otherwise.
[21:53:31] ModusPwnens: " I also know that if you are doing validation on the existence of parameters, you should use strong parameters for that." <- my original message. I said I was just validating existence.
[21:54:31] ModusPwnens: smathy: Okay, what's the word for checking whether or not a parameter exists? that's the word I meant to use.
[21:55:38] ModusPwnens: Okay, so it was a semantics thing. my bad.
[21:55:59] ModusPwnens: ignoring that, what about my other question?
[21:56:20] ModusPwnens: where I want to perform a service call on a token in the request to check for permissions. Is that a good candidate to put in a before_action filter?
[22:16:16] ModusPwnens: smathy: So instead of a before_filter, would you just do the check in the action itself?
[23:45:12] ModusPwnens: I stepped away for a bit, but previously I was talking about whether or not something belonged as a before_action filter and the consensus was that it didn't. So, in general, when does something belong in a before_action filter? Is there some sort of guideline?
[23:51:05] ModusPwnens: bricker: That sounds like a good heuristic. So if it's an action specific check, it doesn't belong as a before_action filter. Is there some rails conventions doc/guide that talks about this?


[00:55:42] ModusPwnens: Quit: Page closed


[21:46:23] ModusPwnens: has joined #RubyOnRails
[21:47:49] ModusPwnens: When should I consider packaging something as a model? Right now, the entity in question is not persisted. It's populated using GETs to other services, and there is some sort of massaging with the response of that call to display it in a view-friendly way. Does it make sense to put that in a non-active record model, or does it suffice to just use helpers to prettify it for the view?
[21:54:29] ModusPwnens: Disconnected by services
[21:54:58] ModusPwnens: has joined #RubyOnRails
[21:55:05] ModusPwnens: Radar: Sorry about that, I disconnected.
[21:55:16] ModusPwnens: Radar: Could you repeat your questions? I lost the chyat.
[21:56:25] ModusPwnens: Radar: Oh dang. I didn't know about that. And now looking at the title at the top, I see that it's there. I feel silly now.
[21:57:06] ModusPwnens: Radar: I'm not storing a local representation because the request is quick enough that we can simply wait for it to return and then dump the results on the page.
[21:57:50] ModusPwnens: Radar: I always thought things only go into the models folder if they have some sort of underlying database interaction.
[21:58:15] ModusPwnens: Radar: Is that the wrong heuristic to use when trying to decide what to create as a "model"?
[21:59:35] ModusPwnens: Radar: In that case, when does something turn from a service object into a model?


[00:54:51] ModusPwnens: Ping timeout: 246 seconds


[18:09:34] ModusPwnens: When people add roles to their User objects, do they normally use an enum to contain possible values or do they just have conditional checks on symbols everywhere for access controls?
[18:12:09] ModusPwnens: Disconnected by services
[18:12:33] ModusPwnens: has joined #RubyOnRails
[18:12:49] ModusPwnens: Sorry about that. I DCed and didn't get any of the past conversation regarding enums and user roles.
[18:13:21] ModusPwnens: For the record, my users aren't being persisted. I'm just using LDAP and POSIX groups to determine access level.
[18:14:06] ModusPwnens: tubbo: Is there a general 'ruby' strategy I would use for this? Or do I just have checks like @current_user.role == :admin
[18:14:40] ModusPwnens: tubbo: I only worry about that because that means if I ever change the admin role or delete it or something, I have checks peppered everywhere using symbols that don't actually exist.
[18:15:36] ModusPwnens: tbuehlmann: What do you think about this?
[18:18:36] ModusPwnens: tubbo: Is it bad ruby practice to just have checks on raw symbols from another class?
[18:19:18] ModusPwnens: E.g., @current_user.role == :some_symbol, where the symbol is assigned to role elsewhere
[18:19:54] ModusPwnens: tbuehlmann: Yes, hence my concern.