« Back to channel list

#RubyOnRails - 31 March 2016

« Back 1 day Forward 1 day »
[00:01:17] keegnotrub: has joined #RubyOnRails
[00:02:09] uglybandersnatch: has joined #RubyOnRails
[00:03:53] jstransky: has joined #RubyOnRails
[00:06:34] benlieb: has joined #RubyOnRails
[00:07:29] P4Titan: For the :dependent option to belongs_to, why does the doc say this: "You should not specify this option on a belongs_to association that is connected with a has_many association on the other class. Doing so can lead to orphaned records in your database."
[00:07:36] kailido: can i pass a local variable in this? --> <%= render @performance_indicator.improvement_actions.order("created_at DESC") %>
[00:08:17] Radar: kailido: what kind of local variable
[00:08:40] Ropeney: has joined #RubyOnRails
[00:08:47] kailido: some number for example
[00:08:59] P4Titan: http://guides.rubyonrails.org/association_basics.html#the-belongs-to-association section 4.1.2.4
[00:10:54] arthurl: Radar sorry- not sure if you saw my responses above
[00:11:17] Radar: arthurl: Pastebin is blocked on my machine (intentionally). I was waiting for you to Gist it.
[00:11:37] Mattx: Radar, would you mind checking this? https://github.com/rails/rails/issues/23550
[00:11:41] arthurl: Radar sorry :) https://gist.github.com/alyssenko/4e8d6e1d701957b7ef6834cbe7bd7bd8
[00:11:43] Mattx: I just sent a comment
[00:12:32] Radar: Mattx: what is the controller you're trying to match there?
[00:12:43] Arcaire: Fuck me, I hope that's deprecated.
[00:13:23] Radar: Mattx: It looks like you're trying to make life hard for the next dev with that regex.
[00:13:49] shmilan: has joined #RubyOnRails
[00:13:50] Mattx: it's not that hard. I'm just trying to match namespaced controllers without listing them all on the route files.
[00:14:08] anoob: has joined #RubyOnRails
[00:14:14] Mattx: in the example, I'm trying to match "domains/analyze#handle"
[00:14:26] Mattx: I mean, that's the code I want to execute
[00:14:28] Radar: Why are you trying to write clever code instead of implicit code.
[00:14:30] Arcaire: List of reasons why this is a good idea:
[00:14:36] Radar: WTB question-marks
[00:14:38] Mattx: the url is /domains/analyze
[00:15:01] Radar: Controller class is defined as Domains::Analyze?
[00:15:08] Radar: Or something like that?
[00:15:14] edwinvdgraaf: has joined #RubyOnRails
[00:15:20] anoob: the "prompt: true" parameter for the "select_tag" method generates an option with "true" as text, is it normal? https://pastebin.mozilla.org/8865654
[00:15:23] sypheren: has joined #RubyOnRails
[00:15:26] Radar: ACTION wrote a lot of the routing documentation; knows things
[00:15:28] Radar: ACTION loves bragging
[00:15:32] Mattx: yep, the file is app/controllers/domains/analyze_controller.rb
[00:15:45] Mattx: class Domains::AnalyzeController < ApiController
[00:15:48] Radar: anoob: yes that is normal. Consider passing something like "Please select an option..."
[00:15:50] Radar: Mattx: ta
[00:16:01] Arcaire: anoob: :prompt
[00:16:04] Radar: Mattx: what actions are in that controller? Do you have some examples?
[00:16:07] Arcaire: anoob: http://apidock.com/rails/ActionView/Helpers/FormTagHelper/select_tag
[00:16:20] Radar: Arcaire: should they _promptly_ read the docs?
[00:16:25] Mattx: only one action at the moment, which is "handle"
[00:16:26] kailido: its not possible to pass the variable ?
[00:16:30] kies: has joined #RubyOnRails
[00:16:39] Radar: kailido: What have you tried
[00:16:43] anoob: "collection_select" seems to generate this text for me ...
[00:16:48] anoob: thanks Radar and Arcaire!
[00:17:05] kailido: <p> <%= render @performance_indicator.improvement_actions.order("created_at DESC"),locals: {zone: 5} %></p>
[00:17:10] Arcaire: ACTION increases 'thanks' tally on wall by one.
[00:17:21] Radar: kailido: No need for the locals wrapping
[00:17:27] Radar: <%= render @performance_indicator.improvement_actions.order("created_at DESC"), zone: 5
[00:17:33] Radar: Mattx: https://gist.github.com/radar/e5dd4c9f5b36f1b7953898175299d561
[00:17:36] Radar: That is how I would write it.
[00:18:02] Mattx: Radar, I know I can do that, but I don't want to list all controllers
[00:18:05] kailido: undefined local variable or method `zone'
[00:19:08] Radar: kailido: I have no idea then, sorr.y
[00:19:30] Mattx: the problem is that multiple people is in charge of the different APIs provided, so I'm developing an endpoint to put them all together, and I don't want our developers having to edit the route file to setup one
[00:19:40] Mattx: Radar, Arcaire: why ^
[00:20:08] Radar: Mattx: Ok. I can't help with this one.
[00:20:43] Mattx: What do you think about the doc? maybe it's not implemented, but it's weird that on the debug input works...
[00:21:04] Radar: Seems weird that it would match in the search field but not in the routes.
[00:21:09] Radar: But again: this is not how I would do it.
[00:21:27] Mattx: would you list all apis?
[00:21:50] arthurl: Radar I pasted the gist above
[00:22:05] Radar: Because then it is explicit in the routes file what APIs have what routes.
[00:22:37] Radar: arthurl: Ok, that's not quite enough info... I think I would need to see this happening for myself in order to debug it.
[00:22:38] Arcaire: arthurl: Ruby 1.9.3 is beyond EOL
[00:22:53] Arcaire: Like, even Ruby 2.0.0 is EOL
[00:23:06] arthurl: i know- i'm just a devops guy unfortunately :)
[00:23:09] arthurl: i don't make the calls around here
[00:23:20] Arcaire: The issue is probably "your ruby version is almost older than the company".
[00:23:29] Arcaire: Running a version that outdated is irresponsible.
[00:23:46] Infinite_182: has joined #RubyOnRails
[00:24:13] Mattx: btw, I'm doing all this because I haven't found a way to integrate all APIs while keeping them independent from one another
[00:24:40] Mattx: maybe rails engines is the closest, but still a lot of overhead
[00:24:41] ramfjord: has joined #RubyOnRails
[00:24:43] Arcaire: Mattx: Namespacing?
[00:25:11] Mattx: yep, keeping everything into independent folders for instance (namespacing)
[00:25:26] Mattx: controllers, models, migrations, etc
[00:25:27] jenrzzz: has joined #RubyOnRails
[00:25:35] Arcaire: If you want them that separate then just write three apps or something.
[00:25:36] Mattx: it's painful, I haven't found anything better though :(
[00:25:37] arthurl: my question is why does command line ruby -v show '1.9.3p484' and the apache/passenger output only shows '1.9.3'
[00:25:48] Arcaire: arthurl: Brevity, mostly
[00:26:07] Mattx: Arcaire, no, because I'm using the same models to keep track of apis keys, quota limits, etc
[00:26:18] Arcaire: Mattx: Your way is just going to end up as bad as any other way, with the added pain of anyone opening your routes file immediately closing it, opening Microsoft Word, and titling the new document "Notice of Resignation".
[00:26:19] Mattx: the same tables I meant
[00:26:55] Mattx: Arcaire, I seriously haven't found any good way. what's your suggestion?
[00:27:05] Arcaire: I don't really understand what you're trying to do, tbh.
[00:27:31] Arcaire: A good portion of people, probably above 90%, misuse the term "API" in awesome ways, so I automatically stop paying attention to it.
[00:27:38] ZerGabriel: has joined #RubyOnRails
[00:28:36] Mattx: I have something like 10 apis right now: /domains/analyze /apps/add /foo/bar etc
[00:29:02] Mattx: I'm creating a single endpoint for all of them, so we keep track of users keys, quotas, etc in one place
[00:29:20] Arcaire: That sounds horrendous.
[00:29:23] dtzuzu: has joined #RubyOnRails
[00:29:30] Arcaire: This is one of those times where "DRY" becomes "I before E except after C."
[00:29:32] Mattx: again: I seriously haven't found any good way. what's your suggestion?
[00:29:59] Arcaire: Be explicit in it all and write some shared tracking methods?
[00:30:42] ZerGabriel: has joined #RubyOnRails
[00:31:21] Mattx: so I repeat the tracking method, tables to keep users, and everything else in all 10 rails apps (one for each api)?
[00:31:42] ZerGabriel: has joined #RubyOnRails
[00:31:58] Mattx: Arcaire, I don't think that's a good idea either, honestly
[00:32:05] Arcaire: >in all ten rails apps
[00:32:20] webdestroya: has joined #RubyOnRails
[00:32:35] Arcaire: It sounds like you need to just write one, make it nice and modular and flexible, then use something like nginx to rename shit where you need to go.
[00:32:37] Rubie: has joined #RubyOnRails
[00:32:39] Arcaire: Be like Wordpress.
[00:32:45] Arcaire: One software, millions of very different sites.
[00:32:53] Arcaire: Don't be like Wordpress plugins, though. Those are horrible.
[00:38:57] ekinmur: has joined #RubyOnRails
[00:39:23] laputa: has joined #RubyOnRails
[00:40:30] laputa: Hi, anyone knows how to define a route that can PUT to /users ?
[00:40:43] ramfjord: has joined #RubyOnRails
[00:41:15] hnanon: Does Rails have a compass direction helper?
[00:41:42] Radar: laputa: put '/users', 'controller#action'
[00:41:43] helpa: Next question, please!
[00:41:46] Arcaire: put 'meme', to: 'meme#action'?
[00:42:13] georgedrummond: has joined #RubyOnRails
[00:43:20] Radar: I can't remember if you need the to: there or not.
[00:44:57] laputa: @Radar @Arcaire works! I was too stupid, trying to define that inside resource block =_=
[00:45:06] Arcaire: Radar: I do it for explicitness tbh. You probably don't need it.
[00:45:14] Radar: laputa: You can do that too. Look at collection in the routing guide.
[00:45:16] Radar: laputa: !routing
[00:45:16] helpa: laputa: http://guides.rubyonrails.org/routing.html - Rails Routing From the Outside In - Rails Guide - by Mike Gunderloy
[00:46:13] mrgreenfur: has joined #RubyOnRails
[00:47:55] laputa: @Radar `put 'test', on: :collection` ? i guess, is this way the url will be `/users/test` not `/users` .
[00:48:52] Radar: laputa: Good point.
[00:48:55] laputa: is there anyway to put that in collection block, but remains the resource url ?
[00:48:57] Radar: It must be nearly lunch time :)
[00:49:19] Radar: put '/', action: 'action_name_goes_here' maybe?
[00:49:47] laputa: hmm. sounds hacky. let me try :)
[00:52:04] shmilan: has joined #RubyOnRails
[00:55:04] eregi: has joined #RubyOnRails
[01:01:31] CanTonic: has joined #RubyOnRails
[01:03:05] shmilan: has joined #RubyOnRails
[01:04:20] FooMunki: has joined #RubyOnRails
[01:07:01] lyoshajapan: has joined #RubyOnRails
[01:09:37] ur5us: has joined #RubyOnRails
[01:17:17] twilling: has joined #RubyOnRails
[01:19:42] hotpancakes: has joined #RubyOnRails
[01:20:50] laputa: @Rader put '/' works too. thanks !
[01:34:04] rubyonrailed: has joined #RubyOnRails
[01:35:49] gabr13l: has joined #RubyOnRails
[01:36:03] shmilan: has joined #RubyOnRails
[01:36:49] djbkd: has joined #RubyOnRails
[01:38:30] georgedrummond: has joined #RubyOnRails
[01:38:45] bronson: has joined #RubyOnRails
[01:40:20] sevenseacat: has joined #RubyOnRails
[01:43:26] ur5us: has joined #RubyOnRails
[01:43:53] tycoon177: has joined #RubyOnRails
[01:44:47] laputa: hey guys, anyone knows how to permit an array params? if the params is something like [{id: 1, name: 'hello'}] .
[01:47:15] laputa: it seems like i need to do ` params.require(:_json).permit(_json: [:id, :name}) ` , rails automatically adds '_json' as the key to the root array.
[01:49:10] Aswebb_: has joined #RubyOnRails
[01:51:02] kailido: anyone knows if its possible to pass a variable to that partial? <%= render @performance_indicator.improvement_actions %>
[01:53:12] sudoubuntu: has joined #RubyOnRails
[01:53:48] moeabdol: has joined #RubyOnRails
[01:55:18] DoctorMonocular: has joined #RubyOnRails
[02:02:40] Rubie: has joined #RubyOnRails
[02:04:46] ur5us: has joined #RubyOnRails
[02:04:48] DragonPunch: has joined #RubyOnRails
[02:07:14] atrius: has joined #RubyOnRails
[02:07:38] bedouin_: has joined #RubyOnRails
[02:09:43] audy: has joined #RubyOnRails
[02:13:58] eyeamaye: has joined #RubyOnRails
[02:18:32] shmilan: has joined #RubyOnRails
[02:25:31] georgedrummond: has joined #RubyOnRails
[02:27:11] delgiudices: has joined #RubyOnRails
[02:27:37] IrishGringo: has joined #RubyOnRails
[02:27:52] G: has joined #RubyOnRails
[02:30:07] kies: has joined #RubyOnRails
[02:30:54] diegoaguilar: has joined #RubyOnRails
[02:32:48] Rixius: has joined #RubyOnRails
[02:33:42] Guest12: has joined #RubyOnRails
[02:33:44] bronson: has joined #RubyOnRails
[02:34:34] moeabdol1: has joined #RubyOnRails
[02:37:08] ur5us: has joined #RubyOnRails
[02:37:12] yfeldblum: has joined #RubyOnRails
[02:38:11] eregi: has joined #RubyOnRails
[02:39:42] _Tariq: has joined #RubyOnRails
[02:41:43] sudoubuntu: has joined #RubyOnRails
[02:45:15] shmilan: has joined #RubyOnRails
[02:45:37] georgedrummond: has joined #RubyOnRails
[02:45:55] mostlybadfly: has joined #RubyOnRails
[02:48:04] chagel: has joined #RubyOnRails
[02:48:55] hahuang61: has joined #RubyOnRails
[02:49:46] Tref: has joined #RubyOnRails
[02:52:09] owenjones: has joined #RubyOnRails
[02:53:35] sleungcy: has joined #RubyOnRails
[02:56:41] shmilan: has joined #RubyOnRails
[02:58:27] sneakerhax: has joined #RubyOnRails
[03:02:19] hxegon: has joined #RubyOnRails
[03:02:28] _Tariq: has joined #RubyOnRails
[03:07:31] baweaver: has joined #RubyOnRails
[03:08:41] _Tariq: has joined #RubyOnRails
[03:09:30] Cohedrin: has joined #RubyOnRails
[03:13:02] _Tariq: has joined #RubyOnRails
[03:14:06] shmilan: has joined #RubyOnRails
[03:14:22] G: has joined #RubyOnRails
[03:16:45] Rubie: has joined #RubyOnRails
[03:17:30] Ropeney: Anyone know a more "ruby" way to traverse a hash like such: https://gist.github.com/Ropeney/34619e5d82e3a32bb7fc3b23559c9579 ?
[03:18:39] braincrash: has joined #RubyOnRails
[03:21:12] sevenseacat: Ropeney: Hash#dig ? :)
[03:21:31] _Tariq: has joined #RubyOnRails
[03:22:18] matthewd: The really "ruby" way would be to not have a hash that looks like that :|
[03:22:45] matthewd: I hear these "object" things can come in handy
[03:22:46] sevenseacat: +1. i fought when a previous coworker wanted to add a dig equivalent to a codebase (before dig existed)
[03:23:02] sevenseacat: know the structure of your data
[03:23:20] Ropeney: is more for params, and nested nested attributes
[03:23:52] Ropeney: hmm but your right, a class would work
[03:23:58] matthewd: If you really want to go nuts: https://github.com/ManageIQ/more_core_extensions/blob/master/lib/more_core_extensions/core_ext/shared/nested.rb
[03:25:14] Ropeney: just fiddling with dnynamic filters on elasticsearch
[03:25:26] matthewd: fetch_path is dig; the rest thankfully don't have core equivalents [yet]
[03:26:49] alethea_: has joined #RubyOnRails
[03:27:06] jhill_: has joined #RubyOnRails
[03:27:23] baweaver: has joined #RubyOnRails
[03:27:48] daveomcd_: has joined #RubyOnRails
[03:28:08] c355E3B_: has joined #RubyOnRails
[03:28:44] _Tariq: has joined #RubyOnRails
[03:28:50] Ropeney: looks alot more robust then mine :(
[03:29:07] pfg__: has joined #RubyOnRails
[03:29:18] Nuck: has joined #RubyOnRails
[03:29:31] Lloyd__: has joined #RubyOnRails
[03:29:44] thomasfedb_: has joined #RubyOnRails
[03:29:57] targaf_: has joined #RubyOnRails
[03:30:07] UKn0Meh: has joined #RubyOnRails
[03:30:29] Lorn_: has joined #RubyOnRails
[03:30:33] ewilliam_: has joined #RubyOnRails
[03:30:43] artmann_: has joined #RubyOnRails
[03:31:17] Guest12896__: has joined #RubyOnRails
[03:32:21] abhishek_: has joined #RubyOnRails
[03:32:40] svkurowski_: has joined #RubyOnRails
[03:32:42] fryguy: ooh, new in ruby 2.3
[03:32:44] DiabolikFreenode: has joined #RubyOnRails
[03:32:50] kpwarr: has joined #RubyOnRails
[03:33:00] lord4163_: has joined #RubyOnRails
[03:33:04] sevenseacat: we're all using 2.3 right? >_>
[03:33:08] Jamo_: has joined #RubyOnRails
[03:33:20] kpwarr_: has joined #RubyOnRails
[03:33:21] raenk: has joined #RubyOnRails
[03:33:25] eduardodeoh_: has joined #RubyOnRails
[03:33:27] hoodow: has joined #RubyOnRails
[03:33:41] hoodow: has joined #RubyOnRails
[03:33:45] jwang: has joined #RubyOnRails
[03:33:49] Majadon: has joined #RubyOnRails
[03:33:51] _Tariq: has joined #RubyOnRails
[03:33:53] russt: has joined #RubyOnRails
[03:33:54] waldi_: has joined #RubyOnRails
[03:34:08] cjk101010: has joined #RubyOnRails
[03:34:25] fryguy: has joined #RubyOnRails
[03:34:28] Kilo`byte: has joined #RubyOnRails
[03:34:29] toydestroyer: has joined #RubyOnRails
[03:34:36] hxegon: has joined #RubyOnRails
[03:35:04] jnylen: has joined #RubyOnRails
[03:35:23] JonasOSDever: has joined #RubyOnRails
[03:35:48] llakey: has joined #RubyOnRails
[03:36:13] bronson: has joined #RubyOnRails
[03:36:16] borkdude: has joined #RubyOnRails
[03:36:41] uglybandersnatch: has joined #RubyOnRails
[03:37:05] _Tariq: has joined #RubyOnRails
[03:37:18] DukeDave: has joined #RubyOnRails
[03:37:24] alxndr: has joined #RubyOnRails
[03:37:33] amitchellbullard: has joined #RubyOnRails
[03:38:01] nyandoge: has joined #RubyOnRails
[03:38:05] RubyNewbey_____: has joined #RubyOnRails
[03:38:42] acalewin: has joined #RubyOnRails
[03:38:47] krainboltgreene: has joined #RubyOnRails
[03:38:48] podman: has joined #RubyOnRails
[03:38:49] darrik: has joined #RubyOnRails
[03:40:23] sudoubuntu: has joined #RubyOnRails
[03:40:28] gremax: has joined #RubyOnRails
[03:40:29] _Tariq: has joined #RubyOnRails
[03:41:10] Ropeney: sevenseacat, are you using 2.3 in production?
[03:41:50] Ropeney: for a while? and no issues?
[03:42:59] Ropeney: Good to know, I use it for personal use but nothing heavy
[03:44:08] _Tariq: has joined #RubyOnRails
[03:46:30] fryguy: there's this which is notable: https://bugs.ruby-lang.org/issues/11976
[03:47:56] Ropeney: doesn't that say fixed? Or do I read it wrong?
[03:48:05] sevenseacat: yeah, 1 day ago
[03:50:01] Aswebb_: has joined #RubyOnRails
[03:50:39] arBmind1: has joined #RubyOnRails
[03:56:10] trosborn: has joined #RubyOnRails
[03:56:25] trosborn: has left #RubyOnRails: ()
[03:57:02] Cervajz_: has joined #RubyOnRails
[04:01:13] georgedrummond: has joined #RubyOnRails
[04:01:19] moeabdol: has joined #RubyOnRails
[04:01:42] pawnbox: has joined #RubyOnRails
[04:01:51] merida: has joined #RubyOnRails
[04:02:15] gambl0re: has joined #RubyOnRails
[04:03:16] crystal77: has joined #RubyOnRails
[04:09:36] Radar: I have a Sidekiq worker which inserts records into the database. I want each worker to do their inserting serially... i.e. I don't want two workers to write to the database at the same time if it can be helped. What can do I to lock the table to ensure that this doesn't happen?
[04:09:48] Radar: I have the definition of a race condition.
[04:10:19] baweaver: one worker queue
[04:10:26] matthewd: > lock the table
[04:10:39] baweaver: I'd have to read into locking
[04:10:39] sevenseacat: yeah one worker i would say
[04:10:54] Radar: Sidekiq doesn't have something that I can say "pretty please run one worker" afaics
[04:11:35] Radar: upload = record.uploads.lock(true).find_or_create_by(url: path)
[04:11:37] Radar: Is that it?
[04:11:45] pawnbox: has joined #RubyOnRails
[04:12:29] matthewd: I don't think we actually have an API for locking a table
[04:12:54] smathy: Yeah there is.
[04:12:57] Arcaire: .uploads.with_lock do
[04:13:12] Radar: ACTION blinks
[04:13:15] Radar: was Arcaire actually being helpful
[04:13:24] smathy: Yeah, the with_lock is simpler.
[04:13:33] smathy: http://api.rubyonrails.org/classes/ActiveRecord/Locking/Pessimistic.html
[04:14:08] Radar: with_lock operates based on a single object though. I won't have an Upload object at that time.
[04:14:53] matthewd: Upload.transaction do; Upload.connection.execute('LOCK TABLE uploads'); upload = record.....; end
[04:14:55] Radar: Upload.lock("LOCK IN SHARE MODE") looks like it'll do the trick.
[04:14:56] smathy: Single row on the DB, yes.
[04:17:37] Arcaire: Radar: fwiw: https://github.com/mperham/sidekiq/wiki/FAQ#how-can-i-process-a-certain-queue-in-serial
[04:17:39] Arcaire: idk if you read that
[04:18:04] Radar: Arcaire: Yes, read it. Don't want to go down that path if it can be helped
[04:18:11] hxegon: has joined #RubyOnRails
[04:18:25] Arcaire: You can do it, but it's lame. I'd argue that locking the DB like that doesn't really solve your issue either.
[04:18:39] Arcaire: If they need to be inserted in order, how do you define which order if you're doing the same thing but just locking the DB?
[04:19:19] Arcaire: Unless I'm misunderstanding and the only thing you care about is serial insertion and not sequential insertion as well.
[04:19:22] Radar: Deadlock found when trying to get lock;
[04:19:25] DoctorMonocular: has joined #RubyOnRails
[04:19:33] Arcaire: Also yes, that.
[04:19:55] Radar: What's happening now is that multiple jobs have the same upload URL, and so when the UploadWorker runs it checks the DB to see if the upload with that URL exists already
[04:20:06] Radar: Both workers see that it doesn't, so they attempt to create it.
[04:21:58] smathy: ...and doesn't the transaction of one just fail to commit?
[04:22:23] smathy: Oh, you don't have a uniqueness constraint in the DB?
[04:22:56] Radar: I guess I could add one of those. Just concerned that it'll cause a lot of rollbars that we'll end up ignoring.
[04:23:20] matthewd: +1 add one of those
[04:24:23] lyoshajapan: has joined #RubyOnRails
[04:24:28] matthewd: You could then arrange to check for relevant-looking exceptions, and fail silently / without notification
[04:24:54] smathy: Yeah, I'd use that. Rollbacks that you ignore are cheaper than a select to check if the record already exists.
[04:24:55] Radar: I could re-enqueue the job if it detects that error I guess.
[04:24:56] duncannz: has joined #RubyOnRails
[04:25:06] Radar: I'll try it out. Thanks smathy and matthewd.
[04:25:31] smathy: Also, just to be sure, you're in Postgres right?
[04:25:49] Arcaire: How are you generating these values that should be unique?
[04:25:57] Radar: MySQL :((((
[04:26:10] Radar: Arcaire: Which values?
[04:26:20] smathy: Ah ok, so you should also make sure your transaction isolation is set to at least READ COMMITTED.
[04:27:50] Inside: has joined #RubyOnRails
[04:27:50] Inside: has joined #RubyOnRails
[04:28:18] Radar: Except the error it raises is... Mysql2::Error. Yay.
[04:28:22] smathy: I think REPEATABLE READ is now the default, but just check - not sure which version that was made.
[04:28:32] smathy: Yeah, you gotta look at the text.
[04:29:40] smathy: ...actually, I thought ActiveRecord::RecordNotUnique was used now, are you not using the model?
[04:30:29] Radar: I don't understand how using the model would fix this?
[04:30:41] Radar: model uniqueness constraint would do a find in the DB, which would still result in the same problem I'm having now?
[04:31:48] matthewd: https://github.com/rails/rails/blob/master/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L728
[04:31:58] smathy: No better, I was just confused because I was sure AR wraps that uniqueness constraint Mysql2::Error in a specific exception, no better (it's just looking at the text).
[04:32:15] smathy: There we go.
[04:32:35] pawnbox: has joined #RubyOnRails
[04:32:46] Radar: matthewd: does that come from a uniqueness validation on the model, or a constraint in the db?
[04:33:00] Radar: "Mysql2::Error: Duplicate entry 'http://www.bigimagerack.com/cfs/img/2014/9d89cd8c/weblrg.jpg-400' for key 'index_uploads_on_url_and_size':" That's the full error I'm getting now.
[04:33:10] matthewd: But, it uses that in place of StatementInvalid
[04:33:10] Radar: That code you have there is from master. is there an equiv in 4.2?
[04:33:44] Radar: https://github.com/rails/rails/blob/v4.2.6/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L769-L778
[04:33:46] Radar: Yes, supposedly.
[04:33:49] matthewd: If you're seeing the raw thing, either you're not going through AR at all, or you're seeing the .cause maybe?
[04:34:01] Radar: Definitely going through AR.
[04:34:41] matthewd: Yeah, so you should be getting an AR::StatementInvalid at worst, not a Mysql2::Error... we're supposed to always wrap those
[04:35:05] Radar: Checking our mysql2 version...
[04:35:09] dtzuzu: has joined #RubyOnRails
[04:35:22] joshhbk: has joined #RubyOnRails
[04:35:23] Radar: 0.4.2. Will upgrade to latest and retry.
[04:35:39] Radar: Although that's only 0.4.3... so I don't think that'll be it.
[04:36:05] fedexo: has joined #RubyOnRails
[04:36:38] matthewd: https://github.com/rails/rails/blob/4-2-stable/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb#L473-L474
[04:37:18] gambl0re: has joined #RubyOnRails
[04:37:18] gambl0re: has joined #RubyOnRails
[04:37:21] matthewd: Oh, is Mysql2::Error the true class you're getting, or is that part of the e.message?
[04:37:27] benlieb: has joined #RubyOnRails
[04:40:16] uglybandersnatch: has joined #RubyOnRails
[04:41:37] xardion: has joined #RubyOnRails
[04:43:36] d3f4alt: has joined #RubyOnRails
[04:44:20] paradisaeidae: has joined #RubyOnRails
[04:44:56] Radar: 15:28:04 job.1 | 2016-03-31T04:28:04.368Z 14674 TID-ox7putig8 WARN: Mysql2::Error: Duplicate entry 'http://www.bigimagerack.com/cfs/img/2014/9d89cd8c/weblrg.jpg-400' for key 'index_uploads_on_url_and_size': UPDATE `uploads` SET `filename` = 'weblrg.jpg', `size` = 400631, `finished` = 1, `updated_at` = '2016-03-31 15:28:04' WHERE `uploads`.`id` = 3879
[04:45:04] Radar: That's the full output from the Sidekiq worker.
[04:45:12] Radar: Mysql2::Error is the full thing I'm getting.
[04:45:20] Radar: I'll try to reproduce it outside of Sidekiq now.
[04:45:48] matthewd: I think that's just the message
[04:45:58] matthewd: Because it looks to be: https://github.com/rails/rails/blob/4-2-stable/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb#L455
[04:46:09] Radar: Yes, you're right. Outside of Sidekiq it's ActiveRecord::RecordNotUnique
[04:46:12] matthewd: AFAIK, the "real" mysql2 exception doesn't contain the query
[04:46:18] Radar: I'll rescue that exception and enqueue the job again.
[04:47:56] Radar: Well, don't even need to do that, really. I can just retry.
[04:47:59] Arcaire: bigimagerack.com is blank :(
[04:48:28] Radar: https://gist.github.com/radar/e37c4c4f526896df12039e6a1a039910
[04:49:32] hahuang61: has joined #RubyOnRails
[05:01:23] eyeamaye: has joined #RubyOnRails
[05:01:46] lyoshajapan: has joined #RubyOnRails
[05:04:31] ashishsingh173: has joined #RubyOnRails
[05:04:53] lyoshajapan: has joined #RubyOnRails
[05:06:45] smathy: Radar, if the path is the only attribute can't you just exit silently?
[05:06:58] smathy: If it failed because of RecordNotUnique then it's already there in the DB.
[05:08:41] Radar: smathy: yes
[05:17:59] eregi: has joined #RubyOnRails
[05:22:28] chagel: has joined #RubyOnRails
[05:22:40] Devalo: has joined #RubyOnRails
[05:23:20] lyoshajapan: has joined #RubyOnRails
[05:25:00] eyeamaye1: has joined #RubyOnRails
[05:29:39] Tref: has joined #RubyOnRails
[05:32:51] techsethi: has joined #RubyOnRails
[05:32:59] nickenchuggets: has joined #RubyOnRails
[05:32:59] nickenchuggets: has joined #RubyOnRails
[05:35:03] gingray: has joined #RubyOnRails
[05:36:38] rvanlieshout: has joined #RubyOnRails
[05:36:47] bronson: has joined #RubyOnRails
[05:37:07] andywww: has joined #RubyOnRails
[05:38:02] andywww: has joined #RubyOnRails
[05:38:09] arup_r: has joined #RubyOnRails
[05:38:24] hotpancakes: has joined #RubyOnRails
[05:38:55] DiabolikFreenode: has left #RubyOnRails: ()
[05:39:26] Diabolik: has joined #RubyOnRails
[05:39:51] Oog: has joined #RubyOnRails
[05:40:52] Oog: with render inline how do i prevent it from turning & into &amp; etc
[05:41:10] Radar: .html_safe
[05:41:44] Oog: i tried that it didnt actually fix it
[05:41:55] Oog: render(:inline => email_template.subject, :locals => template_params).html_safe still produced &amp;
[05:42:22] rvanlieshout: how are you using the result of that?
[05:42:34] Oog: right now just seeing in console the value
[05:42:47] krz: has joined #RubyOnRails
[05:42:49] rvanlieshout: then html_safe is not the issue
[05:43:00] rvanlieshout: what's the value of email_template.subject?
[05:43:11] Oog: email_template.subject = "<%= boo %>", template_params={:boo=>"hi & there"}
[05:43:25] Oog: oh you mean html_safe on boo
[05:43:40] rvanlieshout: aah like that. but that should be &amp; when used in html
[05:43:53] Palsson: has joined #RubyOnRails
[05:44:24] Oog: so it should render text
[05:44:31] Oog: maybe I need a :format => :text ?
[05:44:49] rvanlieshout: if this is the real deal just use template_params[:boo]? :)
[05:45:35] rvanlieshout: or use the erb utils directly
[05:46:03] Oog: this is just a sample
[05:46:11] rvanlieshout: that's why !fake is so relevant
[05:46:24] Oog: how do i specify format on render inline
[05:46:41] Macaveli: has joined #RubyOnRails
[05:46:51] DoctorMonocular: has joined #RubyOnRails
[05:47:10] Oog: html_safe in the template works but it seems to be rendering html so the real fix is to tell it to render text
[05:49:34] rvanlieshout: if you need text, why not use plain erb rendering?
[05:50:00] rvanlieshout: something like http://stackoverflow.com/questions/8954706/render-an-erb-template-with-values-from-a-hash
[05:50:21] hotpancakes: has joined #RubyOnRails
[05:50:53] Aswebb_: has joined #RubyOnRails
[05:53:06] Oog: that works thanks
[05:53:48] sandelius: has joined #RubyOnRails
[05:56:00] GitGud: has joined #RubyOnRails
[05:57:48] benlieb: has joined #RubyOnRails
[05:58:29] chouhoulis: has joined #RubyOnRails
[06:03:08] GitGud: has joined #RubyOnRails
[06:04:18] jkahn: has joined #RubyOnRails
[06:07:23] hotpancakes: has joined #RubyOnRails
[06:07:31] lyoshajapan: has joined #RubyOnRails
[06:09:18] dtzuzu: has joined #RubyOnRails
[06:10:39] arup_r: has joined #RubyOnRails
[06:17:19] andywww: has joined #RubyOnRails
[06:18:16] jenrzzz: has joined #RubyOnRails
[06:19:26] uglybandersnatch: has joined #RubyOnRails
[06:20:13] eyeamaye: has joined #RubyOnRails
[06:22:03] jkahn: has joined #RubyOnRails
[06:23:01] pawnbox: has joined #RubyOnRails
[06:27:24] nickjj_: has joined #RubyOnRails
[06:27:44] sandstrom: has joined #RubyOnRails
[06:27:54] sandelius: has joined #RubyOnRails
[06:32:23] segy: has joined #RubyOnRails
[06:35:08] bruce_lee: has joined #RubyOnRails
[06:36:21] User458764: has joined #RubyOnRails
[06:37:29] denaras: has joined #RubyOnRails
[06:39:25] oded: has joined #RubyOnRails
[06:39:33] darutoko: has joined #RubyOnRails
[06:42:29] sypheren: has joined #RubyOnRails
[06:44:36] noobda: has joined #RubyOnRails
[06:44:54] Babelfish: has joined #RubyOnRails
[06:45:21] noobda: hey guys what's the best way to learn Ruby on Rails? (beginner here)
[06:45:34] helpa: Rails 4 in Action - http://manning.com/bigg2 - An excellent book combining Rails and TDD/BDD development. Written by Rebecca Skinner, Steve Klabnik, Ryan Bigg, Yehuda Katz
[06:45:59] noobda: will check out
[06:46:21] baweaver: two of the authors actually frequent the channel too
[06:46:25] noobda: is this better than Micheal Hartl's book?
[06:46:37] davee_: has joined #RubyOnRails
[06:46:51] noobda: i found that to be overwhelming to be honest
[06:47:01] baweaver: I would say so
[06:47:10] baweaver: but I'm paid of... er.... biased
[06:47:31] sevenseacat: hello. I am one of the authors of Rails 4 in Action.
[06:47:58] baweaver: Careful not to get on their radar
[06:47:59] noobda: Wow that's pretty cool :o
[06:48:03] sevenseacat: I think R4IA is better because it goes a lot more in-depth and will get you a lot further down the path
[06:48:14] baweaver: ACTION laughs to himself
[06:48:18] sevenseacat: we focus on writing code and tests how we do it for real apps, not contrived examples
[06:48:29] sevenseacat: however, we do throw you in the deep end a little bit :)
[06:48:35] noobda: aah I see
[06:48:38] sevenseacat: baweaver: i see what you did there :P
[06:48:41] baweaver: sneaky name tagging is sneaky
[06:49:24] baweaver: In any case, I've read both and would lean heavily towards R4iA
[06:49:29] arup_r: has joined #RubyOnRails
[06:49:50] baweaver: though I also had a lot more experience when I read R4iA than I did when I read Hartl's book, hence the potential bias
[06:49:53] djbkd: has joined #RubyOnRails
[06:50:23] sevenseacat: oh I'm terribly biased, but I tried learning rails with michael hartl's tutorial and it was thoroughly disillusioning
[06:50:45] sevenseacat: 'do people really spend hours writing tests for setting a page title, or for rendering static content on a page...?'
[06:50:58] hotpancakes: has joined #RubyOnRails
[06:51:08] vale_tudo: has joined #RubyOnRails
[06:51:25] sevenseacat: also, auth from scratch at that point of learning is a 'wut...?'
[06:51:41] jstransky: has joined #RubyOnRails
[06:52:04] krz: has joined #RubyOnRails
[06:52:30] noobda: Yeah that's where I was overwhelmed, when they started with the user login/remember-me part
[06:53:05] sevenseacat: its good to know how to do, but its not something you'll code for yourself at any point likely
[06:53:32] Arcaire: Chiming in to say that r4ia is pretty much the best book out there for rails.
[06:53:44] Arcaire: ACTION wanders off again.
[06:53:45] sevenseacat: ACTION slips Arcaire and baweaver money under the table
[06:53:47] baweaver: those things (logins) are painful to make, and borderline impossible to do right at that.
[06:54:02] baweaver: ACTION accepts bitcoin
[06:54:27] sevenseacat: noobda: myself and Radar (one of the other authors) are generally here a lot helping out and are happy to answer any questions you have with the book, or help with any issues you face
[06:54:42] sevenseacat: or just general programming stuff in general :)
[06:54:43] baweaver: cheekiness aside, the only other book I would say is a good read is Rails 4 Testing Prescriptions.
[06:54:45] noobda: awesome! much appreciated man!
[06:54:54] sevenseacat: R4TP is a great book
[06:55:04] sevenseacat: noobda: I am not a man, but the sentiment is appreciated :)
[06:55:06] baweaver: covers testing in a lot more depth than a generic book.
[06:55:15] jstransky: has joined #RubyOnRails
[06:55:29] baweaver: ACTION imagines scene in Return of the King
[06:56:58] sevenseacat: I have a whole pile of programming books I could recommend on various topics
[06:57:22] sevenseacat: Practicing Rails is great for helping get over that 'okay I finished a tutorial... what now!?' feeling
[06:57:33] aganov: has joined #RubyOnRails
[06:58:14] sevenseacat: a little pricey though, that one
[06:58:50] Ropeney: sevenseacat, have you checked out "rebuilding rails" ?
[06:58:53] DoubleMalt: has joined #RubyOnRails
[06:58:57] sevenseacat: I've heard of it
[06:59:04] sevenseacat: haven't checked it out, been meaning to
[06:59:09] chouhoulis: has joined #RubyOnRails
[06:59:23] sevenseacat: I think I'm on the mailing list for it
[07:00:03] baweaver: tempting. Slightly old.
[07:00:11] Ropeney: and $49 for practicing rails is expensive? I think thats cheap compared to most books i --HAVE-- to buy
[07:00:21] baweaver: ACTION looks at unread stack
[07:00:26] baweaver: ACTION looks at new book
[07:00:31] baweaver: ACTION twitches
[07:00:34] Arcaire: ACTION looks at ebook stack
[07:00:40] sevenseacat: Ropeney: for what you get, i think it is a little overpriced, but I still recommend it
[07:00:54] sevenseacat: because it does help immensely with that overwhlemed feeling
[07:01:35] Arcaire: Now if only there was that for Elixir. <_<
[07:01:42] sevenseacat: don't give me ideas
[07:01:42] Arcaire: I don't get enough playtime with it.
[07:01:49] Arcaire: Giving you ideas.
[07:01:51] sevenseacat: ACTION downloads Rebuilding Rails free sample
[07:01:52] Arcaire: I'd buy it.
[07:02:23] srinidhi: has joined #RubyOnRails
[07:02:31] sevenseacat: well 30dwc does start tomorrow *twitches
[07:02:58] tvw: has joined #RubyOnRails
[07:04:30] sevenseacat: http://sevenseacat.net/2016/03/30/30-day-writing-challenge.html
[07:04:45] sevenseacat: now the fonts on my site are fucked up... what is wrong with the itnernet lately
[07:04:53] Arcaire: You never ended up using sevensea.cat? :(
[07:05:10] sevenseacat: i have it, it just redirects to sevenseacat.net
[07:05:49] neanderslob_: has joined #RubyOnRails
[07:06:04] rvanlieshout: sevenseacat: good luck! I'll try to follow your progress.. 1000 words a day is quite a challenge
[07:06:07] sevenseacat: ok, its just firefox thats broken. for about the tenth time today.
[07:06:11] yfeldblum: has joined #RubyOnRails
[07:07:28] brt: has joined #RubyOnRails
[07:07:36] Ropeney: 1000 words a day, do you include deleted ones? :P
[07:08:16] Ropeney: Good luck :D
[07:08:30] comrad: has joined #RubyOnRails
[07:08:42] Ropeney: I started blogging about assembly and project euler, then life priorities set in
[07:09:07] mark2: has joined #RubyOnRails
[07:10:17] wethu: has joined #RubyOnRails
[07:12:22] denaras: has joined #RubyOnRails
[07:12:35] eregi: has joined #RubyOnRails
[07:13:34] jstransky: has joined #RubyOnRails
[07:17:09] PaulePanter: Hi. One user seems to access a page with an old Chromium/Chrome browser, setting the HTTP accept header field incorrectly.
[07:17:17] PaulePanter: Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36
[07:17:24] PaulePanter: HTTP_ACCEPT : text/html;*/*
[07:17:33] PaulePanter: The ; should be a , I guess.
[07:17:56] PaulePanter: Should the middleware, HTTP server deal with such issues?
[07:18:06] PaulePanter: Or should RoR be patched?
[07:18:12] PaulePanter: … like in http://stackoverflow.com/questions/4905229/rails-3-and-strange-accept-headers/6178079
[07:18:33] ur5us: has joined #RubyOnRails
[07:19:23] sevenseacat: PaulePanter: looks like its been patched in rails 3.1?
[07:26:07] sandstrom: has joined #RubyOnRails
[07:28:10] mark2: has joined #RubyOnRails
[07:28:46] PaulePanter: sevenseacat: What do you mean? I forgot to mention that Rails 4.2.5.2 is used.
[07:29:00] sevenseacat: well the post you linked to says fixed in 3.1
[07:29:05] sevenseacat: as doesthe github issue
[07:29:24] sevenseacat: can you share your specific problem if it differs from those?
[07:29:47] mark2: has joined #RubyOnRails
[07:31:14] PaulePanter: I get the exception pasted in http://paste.debian.net/422906/ with a Rails 4.2.5.2 application.
[07:31:49] PaulePanter: In my opinion this is the fault of the old Chrome 32 browser setting the HTTP accept header field incorrectly. The list should be comma separated.
[07:32:13] sevenseacat: and what do those headers look like?
[07:32:58] PaulePanter: In my dream world, I’d like to handle that special case, by giving such users a special error page asking them to use a different browser or to update it.
[07:33:17] sevenseacat: let's look at the actual problem - its requesting an ics template
[07:33:29] sevenseacat: so what do the headers look like, do they mention ics?
[07:34:34] kwd: has joined #RubyOnRails
[07:35:55] mikecmpbll: has joined #RubyOnRails
[07:38:29] bronson: has joined #RubyOnRails
[07:40:08] PaulePanter: sevenseacat: Sorry, wrong paste. :(
[07:40:15] PaulePanter: This is the correct paste http://paste.debian.net/422908/.
[07:40:45] PaulePanter: Finally: http://paste.debian.net/422909/
[07:40:49] PaulePanter: sevenseacat: I am so sorry.
[07:40:59] PaulePanter: :formats=>["text/html;*/*"]
[07:41:25] PaulePanter: * HTTP_USER_AGENT : Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36
[07:42:13] sevenseacat: and the error?
[07:42:35] PaulePanter: An ActionView::MissingTemplate occurred in application#index:
[07:44:46] GitGud: has joined #RubyOnRails
[07:46:11] Pazician: has joined #RubyOnRails
[07:46:20] eyeamaye: has joined #RubyOnRails
[07:46:53] sevenseacat: seems like ; is supposed to separate the format from the q value
[07:48:44] Pazician: has joined #RubyOnRails
[07:49:35] mikecmpbll: has joined #RubyOnRails
[07:49:48] edwinvdgraaf: has joined #RubyOnRails
[07:50:33] hotpancakes: has joined #RubyOnRails
[07:50:42] tildes: has joined #RubyOnRails
[07:51:12] sevenseacat: PaulePanter: there are a whole pile of possible workarounds in this issue https://github.com/rails/rails/issues/4127
[07:51:28] kristofferR: has joined #RubyOnRails
[07:51:53] Aswebb_: has joined #RubyOnRails
[07:52:21] sevenseacat: including rescuing the exception and handling it, in which case you could match on the specific header that's causing you grief and advise them to upgrade
[07:55:33] marr: has joined #RubyOnRails
[07:56:31] artmann: has joined #RubyOnRails
[07:59:51] dtzuzu: has joined #RubyOnRails
[08:00:14] chouhoulis: has joined #RubyOnRails
[08:05:12] mikecmpbll: has joined #RubyOnRails
[08:05:24] petor: has joined #RubyOnRails
[08:07:05] jsrn: has joined #RubyOnRails
[08:08:30] workmad3: has joined #RubyOnRails
[08:09:56] krz: has joined #RubyOnRails
[08:10:46] arup_r: has joined #RubyOnRails
[08:11:37] sp1rs: has joined #RubyOnRails
[08:14:07] baweaver: has joined #RubyOnRails
[08:15:19] hamster88: has joined #RubyOnRails
[08:15:36] hamster88: Greetings everyone!
[08:15:58] hamster88: I have a question regarding escaping characters and sanitize
[08:15:59] User458764: has joined #RubyOnRails
[08:16:35] hamster88: I want the view to retain the stylings just don't execute the scripts and stuff
[08:16:44] hamster88: so far i tried doing like this > <%= simple_format ( truncate(sanitize article.content, length: 500)) { link_to "Continue", article_path(article) } %>
[08:17:20] hamster88: that prints the article this way > <h1><br></h1><h1><b>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Philosophy</b></h1><br><span>‘<b>Matz</b>’ (<b>Yukihiro Matsumoto</b>, creator of Ruby)
[08:17:46] rrawlins: has joined #RubyOnRails
[08:20:18] PaulePanter: sevenseacat: Thank you. I’ll read through the GitHub issue.
[08:21:18] agit0: has joined #RubyOnRails
[08:21:54] Spami: has joined #RubyOnRails
[08:24:12] SPYGAME: has joined #RubyOnRails
[08:24:18] Ergo: has joined #RubyOnRails
[08:29:23] moep: has joined #RubyOnRails
[08:31:59] hotpancakes: has joined #RubyOnRails
[08:32:27] myntcake: has joined #RubyOnRails
[08:32:59] uglybandersnatch: has joined #RubyOnRails
[08:37:33] edwinvdgraaf: has joined #RubyOnRails
[08:37:50] brt: has joined #RubyOnRails
[08:39:26] eregi: has joined #RubyOnRails
[08:50:35] dionysus69: has joined #RubyOnRails
[08:50:49] hotpancakes: has joined #RubyOnRails
[08:58:21] bruce_lee: has joined #RubyOnRails
[09:00:58] chouhoulis: has joined #RubyOnRails
[09:04:02] Ergo: has joined #RubyOnRails
[09:04:15] arBmind: has joined #RubyOnRails
[09:04:26] hotpancakes: has joined #RubyOnRails
[09:06:13] arBmind: has joined #RubyOnRails
[09:10:55] ql6wlld: has joined #RubyOnRails
[09:12:33] pawnbox: has joined #RubyOnRails
[09:13:14] willwright: has joined #RubyOnRails
[09:13:46] LowLifePerv: has joined #RubyOnRails
[09:14:55] willwright: has left #RubyOnRails: ()
[09:15:18] LowLifePerv: has joined #RubyOnRails
[09:15:51] willwright: has joined #RubyOnRails
[09:18:30] SweetHeart: has joined #RubyOnRails
[09:21:25] sp1rs: has joined #RubyOnRails
[09:26:33] merida: has joined #RubyOnRails
[09:27:26] Ergo^: has joined #RubyOnRails
[09:30:43] adaedra: has joined #RubyOnRails
[09:30:57] uglybandersnatch: has joined #RubyOnRails
[09:31:22] Ergo: has joined #RubyOnRails
[09:31:50] skislak: has joined #RubyOnRails
[09:32:27] User458764: has joined #RubyOnRails
[09:33:40] TvL2386: has joined #RubyOnRails
[09:33:45] Ropeney: has joined #RubyOnRails
[09:37:28] tvw: has joined #RubyOnRails
[09:40:32] bronson: has joined #RubyOnRails
[09:43:29] ferr: has joined #RubyOnRails
[09:45:13] mikecmpbll: is it possible to have a translation for 'foo.bar' and for 'foo.bar.baz' ?
[09:45:48] hotpancakes: has joined #RubyOnRails
[09:46:11] GitGud: has joined #RubyOnRails
[09:46:40] rvanlieshout: mikecmpbll: no
[09:46:46] mikecmpbll: rvanlieshout: ty :D
[09:47:46] SPYGAME: has joined #RubyOnRails
[09:48:48] GitGud: has joined #RubyOnRails
[09:49:18] techsethi: has joined #RubyOnRails
[09:50:57] renegadeandy: has joined #RubyOnRails
[09:51:43] chagel: has joined #RubyOnRails
[09:51:49] defsdoor: has joined #RubyOnRails
[09:52:20] mfoo: has joined #RubyOnRails
[09:52:56] Aswebb_: has joined #RubyOnRails
[09:53:35] mfoo: Hello. Is a record obtained through activerecord pessimistic locking outside of a transaction ever released unless done manually? I don't see any locks in InnoDB in this case. Does the activerecord object have a finalizer on it that releases the lock?
[09:53:55] arup_r: has joined #RubyOnRails
[09:54:54] arup_r: hamster88: so what is desired output? if you got the answer, ignore me
[09:55:52] sasasekaric: has joined #RubyOnRails
[09:57:58] snowy: has joined #RubyOnRails
[09:58:15] hamster88: I desired to implement styles that are being input by the user but don't want the html tags to show
[10:01:05] Peteykun: has joined #RubyOnRails
[10:01:17] sp1rs: has joined #RubyOnRails
[10:02:57] chouhoulis: has joined #RubyOnRails
[10:03:12] User458764: has joined #RubyOnRails
[10:03:43] hotpancakes: has joined #RubyOnRails
[10:04:43] syndikate: has joined #RubyOnRails
[10:04:44] mfoo: ah, my connection has autocommit enabled. that's where my locks are going.
[10:06:27] patrick_star: has joined #RubyOnRails
[10:08:41] SPYGAME: any volunteers for pair programming? i am going to restart my coding sessions to rebuild and polish further my programming skills and looking for someone to partner with preferrably more experienced. any suggestions are also much appreciated
[10:11:11] d0nn1e: has joined #RubyOnRails
[10:12:01] Spami: has joined #RubyOnRails
[10:13:48] tildes: spygame: where are you now, and what are your short / medium term goals?
[10:15:10] baweaver: has joined #RubyOnRails
[10:17:11] SPYGAME: tildes: my goal for the next (1-2) months is to get up and running again. i've been out for about one year now and lost that touch and also in terms of my development skills i'm a medium level programmer and i wanna take it to the next level. the end goal is to land a good job
[10:17:20] n008f4g_: has joined #RubyOnRails
[10:17:54] PlasmaStar: has joined #RubyOnRails
[10:18:13] krz: has joined #RubyOnRails
[10:18:20] tildes: spygame: no programming at all for the last year that is? what have you developed previously?
[10:18:41] tildes: (I'm asking this many questions because I think if there's a good match I could try it out)
[10:19:01] tildes: (I might not be much more experienced though, we can talk about that too)
[10:20:14] SPYGAME: small to medium scale applications. worked on CRMs, identity provider, ecommerce, analytics & reporting, scheduling & booking, payments etc
[10:20:58] SPYGAME: so my problem is not how to build things, i already know that. i wanna get to how to build things right
[10:21:23] Megamos: has joined #RubyOnRails
[10:21:48] SPYGAME: tildes: also email marketing was my very last project
[10:22:35] pawnbox: has joined #RubyOnRails
[10:22:36] tildes: spygame: I can totally relate to knowing how to get something work, but wanting to build it right
[10:23:54] leifcr: has joined #RubyOnRails
[10:24:40] SPYGAME: tildes: yeah so that's where i want to be but the immediate focus is to get started and be in that flow again
[10:24:42] tildes: my personal development challenge and need is testing, as it is something I can't really develop in my current role
[10:25:47] SPYGAME: tildes: right, that's also where i got stuck and still need more time to practice TDD
[10:26:22] tildes: other than that I think I'm 'ok' or 'relatively competent' with rails, although rails does come in many flavours
[10:27:30] eregi: has joined #RubyOnRails
[10:27:32] leifcr: has joined #RubyOnRails
[10:27:57] SPYGAME: tildes: i invested in some good resources which will help me to get much more deep understanding of the framework.
[10:28:29] SPYGAME: but procrastination is a big challenge. so for accountability it's good to have someone with you
[10:30:24] SPYGAME: tildes: i have never experienced pair programming at work throughout. it will be my first time
[10:30:52] tildes: spygame: neither have I, I've just heard about it
[10:31:27] tildes: if you don't mind a frank question, what's the difference between procrastination and being lazy? :)
[10:31:58] wethu: has joined #RubyOnRails
[10:32:11] tildes: I mean, if you want a good job, good coding environment, can you afford to procrastinate?
[10:32:19] Spami: has joined #RubyOnRails
[10:33:25] SPYGAME: good question, i think (i am not sure though) that it's probably a case of prioritization when you procrastinate but lazy is just lazy like you don't even know what you wanna do or where you wanna get. it's more like a routine or habit i guess
[10:34:12] tildes: someone wise said that the real reason behind procrastination is either fear of failure, or not strong enough sense of purpose
[10:34:33] tildes: I might like to try pair programming, but probably I would like to do it after you have gotten some of the routine back
[10:34:45] Spami_: has joined #RubyOnRails
[10:35:29] johnflux: has joined #RubyOnRails
[10:35:45] tildes: perhaps work on a small project, even asynchronously
[10:36:10] FooMunki: has joined #RubyOnRails
[10:36:22] SPYGAME: do you wanna exchange contacts ? maybe we can update each other of our progress etc.
[10:37:53] tildes: spygame: sure, perhaps you can give me your email / skype
[10:37:59] SPYGAME: tildes: by the way, in terms of routine i am currently working on building a prototype (all bootstrap and no development yet) with a friend. so i'm not completely out of sync :D
[10:38:43] tildes: spygame: well, that's good to hear :) I have to admit I was thinking in lines of 'no programming for a year'
[10:38:46] Silox|: has joined #RubyOnRails
[10:39:54] SPYGAME: yes, so perhaps what i meant was 'no programming for a year in terms of routine' i have been doing some on and off projects although relatively small
[10:40:06] SPYGAME: like i was not in job anymore
[10:40:43] srinidhi: has joined #RubyOnRails
[10:45:14] hotpancakes: has joined #RubyOnRails
[10:49:58] mikeiniowa: has joined #RubyOnRails
[10:50:54] djellemah_: has joined #RubyOnRails
[10:51:03] merida_: has joined #RubyOnRails
[10:52:29] sandstrom: has joined #RubyOnRails
[10:54:07] Ergo: has joined #RubyOnRails
[10:54:44] SPYGAME: has joined #RubyOnRails
[10:56:15] mrbubbles: has joined #RubyOnRails
[10:59:22] rodfersou: has joined #RubyOnRails
[10:59:32] xenet: has joined #RubyOnRails
[11:01:19] brt: has joined #RubyOnRails
[11:03:42] yfeldblum: has joined #RubyOnRails
[11:03:44] chouhoulis: has joined #RubyOnRails
[11:04:47] dvinciguerra__: has joined #RubyOnRails
[11:04:53] brt_: has joined #RubyOnRails
[11:05:03] merida: has joined #RubyOnRails
[11:08:30] vale_tudo: has joined #RubyOnRails
[11:11:36] AimlessRAven: has joined #RubyOnRails
[11:12:24] andywww: has joined #RubyOnRails
[11:12:28] andywww: javascript
[11:13:01] AimlessRAven: hi all, i have this @related_products = Sellor::Product.all.where(category: @product.category).sample(3) with this i load 3 sample products with category, whitch my product exist. But i want to show 3 sample products except this product who is on product show
[11:15:27] elaptics: AimlessRaven: you don't need the call to .all and you can just chain another where(not: current_product) on before you sample it
[11:15:28] Balzrael: has joined #RubyOnRails
[11:15:42] elaptics: current_product being the one you're showing
[11:16:01] AimlessRAven: elaptics: tnx
[11:16:46] elaptics: e.g. where.not(id: current_product.id)
[11:17:21] akshat: has joined #RubyOnRails
[11:18:46] AimlessRAven: elaptics: dont work for me
[11:19:03] elaptics: in what way?
[11:19:06] mja: has joined #RubyOnRails
[11:19:26] elaptics: AimlessRaven: !code
[11:19:26] helpa: AimlessRaven: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[11:21:28] AimlessRAven: helpa: https://gist.github.com/NikolayPetkov/0341bf7b075cf59645b33e41cda88663
[11:21:28] neanderslob: has joined #RubyOnRails
[11:21:35] AimlessRAven: i want my related_products to not include current product
[11:21:45] hamster88: has joined #RubyOnRails
[11:21:53] crankharder: has joined #RubyOnRails
[11:22:06] Gkj8899_: has joined #RubyOnRails
[11:22:07] elaptics: well you haven't appended the not on that I showed you
[11:22:49] MalcolmReynolds: has joined #RubyOnRails
[11:22:55] jhass: has joined #RubyOnRails
[11:23:12] David_H_Smith: has joined #RubyOnRails
[11:23:14] hyperdrive: has joined #RubyOnRails
[11:23:15] elaptics: @related_products = Sellor::Product.where(category: @product.category).where.not(id: @product.id).sample(3)
[11:23:27] mlitwiniuk: has joined #RubyOnRails
[11:23:29] D9: has joined #RubyOnRails
[11:23:45] tbuehlmann: has joined #RubyOnRails
[11:24:07] flopsec: has joined #RubyOnRails
[11:24:22] AimlessRAven: elaptics: thanks
[11:24:33] andywww: has left #RubyOnRails: ()
[11:24:53] mrchris: has joined #RubyOnRails
[11:25:09] mdw: has joined #RubyOnRails
[11:25:35] blackhuey: has joined #RubyOnRails
[11:26:00] AntiSpamMeta: has joined #RubyOnRails
[11:27:19] Cork: has joined #RubyOnRails
[11:30:11] fox_mulder_cp: wow. one of authors of CDN Akamai was killed when try to drop terrorist from aircraft 11 sep 2001
[11:30:39] nachoman: has joined #RubyOnRails
[11:32:45] quazimodo: has joined #RubyOnRails
[11:34:03] GodFather: has joined #RubyOnRails
[11:35:56] Mattx: has joined #RubyOnRails
[11:38:53] arup_r: has joined #RubyOnRails
[11:39:30] vedu_: has joined #RubyOnRails
[11:41:37] hotpancakes: has joined #RubyOnRails
[11:42:45] ldnunes: has joined #RubyOnRails
[11:42:54] bronson: has joined #RubyOnRails
[11:46:39] vedu_: has left #RubyOnRails: ("AndroIRC")
[11:46:59] vedu_: has joined #RubyOnRails
[11:47:39] mdw7: has joined #RubyOnRails
[11:49:18] solars: has joined #RubyOnRails
[11:49:19] nfk|laptop: has joined #RubyOnRails
[11:51:02] IrishGringo: has joined #RubyOnRails
[11:54:34] gillesmath: has joined #RubyOnRails
[11:54:57] norc: has joined #RubyOnRails
[11:55:33] adlerdias: has joined #RubyOnRails
[11:56:59] dtzuzu: has joined #RubyOnRails
[11:57:37] GitGud: has joined #RubyOnRails
[11:58:48] gillesmath: Hello, do somenone know if it is possible to check the current recipient of a mail in the mailer view ? I am sending a mail to 2 different users using to: and and bcc: options, I’d like to put a conditional in the view wether the current recipient is the bcc: or not
[11:59:36] srinidhi: has joined #RubyOnRails
[12:00:56] chayon: has joined #RubyOnRails
[12:01:19] gillesmath: http://stackoverflow.com/questions/36332495/rails-4-actionmailer-is-it-possible-to-check-the-current-mail-recipient-in-the
[12:02:58] Ergo^: has joined #RubyOnRails
[12:03:39] workmad3: gillesmath: no, that's not possible... when you send an email with a bcc option, you only send a single email, and your SMTP server is responsible for sending it out to both parties (with the BCC address treated appropriately)
[12:04:13] gillesmath: Ok Thank you for your answer
[12:04:14] techsethi: has joined #RubyOnRails
[12:04:31] chouhoulis: has joined #RubyOnRails
[12:04:32] epochwolf: However, you could send two seperate emails.
[12:04:43] gillesmath: yes that was my second option
[12:04:46] workmad3: gillesmath: the same is true if you're sending to multiple people in the `to:` field btw... if you need to customise an email per-user, you need to send separate emails (as epochwolf just pointed out)
[12:05:02] nzst: has joined #RubyOnRails
[12:05:05] epochwolf: ACTION is smart.
[12:05:21] workmad3: ACTION gives epochwolf a wolf-cookie
[12:05:43] nzst: Hi, I have a filter on the frontend of a website and I need to limit how fast that button can be presesed, or how many times or fast that route can be hit by an end user, any ideas?
[12:06:06] gillesmath: I was just wondering if what I asked was possible as you can access message.to and message.from etc in the mailer view, thanks again for the quick answer !
[12:06:28] epochwolf: nzst: store a last clicked timestamp in a cache, session, or database.
[12:06:41] User458764: has joined #RubyOnRails
[12:07:36] workmad3: nzst: or look at things like rack-attack to throttle requests
[12:08:03] nzst: thanks, i'll look into both avenues
[12:09:19] yellow5: has joined #RubyOnRails
[12:11:18] epochwolf: gillesmath: um, I'd recommend passing that in as an instance variable. Otherwise you can problem dig through the headers..
[12:11:28] epochwolf: can probably*
[12:11:44] King_Rex: has joined #RubyOnRails
[12:14:12] johnflux: has joined #RubyOnRails
[12:14:12] johnflux: has joined #RubyOnRails
[12:14:27] theod: has joined #RubyOnRails
[12:15:06] gingray: has joined #RubyOnRails
[12:15:07] fox_mulder_cp: epochwolf: u say about make a new table (user_id, route, last_hit(timestamp)) relation?
[12:15:35] eregi: has joined #RubyOnRails
[12:16:08] fox_mulder_cp: i think that this relation for memcached, touch master db for this - bad idea...
[12:16:15] baweaver: has joined #RubyOnRails
[12:17:22] n008f4g_: has joined #RubyOnRails
[12:18:52] epochwolf: ACTION raises SyntaxError and goes to the breakroom to make tea.
[12:19:24] krz: has joined #RubyOnRails
[12:23:04] hotpancakes: has joined #RubyOnRails
[12:23:23] AimlessRAven: how to change simple form when i click tab to move horizontaly not verticaly ?
[12:26:01] pawnbox: has joined #RubyOnRails
[12:26:02] DragonPunch: has joined #RubyOnRails
[12:30:49] User458764: has joined #RubyOnRails
[12:32:42] yellow5: has left #RubyOnRails: ()
[12:33:06] yellow5: has joined #RubyOnRails
[12:37:17] gillesmath: has joined #RubyOnRails
[12:38:09] epochwolf: AimlessRaven: that's not a simple form thing. That's an html thing. It's based on the order of the fields in the html document. If you want to override it, look at the tabindex attribute.
[12:38:26] AimlessRAven: epochwolf: tnx
[12:38:30] yellow5: has joined #RubyOnRails
[12:41:40] neanderslob: has joined #RubyOnRails
[12:43:56] mrgreenfur: has joined #RubyOnRails
[12:46:05] snowy: has joined #RubyOnRails
[12:48:55] pawnbox: has joined #RubyOnRails
[12:50:57] pydave6367: has joined #RubyOnRails
[12:51:41] hightower3: has joined #RubyOnRails
[12:53:30] drbayer: has joined #RubyOnRails
[12:53:56] lyoshajapan: has joined #RubyOnRails
[12:55:11] gaf_: has joined #RubyOnRails
[12:55:28] krz: has joined #RubyOnRails
[12:55:40] jinette: has joined #RubyOnRails
[13:00:31] dipnlik: has joined #RubyOnRails
[13:03:16] tvw: has joined #RubyOnRails
[13:04:30] hotpancakes: has joined #RubyOnRails
[13:05:13] chouhoulis: has joined #RubyOnRails
[13:07:27] daveomcd_: has left #RubyOnRails: ()
[13:07:35] daveomcd: has joined #RubyOnRails
[13:07:38] daveomcd: I'm attempting to do a regex that would find month/day combinations like... 11/15 or 2/12 - I was trying to use this: \d{1,2}\/\d{2} --- but ruby doesn't like the comma with the {1,2}. Anyone know why?
[13:08:01] ekinmur: has joined #RubyOnRails
[13:08:57] sevenseacat: has joined #RubyOnRails
[13:09:21] lyoshajapan: has joined #RubyOnRails
[13:09:37] konsolebox: has joined #RubyOnRails
[13:10:10] flashpoint9: has joined #RubyOnRails
[13:10:22] Peteykun: has joined #RubyOnRails
[13:10:35] apeiros: daveomcd: what makes you think ruby wouldn't like the comma?
[13:13:49] n1lo: has joined #RubyOnRails
[13:14:11] ekinmur: has joined #RubyOnRails
[13:15:37] daveomcd: actually looks like the comma was the second error message. when trying something like... "2/16 this is a note 11/15 this is also a note 4/11 even this... a note".index \d{1,}\/\d{2} --- I get... "SyntaxError: (irb):17: syntax error, unexpected $undefined" first, then it complained about the comma
[13:16:11] hxegon: has joined #RubyOnRails
[13:17:51] hightower3: has joined #RubyOnRails
[13:18:59] apeiros: daveomcd: um, yeah, of course. you forgot to delimit your regex.
[13:19:09] apeiros: you need either // or %r{}
[13:19:22] apeiros: just like a string needs "". you can't just have it hovering like that in the source.
[13:20:09] sp1rs: has joined #RubyOnRails
[13:20:41] d3f4alt: has joined #RubyOnRails
[13:20:46] daveomcd: whoops! thanks for the help :)
[13:21:30] sudoubuntu: has joined #RubyOnRails
[13:21:49] d3f4alt: has left #RubyOnRails: ()
[13:24:29] AlexJakeGreen: has joined #RubyOnRails
[13:24:46] Takumo: Hi all, when sending a mailer how to I override the locale?
[13:25:01] Takumo: e.g. so the locale used to send the mail is not the same as the one used in the original http request
[13:26:30] artto: has joined #RubyOnRails
[13:27:10] Takumo: e.g. a user with locale :en performs an action which sends an e-mail to a user who has their locale set to :fr
[13:27:24] Takumo: how can I override the locale of the mailer to set the locale to :fr for that mail?
[13:28:26] beauby: has joined #RubyOnRails
[13:30:59] chagel: has joined #RubyOnRails
[13:33:05] IrishGringo: has joined #RubyOnRails
[13:33:20] Spami_: has joined #RubyOnRails
[13:33:41] beauby: has joined #RubyOnRails
[13:34:44] epochwolf: Takumo: is the email sent by a background job?
[13:35:10] flashpoint9: has joined #RubyOnRails
[13:35:37] Takumo: well yes I'm using deliver_later but I have access to the locale name inside the mailer?
[13:35:50] Takumo: I think I've got it working using
[13:36:21] Takumo: @user_locale = I18n.locale; I18n.locale = target_user.locale; mail(to: target_user.email).deliver_later; I18n.locale = @user_locale
[13:36:48] twilling: has joined #RubyOnRails
[13:37:28] Takumo: that's probably a really dirty way to do it
[13:37:49] Takumo: but I have to get it in production by the end of today so whatever works for this low volume app will do ;)
[13:38:07] mrchris: has joined #RubyOnRails
[13:38:08] MaienM: has joined #RubyOnRails
[13:38:56] epochwolf: Takumo: you can't guarrente the global or thread environment will be the same with deliver_later
[13:39:29] patrick_star: has joined #RubyOnRails
[13:39:36] Takumo: epochwolf: yeah I imagine that's the problem I could have with this setup
[13:40:02] Takumo: but is it really going into the background if I have no resque/sidekiq/delayed_job backend installed, I thought the default was just a pseudo worker
[13:40:14] dtzuzu: has joined #RubyOnRails
[13:41:17] CornishPasty: Takumo: https://translation.io/blog/rails-i18n-with-locale is neater imo
[13:41:32] Takumo: oooh will do that!
[13:42:17] CornishPasty: Also, looks like the threading issue should work fine
[13:42:30] CornishPasty: Since the I18n.locale is passed to the deliveryjob
[13:42:42] epochwolf: CornishPasty: locale= and with_locate are specific to the thread.
[13:42:55] epochwolf: with_locale* derp
[13:43:28] epochwolf: Takumo: use CornishPasty's solution. I was just about to recommend that.
[13:44:34] akshat: has joined #RubyOnRails
[13:45:21] konsolebox: has joined #RubyOnRails
[13:45:49] Takumo: Awesomesauce. HAve done so
[13:45:55] hotpancakes: has joined #RubyOnRails
[13:46:09] Takumo: I really need to start using a hosted translation ui service like LocaleApp I think
[13:46:31] Takumo: this app is really small but because its in 10 different locales its annoying to get new stuff translated in :(
[13:48:27] CornishPasty: Actually, iirc the subject/body will be generated before it gets queued, so threading doesn't matter
[13:49:22] Takumo: ^ I thought this too
[13:50:07] uglybandersnatch: has joined #RubyOnRails
[13:52:23] hxegon: has joined #RubyOnRails
[13:53:16] hamed_r: has joined #RubyOnRails
[13:55:07] hotpancakes: has joined #RubyOnRails
[13:57:20] aegis3121: has joined #RubyOnRails
[13:58:39] CodaBrink: has joined #RubyOnRails
[14:00:09] roshanavand: has joined #RubyOnRails
[14:00:17] GodFodder: has joined #RubyOnRails
[14:00:37] GodFodder: has joined #RubyOnRails
[14:00:55] quazimodo: has joined #RubyOnRails
[14:01:02] GodFodder: has joined #RubyOnRails
[14:01:32] GodFodder: has joined #RubyOnRails
[14:02:13] fexilal: has joined #RubyOnRails
[14:03:22] Takumo: lol wtf, some reason when the locale is :de it's doing :en, even in development which has I18n warnings enabled...
[14:03:31] rwsq1: has joined #RubyOnRails
[14:03:43] Takumo: ok never mind!
[14:03:43] eregi: has joined #RubyOnRails
[14:03:43] rwsq1: has left #RubyOnRails: ()
[14:03:52] rwsq1: has joined #RubyOnRails
[14:03:58] rubyonrailed: has joined #RubyOnRails
[14:04:47] rwsq1: how do I redirect from an activeadmin controller based on some property? I want some users to get redirected to another page.
[14:05:40] openstruct: has joined #RubyOnRails
[14:05:57] chouhoulis: has joined #RubyOnRails
[14:06:37] Takumo: rwsq1: redirect_to just like any other controller, except you would probably put resource_path or similar in the destination
[14:08:33] rwsq1: Takumo, thanks, how do I find a property on a user? I've tried current_user, current_admin_user etc but they don't seem to be defined in there
[14:08:53] rwsq1: inside my regular controllers I can use current_user
[14:08:53] Takumo: is it the current user or a the currently edited user resource?
[14:09:06] rwsq1: currently logged-in user
[14:09:08] platzhirsch: has joined #RubyOnRails
[14:09:11] Takumo: current_admin_user would probably be what you want... I think
[14:09:26] krz: has joined #RubyOnRails
[14:09:59] Ergo: has joined #RubyOnRails
[14:10:37] rwsq1: Takumo, so in my dashboard.rb I use if current_admin_user.superadmin but it says 'undefined local variable or method `current_admin_user' for #<ActiveAdmin::PageDSL'
[14:10:51] stannard: has joined #RubyOnRails
[14:11:28] Takumo: aah, sounds like ActiveAdmin is scoping you within a partial so you're not in the ActionView… there's probably docs on the site
[14:12:08] rwsq1: ah I see, so I have to inside content do or whatever?
[14:16:55] twilling: has joined #RubyOnRails
[14:20:26] Tref: has joined #RubyOnRails
[14:21:16] drbayer: has joined #RubyOnRails
[14:22:54] adre: has joined #RubyOnRails
[14:23:28] Rubie: has joined #RubyOnRails
[14:26:23] DragonPunch: has joined #RubyOnRails
[14:29:19] Brando753: has joined #RubyOnRails
[14:30:02] VeryBewitching: has joined #RubyOnRails
[14:31:44] yellow5: has joined #RubyOnRails
[14:32:37] hotpanca_: has joined #RubyOnRails
[14:35:35] fexilal: anyone here completely gone through the enitre sample app tutorial at railstutorial.org ?
[14:36:39] siaW: has joined #RubyOnRails
[14:37:08] fexilal: how long did it take and how much did you remember?
[14:37:31] krz: has joined #RubyOnRails
[14:38:05] sevenseacat: a couple of days. i dont remember, it was a while ago. there are better resources out there.
[14:38:37] fexilal: I felt as if I was off to a good start but the user sign up and the log in log out chapters feel like a little too much to remember.
[14:38:47] fexilal: couple of days?!
[14:39:33] mdw: has joined #RubyOnRails
[14:39:37] fexilal: how many hours did you spend in those days?
[14:39:42] sevenseacat: the idea isnt to memorize everything immediately - its to get a feel for the framework, get comfortable working with it, knowing how the pieces fit together
[14:40:00] forcer: You will memorize stuff automatically when you did it a few times.
[14:40:05] sevenseacat: being confident that even if you dont know the answers, you know where to find them
[14:40:40] fexilal: yeah, I was hoping I would be able to build the entire app without google.
[14:40:56] fexilal: + after going through the tutorial
[14:41:10] sevenseacat: no-one develops without google
[14:41:17] forcer: Exactly. :-D
[14:41:29] Ergo: has joined #RubyOnRails
[14:41:37] forcer: sevenseacat: You said there are better resources out there - do you have any specific recommendations?
[14:41:40] VeryBewitching: sevenseacat: You mean you don't <3 Bing? :D
[14:41:45] sevenseacat: forcer: !r4ia
[14:41:45] helpa: forcer: Rails 4 in Action - http://manning.com/bigg2 - An excellent book combining Rails and TDD/BDD development. Written by Rebecca Skinner, Steve Klabnik, Ryan Bigg, Yehuda Katz
[14:41:53] sevenseacat: disclaimer: I am one of the authors
[14:42:02] forcer: Thank you!
[14:44:23] P4Titan: has joined #RubyOnRails
[14:44:55] fexilal: wow, nice. I guess that's one of the reasons it took you only a couple of days.
[14:45:33] krz: has joined #RubyOnRails
[14:45:34] ekinmur: has joined #RubyOnRails
[14:45:37] sevenseacat: well I did the tutorial back in 2011 when I was initially learning rails :)
[14:45:43] sevenseacat: the book only came out late last year
[14:46:31] adavia: has joined #RubyOnRails
[14:46:35] tildes: now that we are sort of on the topic, what resources would you recommend to learn to test like a pro?
[14:46:53] helpa: Rails 4 Test Prescriptions - a great introduction to testing in Ruby and Rails, including both minitest and rspec. https://pragprog.com/book/nrtest2/rails-4-test-prescriptions
[14:46:53] tildes: I know basic capybara and rspec, but I think there is still a long way to go
[14:46:54] elaptics: tildes: start writing tests :)
[14:47:08] sevenseacat: i didnt write that one, but i genuinely think it's a really good book
[14:47:17] gabr13l: has joined #RubyOnRails
[14:47:34] P4Titan: Hello all. I have this code: http://pastie.org/10780838 . When I create User object with an attached Link in the console sandbox, destroying the User does not destroy the Link. Why would that be?
[14:47:35] sevenseacat: testing is also one of those things that everyone develops their own style in, over time
[14:48:05] sevenseacat: P4Titan: because you don't have dependent: :destroy on the relationship
[14:48:09] tildes: sevenseacat: I have read it once somewhere last year, I could definitely revisit
[14:48:18] P4Titan: sevenseacat: But I do though
[14:48:35] sevenseacat: P4Titan: if destroying the user should destroy the links, then dependent: :destroy has to be on the user has_many :links
[14:48:45] tildes: elaptics: the thing is, I can't do that in worktime. so I would need to come up with more challenging projects or perhaps contribute to someone else's project
[14:49:00] tildes: but I think with OSS, it's kind of challenging to know where to start, how to pick a project
[14:49:17] sevenseacat: P4Titan: your dependent: :destroy is the other way around - if you destroyed the link, it would also destroy the user
[14:49:21] tildes: more challenging free-time projects that is
[14:49:31] P4Titan: really, oh boi
[14:49:55] P4Titan: I read the docs for dependent: :destroy and I thought it had to be placed on the children
[14:50:45] tildes: (maybe work through more tutorials...)
[14:52:18] P4Titan: Now, looking over the docs, I guess I did pick up on the small distinctions there
[14:52:22] P4Titan: Thanks tho!
[14:52:35] Devalo: has joined #RubyOnRails
[14:53:46] FooMunki: has joined #RubyOnRails
[14:55:18] Devalo: has joined #RubyOnRails
[14:55:44] arup_r: has joined #RubyOnRails
[14:56:20] dvinciguerra__: has joined #RubyOnRails
[14:56:28] elaptics: tildes: curious why you can't do it in work time?
[14:57:02] kies: has joined #RubyOnRails
[15:07:23] mDuff: has joined #RubyOnRails
[15:08:22] FooMunki: has joined #RubyOnRails
[15:09:00] Rubie: has joined #RubyOnRails
[15:12:00] HenriettaSalt: has joined #RubyOnRails
[15:13:22] arup_r: has joined #RubyOnRails
[15:14:48] mwlang: what’s the rails way to eager load a bunch of files in one specific folder only?
[15:16:05] ekinmur: has joined #RubyOnRails
[15:17:15] mwlang: ah, ha. require_dependency was what I was looking for.
[15:19:20] platzhirsch: has left #RubyOnRails: ()
[15:19:21] krz: has joined #RubyOnRails
[15:20:02] Papierkorb: mwlang: Or: Rails.application.config.eager_load_paths << 'path/to/the/dir'
[15:20:17] polishdub: has joined #RubyOnRails
[15:20:26] Papierkorb: (in an initializer/*.rb or your config/application.rb)
[15:21:38] mwlang: Papierkorb: let me check that out. Sounds like it’s a better option.
[15:21:40] eregi: has joined #RubyOnRails
[15:22:31] yellow5: has joined #RubyOnRails
[15:22:36] P4Titan`: has joined #RubyOnRails
[15:26:40] dopamean_: has joined #RubyOnRails
[15:27:12] P4Titan``: has joined #RubyOnRails
[15:27:40] roshanavand: has joined #RubyOnRails
[15:28:11] davee_: has joined #RubyOnRails
[15:28:29] eregi: has joined #RubyOnRails
[15:29:58] reckoner: has joined #RubyOnRails
[15:30:20] disgrntld: has joined #RubyOnRails
[15:31:51] reckoner: i'm looking into using ActiveSupport::Configurable. i assume if i want to persist these options...
[15:31:59] FooMunki: has joined #RubyOnRails
[15:32:07] reckoner: i need to serialize a text attribute in my db?
[15:32:29] mrgreenfur: has joined #RubyOnRails
[15:32:58] GitGud: has joined #RubyOnRails
[15:37:02] P4Titan: has joined #RubyOnRails
[15:37:06] reckoner: answer: https://github.com/metaskills/store_configurable/
[15:37:15] flashpoint9: has joined #RubyOnRails
[15:37:24] P4Titan: Hello all again! Have any of you used Koala with Rails to program a fb applet?
[15:37:43] jeffleeismyhero: has joined #RubyOnRails
[15:37:59] P4Titan: I wish to know how to save the fb user's id accross redirects so that I can access data accordingly from a db
[15:38:13] P4Titan: Would dropping it in `session` be the best way?
[15:39:17] Devalo: has joined #RubyOnRails
[15:39:40] P4Titan: IE: to generalize my question, is it possible to save an instance variable accross callbacks in Rails?
[15:39:48] yellow5: has joined #RubyOnRails
[15:41:33] reckoner: i think you want a $global?
[15:41:37] adavia: has joined #RubyOnRails
[15:42:00] P4Titan: However, every different user that uses my app will have differnt contents I want to carry over
[15:44:52] KensoDev: has joined #RubyOnRails
[15:44:58] mwlang: P4Titan: Saving info to session or cookies is the way to track user between server requests.
[15:45:01] petor: has joined #RubyOnRails
[15:45:31] P4Titan: Is it the only way? Should I always default to it if I need such functionality?
[15:48:07] mrgreenfur: has joined #RubyOnRails
[15:49:15] eregi: has joined #RubyOnRails
[15:50:05] mwlang: P4Titan: well, one way I do it, for example is “current_user” which I have a before_filter on that sets it always and it looks like this: User.find(cookies.signed[:user_id]) || User.new
[15:50:50] mwlang: So I always have a User instance. It’s just that its a new, unpersisted record until I save a user and store that user’s id in the cookie.
[15:53:33] dipnlik: sevenseacat: how do you compare r4ia to agile web development with rails? consider that i read the latter at rails 3 and skimmed through the rails 4 version
[15:54:13] sevenseacat: I haven't read AWDWR, but I've seen enough people coming in here with issues because some of the code in the book flat out doesnt work, that I don't recommend it.
[15:55:01] benlieb: has joined #RubyOnRails
[15:55:02] matthewd: If people are using the version the book was written for, it should all work
[15:55:11] matthewd: .. there's a test suite to prove it :|
[15:55:49] sevenseacat: that i cant answer then, because like i said, havent actually read the book. but some of the code from memory really was headscratch-worthy
[15:55:59] diegoaguilar: has joined #RubyOnRails
[15:57:14] smathy: has joined #RubyOnRails
[15:57:48] bronson: has joined #RubyOnRails
[15:59:04] axl_: has joined #RubyOnRails
[15:59:49] workmad3_: has joined #RubyOnRails
[15:59:57] baweaver: has joined #RubyOnRails
[16:01:07] DoctorMonocular: has joined #RubyOnRails
[16:03:39] hightower3: has joined #RubyOnRails
[16:03:49] mrgreenfur: has joined #RubyOnRails
[16:04:44] dipnlik: sevenseacat: I don’t remember having issues with awdwr but it’s been a while. will take a peek at your book. thank you :)
[16:06:36] matt_d_: has left #RubyOnRails: ()
[16:07:52] P4Titan: mwlang: However, isn't running a find on every request intensive on the DB
[16:08:17] P4Titan: should I consider caching the find call, or is that overkill?
[16:08:51] arup_r: has joined #RubyOnRails
[16:10:13] smathy: has joined #RubyOnRails
[16:11:46] n008f4g_: has joined #RubyOnRails
[16:12:15] Frem: has joined #RubyOnRails
[16:12:29] johnflux: has joined #RubyOnRails
[16:12:29] johnflux: has joined #RubyOnRails
[16:12:54] mwlang: P4Titan: that would be overkill in my estimation, or rather premature optimization.
[16:12:59] petor: has joined #RubyOnRails
[16:13:00] mrchris: has joined #RubyOnRails
[16:13:19] mwlang: keep your user table small and with find by primary key column, it should remain fast.
[16:13:31] mwlang: store tons of lesser used user data in another table.
[16:13:54] P4Titan: mwlang: Also, would u recommend that I use the fb_uid as the primary_key or stick to the default
[16:14:48] sp1rs: has joined #RubyOnRails
[16:14:59] mwlang: P4Titan: add fb_uid as a separate column unique and indexed. it’s an externally supplied piece of info and you don’t want that trickling down into other models and associations throughout your app.
[16:15:01] benlieb: I'm reading a blog post about thread safety, and in it he says "Class instance variables (@bar) are trickier to find since they look the same as any old ivar). Is a "class instance variable" different from an ivar (Instance variable?)
[16:15:18] P4Titan: mwlang: I see, thanks!
[16:15:29] Ergo: has joined #RubyOnRails
[16:15:32] P4Titan: mwlang: another thing, sorry
[16:15:42] P4Titan: should I store fb_uid as a string or bigint?
[16:16:30] mwlang: P4Titan: I’d probably store it as a string because there’s no guarantee FBUID are always going to be the way they are today.
[16:16:44] eregi_: has joined #RubyOnRails
[16:16:52] mwlang: unless of course their documentation says otherwise.
[16:16:59] sevenseacat: has joined #RubyOnRails
[16:17:04] P4Titan: ok, because I thought bigints would be more efficient to compare
[16:17:11] P4Titan: tho this too may be going too far
[16:17:59] willwright: has left #RubyOnRails: ()
[16:18:10] mwlang: unless you know it’s always going to be a bigint in FB’s architecture, the safest choice is varchar.
[16:19:05] mwlang: but I suspect that by the time you’re caring about indexing performance of strings vs. bigints, you’re already contending with load-balanced database servers at that point. :-)
[16:19:11] mrgreenfur: has joined #RubyOnRails
[16:22:33] rakm: has joined #RubyOnRails
[16:22:35] merida: has joined #RubyOnRails
[16:23:19] chouhoulis: has joined #RubyOnRails
[16:23:55] eregi: has joined #RubyOnRails
[16:25:55] HenriettaSalt: has joined #RubyOnRails
[16:27:54] User458764: has joined #RubyOnRails
[16:28:01] petor: has joined #RubyOnRails
[16:30:00] mdel: has joined #RubyOnRails
[16:30:10] hxegon: has joined #RubyOnRails
[16:30:53] Martyn: has joined #RubyOnRails
[16:32:06] Rubie: has joined #RubyOnRails
[16:33:00] rubyonrails133: has joined #RubyOnRails
[16:33:14] rogue_koder: has joined #RubyOnRails
[16:34:08] merida: has joined #RubyOnRails
[16:34:25] DoctorMonocular: has joined #RubyOnRails
[16:34:49] mrgreenfur: has joined #RubyOnRails
[16:37:28] hightower2: has joined #RubyOnRails
[16:38:21] P4Titan: If I want to create a record if it does not exist, should I use find_or_create_by or first_or_create
[16:38:26] P4Titan: what is the difference between them?
[16:39:37] twilling: has joined #RubyOnRails
[16:40:27] VeryBewitching: find_or_create_by will return the model if it could be found, or create it if not.
[16:40:40] VeryBewitching: first_or_create will return the first found, if any, or create a record.
[16:41:16] greengriminal: has joined #RubyOnRails
[16:41:20] P4Titan: well, would the find command fail if there were multiple occurances
[16:41:23] VeryBewitching: P4Titan: You can lookup the description of each method at http://devdocs.io/
[16:41:49] Spami_: has joined #RubyOnRails
[16:41:53] P4Titan: Is find exclusive to unique tags; I just don't see a real, practical difference
[16:42:04] VeryBewitching: http://devdocs.io/rails/activerecord/relation#method-i-find_or_create_by
[16:43:37] VeryBewitching: The first_or_create will create a record if the table is empty.
[16:43:49] VeryBewitching: So return the first record, or create the first record.
[16:44:18] VeryBewitching: find_or_create_by will use the data you pass to find a record, if none are found it creates one.
[16:44:52] P4Titan: VeryBewitching: Oh, I missed that detail
[16:44:57] P4Titan: Thanks so much!
[16:49:46] sleungcy: has joined #RubyOnRails
[16:50:13] B1n4r10: has joined #RubyOnRails
[16:50:20] mrgreenfur: has joined #RubyOnRails
[16:50:59] Spami: has joined #RubyOnRails
[16:51:26] agit0: has joined #RubyOnRails
[16:51:50] arup_r: has joined #RubyOnRails
[16:53:16] Spami_: has joined #RubyOnRails
[16:53:44] barajasfab: has joined #RubyOnRails
[16:54:31] andywww: has joined #RubyOnRails
[16:56:16] sp1rs: has joined #RubyOnRails
[16:57:59] IrishGringo: has joined #RubyOnRails
[17:00:14] Factorio: has joined #RubyOnRails
[17:01:05] adre: has joined #RubyOnRails
[17:01:30] gormandy: has joined #RubyOnRails
[17:02:32] zave: has joined #RubyOnRails
[17:02:39] Guest12891: has left #RubyOnRails: ()
[17:02:44] Guest12891: has joined #RubyOnRails
[17:03:14] stannard_: has joined #RubyOnRails
[17:04:43] gormandy_: has joined #RubyOnRails
[17:05:31] gormandy_: I'm trying to add a default value to a column in a migration
[17:05:38] KensoDev: has joined #RubyOnRails
[17:05:53] mrgreenfur: has joined #RubyOnRails
[17:06:02] cnk: has joined #RubyOnRails
[17:06:06] dionysus69: has joined #RubyOnRails
[17:06:21] gormandy_: I'm doing `change_column_default(:table, :column, {})`
[17:06:32] gormandy_: but that seems to be not working
[17:06:43] gormandy_: my structure.sql file isn't showing {} as the default
[17:06:57] mwlang: I’m looking for info for upgrading from Sunspot/Solr 2.2.0 to 2.2.5, it seems a lot’s changed on the solr/ folder organization and the three cores also seem to have evaporated.
[17:08:14] gormandy_: Are there limits to what can be a default value for a column?
[17:08:53] claytonzaugg: has joined #RubyOnRails
[17:09:13] merida_: has joined #RubyOnRails
[17:09:25] atrius: has joined #RubyOnRails
[17:09:26] choke: has joined #RubyOnRails
[17:09:47] ramfjord: has joined #RubyOnRails
[17:09:58] agit0: has joined #RubyOnRails
[17:10:25] loc22: has joined #RubyOnRails
[17:11:41] Spami: has joined #RubyOnRails
[17:12:28] matthewd: gormandy_: {} is a somewhat unlikely-sounding default... what is the type of the column?
[17:12:39] mwlang: gormandy_: perhaps “{}” ?
[17:13:13] adre: has joined #RubyOnRails
[17:13:38] loc22: Hi guys, I need some help. I have 3 models: User, Photo and Match. I want to order User's photo, by match date. If I do "Photo.joins(:matches).order('matches.approved_at DESC').where(:matches => { status: 0 })" ir works. But if I do "current_user.photos.joins(:matches).order('matches.approved_at DESC').where(:matches => { status: 0 })" it dosent. Any idea?
[17:14:16] sneakerhax: has joined #RubyOnRails
[17:14:31] shinnya: has joined #RubyOnRails
[17:18:58] loc22: Hi guys, I need some help. I have 3 models: User, Photo and Match. I want to order User's photo, by match date. If I do "Photo.joins(:matches).order('matches.approved_at DESC').where(:matches => { status: 0 })" ir works. But if I do "current_user.photos.joins(:matches).order('matches.approved_at DESC').where(:matches => { status: 0 })" it dosent. Any idea?
[17:20:18] yellow5: has joined #RubyOnRails
[17:20:46] nzst: has joined #RubyOnRails
[17:21:14] DoctorMonocular: has joined #RubyOnRails
[17:21:19] mrgreenfur: has joined #RubyOnRails
[17:21:39] mwlang: can’t find a decent write up on upgrading from 2.2.0 to 2.2.5 solr, but did find some relevant info on the wiki: https://wiki.apache.org/solr/Solr.xml%204.4%20and%20beyond
[17:21:53] hxegon: has joined #RubyOnRails
[17:22:06] meoblast001: has joined #RubyOnRails
[17:22:20] loc22: Hi guys, anyone able to help me?
[17:22:23] adamsilver: has joined #RubyOnRails
[17:23:23] Cohedrin: has joined #RubyOnRails
[17:23:31] adamsilver: Hi guys. Can I duplicate an entire RoR app including the gems to be used by the second installation by simply copying and pasting or some paths will be hardcoded? Totally new to Ruby/Rails.
[17:23:37] cnk: loc22: you need to look at the logs for the SQL generated and see what's wrong
[17:24:16] cnk: adamsilver: Do you want a new app - but with similar code?
[17:24:20] loc22: cnk: As far as you know, does the query make sense?
[17:24:35] Cohedrin: has joined #RubyOnRails
[17:24:43] a1fa: is it possible to change activerecord model to something that has already been pointed?
[17:24:59] adamsilver: cnk: yes and I want to cut the installation time to minimum because there will be many
[17:25:12] cnk: loc22: Those both seem more or less reasonable but I always look to see what SQL actually gets ececuted
[17:25:19] a1fa: ie @something = Somemodel.where(..)
[17:25:29] a1fa: and then switch @something to be a Somemodel2 instead?
[17:25:37] a1fa: i have two models that point to the same table
[17:26:00] cnk: The app name appears a couple of places, so if you just copy code, it will be the same app, not a new one
[17:26:26] loc22: cnk: Thanks. I will digg into the SQL logs
[17:26:34] cnk: I suspect you need to think out what needs to be the same and what different and then figure out a strategy. Not just copy and run
[17:26:48] gormandy_: has joined #RubyOnRails
[17:27:09] gormandy_: matthewd: the column stores jsonb values
[17:27:55] Spami: has joined #RubyOnRails
[17:28:07] cnk: adamsilver: you can get a lot of mileage out of doing a 'rails new' followed by copying code from app/* to the new project
[17:28:37] bronson: has joined #RubyOnRails
[17:28:47] cnk: but the 'there will be many' makes me wonder are you building something multiteneted ? or just similar but possibly divergent sites or what
[17:29:17] sudoubuntu: has joined #RubyOnRails
[17:29:39] yellow5: has joined #RubyOnRails
[17:30:50] eregi_: has joined #RubyOnRails
[17:31:21] workmad3: has joined #RubyOnRails
[17:33:00] adamsilver: cnk: exactly, multiteneted but all are separate applications
[17:33:24] jenrzzz: has joined #RubyOnRails
[17:33:26] gormandy_: this links suggests using '[]'::JSON but that doesn't work for me, I just get a typeerror
[17:33:29] gormandy_: http://stackoverflow.com/questions/19715282/set-default-value-for-postgres-json-column-in-rails-4
[17:33:39] jenrzzz: has joined #RubyOnRails
[17:33:42] cnk: adamsilver: separate because?
[17:33:43] smathy: a1fa, !try
[17:33:43] helpa: a1fa: Why don't you try it and find out for yourself?
[17:33:53] cnk: separate db? or because they need to diverge or ??
[17:34:04] adamsilver: cnk: It's a premade application
[17:34:10] GitGud: has joined #RubyOnRails
[17:34:11] cnk: I run a CMS that is all separate sites but checkouts from the same repo
[17:34:37] cnk: anything that needs to differ is just parameterized
[17:34:50] CodaBrink: has joined #RubyOnRails
[17:35:01] adamsilver: Ok, I guess I will see how long it will take first to install them from scratch :) thanks
[17:35:38] gormandy_: mwlang: "{}" does not work either
[17:36:15] sudoubuntu: has joined #RubyOnRails
[17:36:31] cnk: adamsilver: OK. But for future reference, you might want to pick up a copy of Radar's Multitenancy in Rails
[17:36:39] mwlang: gormand__: you’ll have to gist your code and explain “does not work” a bit more specifically.
[17:36:44] mrgreenfur: has joined #RubyOnRails
[17:36:55] n008f4g_: has joined #RubyOnRails
[17:37:10] gormandy_: I get a TypeError, "{}" is not a class/module
[17:37:40] LowLifePerv: has joined #RubyOnRails
[17:37:41] arup_r: has joined #RubyOnRails
[17:38:54] qejk: has joined #RubyOnRails
[17:39:03] gormandy_: mwlang: https://gist.github.com/stuffandthings/7a472aaa16f1a2198aa4128b6d2befd2
[17:39:30] edwinvdgraaf: has joined #RubyOnRails
[17:39:31] tubbo: i bet "'{}'::JSON" needs to be enclosed in double-quotes
[17:39:41] tubbo: because it's a String you're sending in as SQL code
[17:39:43] tubbo: not Ruby code
[17:40:27] gormandy_: will that end up getting parsed as a json object {} though? or just the string '{}'::JSON ?
[17:41:34] tildes: has joined #RubyOnRails
[17:41:36] mwlang: gormand__: are you serializing the column in your model?
[17:42:26] mwlang: if so, I think I’d just create and save a record with {} and then use the db console to read what that value is.
[17:42:27] baweaver: has joined #RubyOnRails
[17:42:53] gormandy_: Alrighty. Thanks for the direction!
[17:46:41] manfrin: has joined #RubyOnRails
[17:47:12] mdw: has joined #RubyOnRails
[17:47:24] User458764: has joined #RubyOnRails
[17:47:38] Rubie: has joined #RubyOnRails
[17:48:01] mdw: has joined #RubyOnRails
[17:50:46] arup_r: if I call request.original_url getting "http://localhost:3000/leads" and request.url giving "http://localhost:3000leads" .. But why `url` is giving wrong url?
[17:50:53] arup_r: What could go wrong?
[17:50:56] mrbubbles: Hello - I have a table which has quite a few rows of data (around 500k at present) and 5 new ones arrive every minute. I need to get hourly averages, daily averages and monthly averages but these calculations are slow... I was thinking of having separate tables for the hourly/daily/monthly and then using a cron task to work it out. Does that sound sensible?
[17:51:50] petor: has joined #RubyOnRails
[17:51:53] tubbo: mrbubble_: what about using a SQL VIEW?
[17:51:56] Spami_: has joined #RubyOnRails
[17:51:59] uglybandersnatch: has joined #RubyOnRails
[17:52:15] mrbubbles: Not heard of those, will read about it now
[17:52:19] tubbo: doesn't look like you can accomplish what you want with counter caches, so i think you might need a SQL view
[17:52:22] mrgreenfur: has joined #RubyOnRails
[17:52:45] syndikate: has joined #RubyOnRails
[17:53:09] workmad3: mrbubble_: or investigate using an RRD database for those accumulations instead of storing them in an SQL db
[17:53:13] tubbo: mrbubble_: it's basically a table derived by a query, so you could e.g. write in SQL the logic for counting up all these values and averaging them, then it presents that data as a "column" of this "table".
[17:53:54] tubbo: 500,000 rows isn't too much for SQL to handle.
[17:55:55] djbkd: has joined #RubyOnRails
[17:56:47] dopie: has joined #RubyOnRails
[17:59:23] jenrzzz: has joined #RubyOnRails
[17:59:28] mrbubbles: thanks guys, SQL VIew sounds interesting
[17:59:46] forcer: mrbubble_: What DB are you using?
[18:01:08] baweaver: has joined #RubyOnRails
[18:01:19] aegis3121: has joined #RubyOnRails
[18:01:30] cnk: mrbubble_: Look into materialized views - build one for each aggregation level
[18:02:06] cnk: I would expect you to be able to have the db automatically rebuild on a time interval (since PG evolves to mimic Oracle)
[18:02:30] tubbo: ACTION would err on the side of starting with regular views and using materialized views when it's necessary
[18:02:32] forcer: mrbubble_: Views won't help you, then. You'd need materialized views. But what you describe should be fixable with an index on the timestamp. If the table gets too large (500k is not large), partitioning over timestamp is sensible - per-day or per-month are options.
[18:02:36] dopie: has joined #RubyOnRails
[18:03:55] cnk: tubbo: Experience with PG MVs? good bad other? In Oracle they were super simple and rock solid - at least for what I needed them fo
[18:04:19] stannard: has joined #RubyOnRails
[18:05:13] rubie_: has joined #RubyOnRails
[18:05:14] forcer: As far as I know, in PostgreSQL, view results/contents are not cached, using them is equivalent to just adding their code as an inner select. There's no performance advantage, only a readability advantage. If you want the contents cached, you need materialized views.
[18:05:17] mrbubbles: Thanks forcer I'll try an index first I guess
[18:05:40] mrbubbles: If my query is Reading.where({:meter_id => parameter.meter_id}).order("created_at ASC").pluck(:timestamp, parameter.name) would I need to put an index on meter_id or created_at?
[18:05:55] chouhoul_: has joined #RubyOnRails
[18:06:48] denaras: has joined #RubyOnRails
[18:07:16] forcer: mrbubble_: You can add one each. If you have only few meter_ids, it's not worth it, though. Also, try to do the calculation in Postgres, not in Ruby.
[18:07:52] mrgreenfur: has joined #RubyOnRails
[18:08:17] mDuff: has joined #RubyOnRails
[18:08:17] DoubleMalt: has joined #RubyOnRails
[18:08:25] hnanon: has joined #RubyOnRails
[18:08:46] sp1rs: has joined #RubyOnRails
[18:08:46] hnanon: I have: https://gist.github.com/anonymous/602f94c830cf4619c631f1eb92ad4281
[18:09:58] hnanon: Sometimes line 8 or 9 will not exist.
[18:10:06] hnanon: It's throwing an error when that's the case.
[18:10:07] joshkovach: has joined #RubyOnRails
[18:10:26] hnanon: How can I "skip" or make it nil when that's the case?
[18:10:44] hnanon: I guess I need it to be nil, actually.
[18:11:16] dvinciguerra: has joined #RubyOnRails
[18:11:45] tubbo: hnanon: the reason ruby throws an error is because you're basically trying to do this: nil['3h'], and since nil doesn't have a method called '[]
[18:11:49] tubbo: '[]', you get an error
[18:12:01] HenriettaSalt: has joined #RubyOnRails
[18:12:07] tubbo: there are a couple ways you could do that
[18:12:12] tubbo: s/do/fix*
[18:12:55] guatajuk: has joined #RubyOnRails
[18:13:02] tubbo: hnanon: one thing i can see is that this is a bit of a code smell, the way you're diving into each returned hash for the actual value. sorta seems like there should be a middleman object to figure this out for you, but who knows
[18:13:22] baweaver: has joined #RubyOnRails
[18:13:34] tubbo: you can use a ternary to check whether json['rain'] is nil and just return nil if so
[18:13:50] tubbo: so json['rain'].present? ? json['rain']['3h'] : nil
[18:14:03] hnanon: tubbo: Can you tell me more about the code smell?
[18:14:11] hnanon: That's the only way I know how to do it.
[18:14:25] sleungcy: has joined #RubyOnRails
[18:14:49] sp1rs: has joined #RubyOnRails
[18:15:09] mrbubbles: forcer - what calculation?
[18:15:14] mrbubbles: Oh you mean calculating the average?
[18:15:19] forcer: mrbubble_: Yes
[18:15:26] context: hnanon: he's saying wrap the response in a dedicated object to handle this stuff for you
[18:15:29] mrbubbles: Yep that's my plan I'm just doing a SQL for it now
[18:15:48] forcer: mrbubble_: Doing that in SQL will speed up the query immensely :-)
[18:16:13] moeabdol1: has joined #RubyOnRails
[18:16:39] adre: has joined #RubyOnRails
[18:17:21] hnanon: context: Can you point to an example somewhere? I have no idea how to do that.
[18:17:30] stannard: has joined #RubyOnRails
[18:17:32] SteenJobs: has joined #RubyOnRails
[18:17:48] context: class YourClassName
[18:17:58] FCser: has joined #RubyOnRails
[18:18:16] hnanon: 1 sec...let me update the gist for context ( :P)
[18:18:54] jenrzzz: has joined #RubyOnRails
[18:19:39] hnanon: context: tubbo: https://gist.github.com/anonymous/eef866ab0e6f6a28faa85568344658f6
[18:21:29] beauby: has joined #RubyOnRails
[18:21:42] context: response = MyAwesomeWeather.new(open(request).read)
[18:21:49] context: .readlines.join is awesome.
[18:21:51] tubbo: hnanon: the "code smell" here is just an indicator of short-sighted design, in which the code itself is both error-prone and difficult to modify
[18:21:55] krz: has joined #RubyOnRails
[18:22:15] mikecmpbll: has joined #RubyOnRails
[18:22:56] tubbo: hnanon: it's that way because, as you can see, you're having issues when all of the data isn't in its place..for example, the "contract" that you have imposed upon the data source is not being fulfilled...but that's only because the data source was not aware of your contract :)
[18:23:27] hnanon: tubbo: I understand. But what's my alternative?
[18:23:29] mrgreenfur: has joined #RubyOnRails
[18:23:47] tubbo: one can code defensively to get around this issue, by converting this big imperative method into a couple utility classes that have the capability of providing default values when the contract is not fulfilled
[18:24:23] context: tubbo must be a technical writer
[18:24:26] context: ACTION hides
[18:24:41] w0rd-driven: has joined #RubyOnRails
[18:25:12] tubbo: hnanon: but yeah, the first thing you need to do is abstract what you're doing here with the `json` variable into its own class.
[18:26:18] forcer: When you have complex JSON objects, it's often a good idea to have a wrapper object so you can hide all the details of validation, conversion, default values, specific knowledge of the layout etc. behind some helper methods. So that the calling code does not have to concern itself with that. Separation of concerns, basically.
[18:26:21] tubbo: hnanon: basically it just moves some of the complexity to its own class, where it can be isolated and tested in and of itself. right now if you were to test this, you'd find it quite hard to mock out all the data to set up the test properly.
[18:26:38] tubbo: i'd bet money that you don't have a test written for this, nor do you have any plans to test this method.
[18:27:05] tubbo: it's effectively impossible without internet access, because you need to make the http request.
[18:28:01] hnanon: tubbo: LOL. Test? I have yet to write a single test. (It's on my list of things to start doing).
[18:28:57] IrishGringo: has joined #RubyOnRails
[18:29:13] tubbo: hnanon: haha that's pretty obvious :) had you written this with testing in mind, what i'm saying to you requires no explanation. that would probably just be the way you developed the feature.
[18:31:37] Dimik: has joined #RubyOnRails
[18:32:24] twilling: has joined #RubyOnRails
[18:32:33] SteenJobs: hey guys - generally when creating an association in a basic [model1] has_many/[model 2] belongs_to relationship, one would do model1.model2.create - but if my model2 object was created before my model1 object, how would i create the association when creating my model1 object?
[18:33:01] tubbo: SteenJobs: you can just set model1.model2 = your_model2
[18:33:54] SteenJobs: tubbo: oh no kidding - does it save immediately as well?
[18:34:10] tubbo: SteenJobs: no, you'd have to call model1.save, or alternatively... model1.update model2: your_model2.
[18:34:31] gingray: has joined #RubyOnRails
[18:34:47] SteenJobs: tubbo: so basically if company has_many users, when i create my company object i can just do company.user = current_user?
[18:35:06] SteenJobs: good to know - but i guess the saving doesn’t matter much, since i’ll just create the association before i save the company in #create
[18:36:03] jstransky: has joined #RubyOnRails
[18:36:20] twilling: has joined #RubyOnRails
[18:37:14] nzst: has joined #RubyOnRails
[18:37:27] tubbo: SteenJobs: you just have to make sure you're not trying to e.g. tell model1 to set model1.model2_id = model2.id if model2.id not a thing yet
[18:37:31] tubbo: because there's no id for unsaved models
[18:37:48] SteenJobs: model2 is always a thing - model2 is the current_user
[18:37:51] nzst: Hi, How can I allow a single user access to a feature at a time? I'm tryig to set up a queue on a camera, allowing one person to control at a time
[18:38:05] SteenJobs: tubbo: and model1 is the new object, company, which has_many users
[18:38:19] SteenJobs: tubbo: although since a company can have multiple users, wouldn’t it be company.users << current_user?
[18:38:22] tubbo: SteenJobs: thanks for using real names :P
[18:38:26] tubbo: SteenJobs: that's what i was getting at
[18:38:50] SteenJobs: tubbo: what, you mean you don’t telepathically know my whole code base? what’s wrong with you??
[18:38:54] mrgreenfur: has joined #RubyOnRails
[18:41:55] SteenJobs: tubbo: oh wait - belongs_to generates the create_<your_model> method, so when i create the company object (model1 which has_many users), i can just do current_user.create_company(:company_params)
[18:45:47] arup_r: request.fullpath # => "leads", but it should give me "/leads". What could be wrong? http://api.rubyonrails.org/classes/ActionDispatch/Request.html#method-i-fullpath
[18:48:06] arup_r: I have no idea where should I go to debug this..
[18:48:51] syndikate: Can somebody explain me the snippet?
[18:48:51] syndikate: request = Net::HTTP::Get.new(uri.request_uri)
[18:48:52] syndikate: request['X-Id'] = ENV['Client-id']
[18:48:52] syndikate: request['X-Secret'] = ENV['Client_secret']
[18:49:01] DragonPunch: has joined #RubyOnRails
[18:49:18] syndikate: Is that request header being initialised?
[18:49:53] ur5us: has joined #RubyOnRails
[18:50:33] maqr: syndikate: yes, that's setting http headers from environment variables
[18:51:34] drbayer: has joined #RubyOnRails
[18:51:53] Musashi007: has joined #RubyOnRails
[18:56:17] aegis3121: has joined #RubyOnRails
[18:57:06] syndikate: maqr, I am not able to replicate it in postman, whereas I can run it in ruby
[18:57:59] maqr: syndikate: in postman, your headers would be called 'X-Id' and 'X-Secret', but the values will be whatever your environment has them set as
[18:58:22] hnanon: tubbo: Moving the complexity into its own class is something I've never done. Can you point to an example somewhere where that's done?
[18:59:12] someish: has joined #RubyOnRails
[18:59:32] tubbo: hnanon: i find sandi metz's talks to be very informative on how to organize your code in a way that is easy for you to understand. https://www.youtube.com/watch?v=8bZh5LMaSmE
[18:59:45] tubbo: there's also https://www.youtube.com/watch?v=URSWYvyc42M
[19:00:02] hnanon: Ok. I'll watch those. Thank you.
[19:04:53] cpruitt: has joined #RubyOnRails
[19:05:11] twilling: has joined #RubyOnRails
[19:05:36] sonofdirt: has joined #RubyOnRails
[19:05:59] epochwolf: arup_r: check the configuration of your front end server. That value comes from the SCRIPT_NAME environment variable.
[19:06:56] arup_r: epochwolf: frontend server means?
[19:07:04] arup_r: I mean didn't get you
[19:07:04] epochwolf: arup_r: nginx/apache
[19:07:18] smathy: I wish Sandi would get a different voice.
[19:07:19] arup_r: epochwolf: the issue is happening in my local Webrick also
[19:07:22] duaneb: has joined #RubyOnRails
[19:07:32] P4Titan: has joined #RubyOnRails
[19:07:41] epochwolf: arup_r: okay, is it causing any problems with the framework?
[19:07:56] Cache_Money: has joined #RubyOnRails
[19:07:59] epochwolf: Really? What's the error?
[19:08:13] baweaver: has joined #RubyOnRails
[19:09:15] smathy: context, I don't like her voice.
[19:09:25] smathy: I can't listen to it for more than a minute.
[19:09:27] flashpoint9: has joined #RubyOnRails
[19:09:28] arup_r: it is giving wrong url ..if I call request.original_url getting "http://localhost:3000/leads" and request.url giving "http://localhost:3000leads"
[19:09:31] tubbo: smathy: haha you must *love* Ruby Rogues ;)
[19:09:38] P4Titan`: has joined #RubyOnRails
[19:09:52] arup_r: that wrong url is from request.fullpath .. https://github.com/rails/rails/blob/4-1-stable/actionpack/lib/action_dispatch/http/url.rb#L158
[19:10:10] arup_r: I checked request.fullpath is `leads` instead of `/leads`
[19:10:28] Acontius: has joined #RubyOnRails
[19:10:57] arup_r: but, I have no idea what configuration in my app, might caused this ..
[19:11:54] tubbo: arup_r: are you doing redirect_to 'leads' anywhere by chance?
[19:12:05] tubbo: you might need redirect_to leads_path instead
[19:13:02] arup_r: no ..we have one engine. where we have a method called stored_location, and there we have line `session[:return_to] = request.original_url if request.get?`
[19:13:46] arup_r: sorry. `session[:return_to] = request.url if request.get?
[19:14:19] tubbo: is :return_to getting set when you have this issue?
[19:14:51] arup_r: so when a user hits url without loggin, we store the url in the session var as you see and take them to login page.. once they sign in, we return the user back to the url where they hit.
[19:15:15] arup_r: yes it is.. I see it in cookie but encrypted though.
[19:15:46] arup_r: I put raise 1.inspect inside a method, and it shows me the error .. so it is going there.. no doubt.
[19:16:18] arup_r: then I inspected reuest.path and found the path as `leads` instead of `/leads` .. and that is whole point of this issue
[19:16:47] arup_r: basically in my app every where I am seeing request.path gives a path without a leading `/`
[19:16:57] sandstrom: has joined #RubyOnRails
[19:17:09] arup_r: sorry **fullpath
[19:17:14] arup_r: not *path*
[19:17:15] smathy: What about original_fullpath arup_r ?
[19:17:21] arup_r: That works
[19:17:44] arup_r: orginal_* both methods working.. only this fullpath is wrong for me..
[19:17:51] sergey_makagon: has joined #RubyOnRails
[19:18:43] P4Titan``: has joined #RubyOnRails
[19:18:46] arup_r: Right now I did fix it like `session[:return_to] = request.original_url if request.get?` .. but still no idea what changed the `request.fullpath` output..
[19:18:47] SteenJobs: has joined #RubyOnRails
[19:18:56] sp1rs: has joined #RubyOnRails
[19:19:36] SeanLazer: has joined #RubyOnRails
[19:22:00] krz: has joined #RubyOnRails
[19:22:06] Cohedrin_: has joined #RubyOnRails
[19:22:15] smathy: ...which suggests a middleware problem.
[19:22:46] SteenJobs: any way to conditionally apply a content_tag based on whether a string already contains tags?
[19:23:04] SteenJobs: basically i have my _error_messages partial which iterates thru flash messages and places them in <p> tags
[19:23:11] rogue_koder: has joined #RubyOnRails
[19:23:24] Cohedrin_: has joined #RubyOnRails
[19:23:53] SteenJobs: but i also have a devise helper which iterates through the devise error messages, joins them, and adds them to flash - problem is, i need to add <p> tags to the devise messages before the join…cuasing <p> tags to be applied twice - once in the devise helper and once in my _error_messages partial
[19:24:35] mdw7: has joined #RubyOnRails
[19:24:37] ramfjord: has joined #RubyOnRails
[19:25:13] arup_r: has joined #RubyOnRails
[19:25:47] delgiudices: has joined #RubyOnRails
[19:25:56] delgiudices: Has anybody worked with natural language procesing? what gem do you recommend?
[19:26:03] arup_r: smathy: any way I can reach to debug there..
[19:26:07] delgiudices: I was looking at treat but i cannot find an spanish translation
[19:26:21] arup_r: that _middleware_ problem you said.
[19:26:29] DoctorMonocular: has joined #RubyOnRails
[19:26:38] smathy: arup_r, how much time you really want to spend on this when you have a perfectly viable alternatively.
[19:27:13] arup_r: smathy: ok, the current fix is a healthy fix? not sure :)
[19:27:19] arup_r: yeah my fix is working..
[19:27:23] yfeldblum: has joined #RubyOnRails
[19:27:50] arup_r: but what bug I pushed into Rails middleware no idea.... so thought to ask here.
[19:28:16] mdw: has joined #RubyOnRails
[19:28:32] smathy: I doubt it's Rails.
[19:29:14] bronson: has joined #RubyOnRails
[19:31:18] sudoubuntu: has joined #RubyOnRails
[19:32:56] guatajuk: has joined #RubyOnRails
[19:35:08] Radar: GOOD MORNING
[19:36:22] Cache_Money: has joined #RubyOnRails
[19:36:26] jenrzzz: has joined #RubyOnRails
[19:36:34] stannard: has joined #RubyOnRails
[19:36:39] sergey_makagon: has joined #RubyOnRails
[19:36:57] AzaToth: has joined #RubyOnRails
[19:37:27] P4Titan``: has left #RubyOnRails: ()
[19:37:40] P4Titan: has joined #RubyOnRails
[19:37:49] P4Titan: Hello all. In my models, I have some active record classes which only contain has_many, belongs_to, etc. In my migration file, I defined several fields, but is there some way to include these fields in my model so that I know what data each class contains?
[19:38:33] delgiudices: Natural language processing anyone?
[19:40:35] arBmind: has joined #RubyOnRails
[19:41:37] lord4163: has joined #RubyOnRails
[19:41:37] Cache_Money: has joined #RubyOnRails
[19:42:54] baweaver: has joined #RubyOnRails
[19:43:15] Radar: P4Titan: why do you want to do that?
[19:43:24] Radar: P4Titan: you don't typically refer to many of your fields in the model itself.
[19:44:04] P4Titan: Well, when I look at a model, I don't see exactly what fields it contains
[19:44:24] smathy: P4Titan, does https://github.com/ctran/annotate_models maybe do what you want?
[19:45:06] lemur: has joined #RubyOnRails
[19:45:16] P4Titan: smathy: I'd say so
[19:45:21] P4Titan: So the solution is via comments
[19:45:33] smathy: P4Titan, that one is.
[19:45:58] P4Titan: Also, is it common to build forms by using active record objects?
[19:47:11] P4Titan: So should I use a table-less model for my forms and translate that to the active record object?
[19:48:24] pawnbox: has joined #RubyOnRails
[19:48:45] Radar: P4Titan: form_for @a_model_instance_goes_here is very common
[19:48:56] adamsilver: has joined #RubyOnRails
[19:49:08] P4Titan: Radar: but so far, my model instances are active records
[19:49:18] Radar: that is what I'm saying.
[19:49:26] P4Titan: except for one which I had to include some modules to make it a table-less model
[19:49:31] deur-_: has joined #RubyOnRails
[19:49:58] P4Titan: like ActiveModel Validations, Conversion, Naming
[19:50:19] snowy: has joined #RubyOnRails
[19:50:22] smathy: P4Titan, I assumed you must have meant something else by "by using AR objects" - yes, using AR objects in forms is the most common.
[19:50:35] smathy: P4Titan, you need to do a tutorial, or at least read the guides.
[19:50:43] Radar: ^ my opinion also
[19:50:56] P4Titan: smathy: I read the docs man
[19:51:05] P4Titan: except the examples they use arn't AR's
[19:51:17] Radar: [citation needed]
[19:51:24] Radar: http://guides.rubyonrails.org/getting_started.html#using-partials-to-clean-up-duplication-in-views
[19:51:30] Radar: Oh look it's an AR example
[19:51:49] Radar: http://guides.rubyonrails.org/layouts_and_rendering.html#using-render
[19:51:51] Radar: Look more AR things
[19:52:01] Radar: http://guides.rubyonrails.org/active_record_querying.html
[19:52:06] Radar: EVEN MORE AR THINGS
[19:53:55] P4Titan: well, dang
[19:54:11] P4Titan: the form_helper doc doesn't explicitly say Article is a AR Model
[19:54:38] Radar: Section 5.10 of the getting started guide
[19:54:52] Radar: Section 5.4 generates it using `rails g model`
[19:54:57] forcer: tubbo: Thank you for the link to Sandi's talk on "all the little things", that was excellent!
[19:55:20] Radar: Active Record is mentioned 9 times in that guide.
[19:55:45] P4Titan: ok, I seemed to miss the getting started guide
[19:55:55] P4Titan: I will have it in mind to consult for future reference
[19:56:00] Radar: Great idea.
[19:56:01] helpa: Rails 4 in Action - http://manning.com/bigg2 - An excellent book combining Rails and TDD/BDD development. Written by Rebecca Skinner, Steve Klabnik, Ryan Bigg, Yehuda Katz
[19:56:03] Radar: Consult that too.
[19:56:06] twilling: has joined #RubyOnRails
[19:56:46] dvinciguerra: has joined #RubyOnRails
[19:56:58] DoctorMonocular: has joined #RubyOnRails
[19:57:16] jstransky: has joined #RubyOnRails
[19:57:51] nkulig: has joined #RubyOnRails
[19:59:20] hahuang61: has joined #RubyOnRails
[19:59:21] DragonPunch: has joined #RubyOnRails
[19:59:34] Rubie: has joined #RubyOnRails
[20:00:08] KensoDev: has joined #RubyOnRails
[20:00:25] DoctorMonocular: has joined #RubyOnRails
[20:01:57] hahuang65: has joined #RubyOnRails
[20:04:08] sonofdirt: has joined #RubyOnRails
[20:04:46] guataju: has joined #RubyOnRails
[20:05:20] guatajuk: has joined #RubyOnRails
[20:05:49] ferlegend: has joined #RubyOnRails
[20:06:38] guataju: has left #RubyOnRails: ()
[20:07:42] guatajuk: has joined #RubyOnRails
[20:10:41] sypheren: has joined #RubyOnRails
[20:11:49] ferlegend: has left #RubyOnRails: ()
[20:12:36] fernando: has joined #RubyOnRails
[20:12:37] agit0_: has joined #RubyOnRails
[20:13:21] ferr: has joined #RubyOnRails
[20:15:44] MaienM: has joined #RubyOnRails
[20:17:40] dex7: has joined #RubyOnRails
[20:18:25] ferlegend: has joined #RubyOnRails
[20:20:13] sypheren: has joined #RubyOnRails
[20:20:48] dtzuzu: has joined #RubyOnRails
[20:22:53] n008f4g_: has joined #RubyOnRails
[20:23:53] Spami_: has joined #RubyOnRails
[20:24:48] Kamuela: has joined #RubyOnRails
[20:25:19] snowy: has joined #RubyOnRails
[20:28:53] DoctorMonocular: has joined #RubyOnRails
[20:30:08] Pathfinder: has joined #RubyOnRails
[20:30:21] lalalaaa: has joined #RubyOnRails
[20:31:34] manfrin: has joined #RubyOnRails
[20:31:58] lalalaaa: Hi! Can someone help me decide what to use for my ecommerce store -- the classic Spree-based Solidus project (https://github.com/solidusio/solidus) or the Rails + Spree + ReactJS (Universal) + Redux + ES6 (Babel6) + Webpack + Hot Reload https://github.com/spark-solutions/spark-starter-kit?
[20:32:01] Pathfinder: This is related to a gem. How do I call an action from my default controller from an activeadmin resource. e.g. call a method 'favorite' located app/controllers/posts_controller.rb from app/admin/post.rb
[20:33:06] Pathfinder: lalalaaa: 90% of the time you don't need all that React+Webpack+Redux etc
[20:33:17] Pathfinder: Go with the simpler boring solution to you
[20:33:24] Radar: lalalaaa: Solidus.
[20:34:28] tubbo: lalalaaa: as someone who works on something similar to Solidus (but proprietary), i can say that the benefits of client-side templating is lost on a lot of eCommerce...given our necessity for good SEO and speed.
[20:34:28] context: i dont know... spark sounds awesome.
[20:34:35] context: its got every buzzworld possible
[20:35:23] GodFather: has joined #RubyOnRails
[20:35:30] twilling: has joined #RubyOnRails
[20:37:36] lalalaaa: Anybody know what's the best way to customize ones Solidus store? Edit myshop/solidus/frontend directly or copy its views and assets to myshop/app?
[20:37:53] pawnbox: has joined #RubyOnRails
[20:37:58] Pathfinder: Hey guys, has someone experienced a similar issue to what I posted above regarding activeadmin?
[20:37:58] ferlegend: has left #RubyOnRails: ()
[20:37:59] tubbo: lalalaaa: solidus.io has all the answers
[20:38:22] tubbo: lalalaaa: that question is answered by an entire website full of documentation, we can't possibly answer it here.
[20:38:36] legender: has joined #RubyOnRails
[20:38:56] Radar: lalalaaa: slack.solidus.io
[20:39:04] Radar: lalalaaa: that is a better place to ask these questions
[20:39:11] Radar: this channel is better suited for general rails support
[20:40:00] DoctorMonocular: has joined #RubyOnRails
[20:40:04] uglybandersnatch: has joined #RubyOnRails
[20:40:07] lalalaaa: Solidus is based on Spree right which has the same architecture as https://github.com/rubysherpas/forem? There I can just `rails g forem:views` if I want to customize which is really convenient.
[20:40:17] lalalaaa: Radar: Thanks, will do!
[20:40:31] Radar: has the same architecture as https://github.com/rubysherpas/forem <- no
[20:40:43] Radar: forem and spree are both engines and that's where the similarity ends.
[20:41:37] sonofdirt: has joined #RubyOnRails
[20:41:37] lalalaaa: Either way I'm glad I'm doing this now vs. 10 years ago when all we had was Substruct :)
[20:42:03] renegadeandy: has joined #RubyOnRails
[20:43:16] meoblast001: has joined #RubyOnRails
[20:43:17] Radar: Oh and another similarity: I maintained Forem and Spree (now Solidus) for quite a while.
[20:43:29] Radar: I'm still #1 on the solidus contributors list https://github.com/solidusio/solidus/graphs/contributors
[20:43:51] lalalaaa: I sorta figured that ;)
[20:43:53] mwlang: when it comes to writing an rspec for error conditions, what’s a good way to just expressly cause an error to be raised so I can test that my logic recovers from an error condition as intended?
[20:44:18] lalalaaa: * guessed, rather
[20:44:26] lalalaaa: this slack thing looks awesome
[20:44:28] Radar: mwlang: what have you tried so far?
[20:44:51] djbkd: has joined #RubyOnRails
[20:44:52] mwlang: Radar: I usually let “real errors” do the trick.
[20:45:25] DoctorMonocular: has joined #RubyOnRails
[20:45:29] mwlang: but I have a situation today where we got a 8mb binary file and when that’s written to mysql’s longblob field, Mysql is bombing with a closed connection.
[20:46:01] mwlang: I really don’t want to check an 8mb fixture into git, but generating a fake 8mb binary isn’t triggering the same error as the real data.
[20:46:56] mwlang: basically, I’ve never tried to mock-throw (or whatever it might be called) an imagined error to exercise the rescue blocks.
[20:48:29] uglybandersnatch: has joined #RubyOnRails
[20:48:44] Radar: what method is getting called and what error is it raising
[20:48:45] dopamean_: has joined #RubyOnRails
[20:48:52] Radar: and can you reproduce it with a smaller blob?
[20:50:14] gormandy: has joined #RubyOnRails
[20:50:36] gormandy: I made a migration to add a null constraint and my logs blew up with errors. I went into the rails console and looked for columns with null values and it returned 0 records... so the migration seemed to have worked but I still got the error. Anyone have an idea for what happened? Here's the migration along with the error: https://gist.github.com/stuffandthings/9db3aa60d308749ae1e3dfc715609ee8
[20:50:59] snowy: has joined #RubyOnRails
[20:51:37] mwlang: Radar: I’ve been trying to reproduce with smaller blob….let me gist the error.
[20:51:40] lalalaaa: tubbo: Doesn't Google now know how to properly index those client-side apps?
[20:52:23] sonofdirt: has joined #RubyOnRails
[20:52:44] Radar: gormandy: !fake
[20:52:44] helpa: gormandy: Please do not use fake values, as they can be confusing or misleading. Sometimes both.
[20:52:57] Radar: gormandy: error is not useful on its own. Provide stacktrace too please.
[20:53:15] gormandy: there was no stacktrace along with that, just the pg error
[20:53:51] Radar: gormandy: I doubt that very much.
[20:54:29] gormandy: I'm using papertrail and not sure how to get the relevant stacktrace, nothing broke and my values in activerecord were legit
[20:54:43] gormandy: all tasks succeeded and nothing was blocked
[20:54:48] mwlang: Radar: https://gist.github.com/mwlang/63a30b5823385d63faa04ae59f91b29f
[20:55:05] gabr13l: has joined #RubyOnRails
[20:55:42] Radar: gormandy: there is always a stacktrace if yu look hard enough for it
[20:55:49] baweaver: has joined #RubyOnRails
[20:57:22] jscheel: has joined #RubyOnRails
[20:58:22] lalalaaa: Radar: Wouldn't Forem be great with https://github.com/shakacode/react-webpack-rails-tutorial/?
[20:58:23] gormandy: The table column isn't actually being used for anything yet, the only relevant bit was adding the column. No piece of code touches this column
[20:58:31] Radar: lalalaaa: You're the one telling the story ;)
[20:58:36] Radar: lalalaaa: Ino longer maintain forem
[20:58:43] gormandy: the migration was just in preparation for a feature that *will* use it
[20:58:47] markelite: has joined #RubyOnRails
[20:59:35] lalalaaa: Radar: Do you think it would be awesome though? If so I might go ahead and try
[20:59:50] Radar: lalalaaa: !subjective
[20:59:50] helpa: lalalaaa: What you just asked could be classed as subjective. Subjective questions often start flamewars, which are tedious and boring. Try all the available options and see which one suits you the best.
[21:00:21] sergey_makagon: has joined #RubyOnRails
[21:00:38] lalalaaa: Gotcha! Thanks
[21:02:01] jstransky: has joined #RubyOnRails
[21:02:04] Radar: I don't maintain Forem so I don't have opinions about it any more. It's easier that way :)
[21:02:51] Spami_: has joined #RubyOnRails
[21:03:36] VeryBewitching: Apparently it's "The best Rails 3 and Rails 4 forum engine. Ever."
[21:03:51] VeryBewitching: I think that should be EVAR, but ya
[21:03:51] mwlang: are method stubs the way to go? in my case stubbing the abstract_mysql_adapter #query method to just raise an error and then perform the spec?
[21:04:38] jstransky: has joined #RubyOnRails
[21:04:43] Radar: mwlang: no
[21:04:54] TheShaun: has joined #RubyOnRails
[21:04:55] Radar: mwlang: that is stubbing a private API and should be avoided at all costs.
[21:05:05] djbkd: has joined #RubyOnRails
[21:06:05] _djbkd: has joined #RubyOnRails
[21:06:12] mwlang: Radar: well, this is the specific line that craps out: ImageObject.create(image: image, binary_base_64: case_info.image.binary_object)
[21:07:09] jscheel: Hi all! I have an association that is created on after_commit. Normally the parent is saved, which persists the associated models too, but I also need to ensure the associated models are persisted when just parent.update_attributes is called. What’s the best way to do this?
[21:07:57] mwlang: no idea how to stub around that…it’s the contents of binary_base_64 field (a longblob) which isn’t congruent to what’s really being saved… a Base64 decoded content received over the web (I inherited this project, so I didn’t name the fields). :-/
[21:08:50] _Tariq: has joined #RubyOnRails
[21:09:44] mDuff: has joined #RubyOnRails
[21:10:24] smathy: jscheel, : autosave
[21:11:09] choke: has joined #RubyOnRails
[21:13:29] _Tariq_: has joined #RubyOnRails
[21:14:50] SteenJobs: has joined #RubyOnRails
[21:14:59] jscheel: smathy: ok, so I added autosave to the association
[21:16:06] jscheel: smathy: ticket has_many actions. called `ticket.update_attributes(state: ‘closed’)`, but association still shows unpersisted
[21:17:58] smathy: jscheel, it'll only be updated if it's dirty.
[21:18:34] smathy: jscheel, that code you're showing isn't updating any association.
[21:20:02] diegoaguilar: has joined #RubyOnRails
[21:21:29] blackmesa: has joined #RubyOnRails
[21:22:11] jscheel: smathy: ah, I think I have it. The association was legitimatly invalid
[21:25:10] anna`: has joined #RubyOnRails
[21:25:11] legender: has joined #RubyOnRails
[21:25:43] smathy: jscheel, np :)
[21:26:31] P4Titan: Hello all; Im sorry to bother again. I can't seem to find a definitive description of this: should each model be contained alone in its own file?
[21:28:06] smathy: P4Titan, just follow the conventions you find in the tutorial you're doing.
[21:28:34] legendario: has joined #RubyOnRails
[21:29:08] MrPunkin: has joined #RubyOnRails
[21:29:11] MrPunkin: has left #RubyOnRails: ()
[21:29:13] n008f4g_: has joined #RubyOnRails
[21:29:16] dopie: has joined #RubyOnRails
[21:29:58] daivyk: has joined #RubyOnRails
[21:30:28] bronson: has joined #RubyOnRails
[21:30:47] djbkd: has joined #RubyOnRails
[21:31:03] ferlegend: has joined #RubyOnRails
[21:31:05] Radar: mwlang: allow(ImageObject).to receive(:create).and_raise_error... I guess?
[21:31:17] ferlegend: has left #RubyOnRails: ()
[21:31:23] delgiudices: has joined #RubyOnRails
[21:33:00] sandstrom: has joined #RubyOnRails
[21:33:06] legendario1: has joined #RubyOnRails
[21:33:12] legendario1: has left #RubyOnRails: ()
[21:34:56] yfeldblum: has joined #RubyOnRails
[21:38:23] deur-: has joined #RubyOnRails
[21:38:35] georgedrummond: has joined #RubyOnRails
[21:42:10] uglybandersnatch: has joined #RubyOnRails
[21:42:19] axl__: has joined #RubyOnRails
[21:44:04] bahar: has joined #RubyOnRails
[21:44:04] bahar: has joined #RubyOnRails
[21:44:07] mwlang: I flat out don’t grok how to get mocks/stubs to work. all the examples I’m finding are with instantiated objects, which I don’t have a handle on within my specs.
[21:45:23] leeky: has joined #RubyOnRails
[21:46:39] smathy: mwlang, http://rspec.info/documentation/3.4/rspec-mocks/#label-Settings+mocks+or+stubs+on+any+instance+of+a+class
[21:48:21] Pathfinder: Man I really don't want to be repetitive but I need a small push here
[21:48:34] Pathfinder: How do I call an action from my default controller from an activeadmin resource. e.g. call a method 'favorite' located app/controllers/posts_controller.rb from app/admin/post.rb
[21:48:42] Pathfinder: I don't want to duplicate my code to admin/post.rb
[21:49:31] mwlang: smathy: now, why couldn’t I google up that page…that’s much better docs than the relish stuff: allow_any_instance_of(ImageObject).to receive(:create) { lambda(raise 'a conniption fit') } => ImageObject does not implement #create
[21:50:14] mwlang: It’s an ActiveRecord model…it *should* have a #create method.
[21:50:31] Radar: allow_any_instance_of(ImageObject).to receive(:create)
[21:50:32] Radar: What is this
[21:50:38] flashpoint9: has joined #RubyOnRails
[21:50:44] Radar: allow(ImageObject).to receive(:create) will be fine
[21:50:56] Radar: It's not an instance which is receiving the create method call. It's the class.
[21:51:19] mwlang: Ah. I have been confusing myself with endless experimentation.
[21:51:37] mwlang: I had tried: allow(ImageObject).to receive(:create) { lambda(raise 'a conniption fit') }
[21:51:41] mwlang: but no error raised.
[21:51:47] tubbo: i am the worst
[21:52:20] blackmes1: has joined #RubyOnRails
[21:52:46] owenjones: has joined #RubyOnRails
[21:53:43] Rubie: has joined #RubyOnRails
[21:55:54] cnk: Pathfinder: Very few of us use ActiveAdmin so not much help to be had
[21:56:13] cnk: is app/admin/ a controller-ish scope?
[21:56:39] Radar: ACTION reads up to ActiveAdmin; stops
[21:56:48] cnk: and what do you mean by 'call' that controller code from AA?
[21:56:54] cnk: you could redirect
[21:57:00] cnk: probably
[21:57:12] tubbo: ACTION is a big fan of adminstrate
[21:57:34] cnk: Is that Thoughtbot's admin interface builder?
[21:57:51] Pathfinder: cnk: Thanks for the info. Basically what I want to do is that when I click on a button on active_admin it executes code located on a posts_controller.rb
[21:57:58] mwlang: Pathfinder: what’s in “favorite”? If it’s business logic, move it to a model.
[21:58:10] Radar: Pathfinder: !admin
[21:58:10] helpa: Pathfinder: Please do not use active_admin, rails_admin or any other gems to build your admin interfaces. Instead, build it yourself. This will lead you to a safe path of understanding of the code, rather than to the Hell that is those gems.
[21:58:16] mwlang: then one-liner that doesn’t hurt to repeat in both controllers.
[21:59:05] Pathfinder: mwlang: I think I will move the logic to a model. That makes more sense
[21:59:40] cnk: That is often the easiest option
[21:59:45] Pathfinder: That controller method has so many redirect_tos and if statements that I feel shameful to even share :o !
[21:59:56] mwlang: Radar: what? no bashin dry_crud, too?
[21:59:57] Radar: Pathfinder: I have been in this channel for 10 years. You cannot shock me.
[22:02:01] mrbubbles: has joined #RubyOnRails
[22:02:13] Pathfinder: Radar: Look at this :( http://pastebin.com/Me63S03g
[22:03:07] Pathfinder: Radar: http://pastie.org/10781243
[22:03:48] Pathfinder: That code is so fugly....would appreciate some comments on how to refactor it from anyone
[22:03:51] mwlang: Pathfinder: not likely to work in both admin and main controller anyhow…those redirects depend on actions also defined in the main controller and not likely in your admin resource.
[22:04:46] mwlang: Pathfinder: move the business logic to models.
[22:05:17] Pathfinder: mwlang: I understand. I would like to refactor this code to be more beautiful and into many methods but the redirects are too much :o !
[22:05:32] TStap: has joined #RubyOnRails
[22:06:23] mwlang: Pathfinder: All those redirects go to :back, only the message changes.
[22:06:38] Pathfinder: mwlang: Forgive me but the term business logic, services, domain driven development are shoved around so many times that as a noob it is too much me. Then there is fat models thin controllers. thin controllers fat models :|
[22:06:42] IrishGringo: has joined #RubyOnRails
[22:07:12] mwlang: Pathfinder: “loan.amount+total_unpaid_member_loan < maximum_eligible_loan” is business logic. :-)
[22:08:04] patrick_star_2: has joined #RubyOnRails
[22:08:56] Pathfinder: Radar = Ryan Bigg :o ! .... I have a dusty Rails 4 in Action given to me yesterday by a fellow student in class
[22:08:59] baweaver: has joined #RubyOnRails
[22:09:34] Pathfinder: mwlang: Thanks a lot for the help :)
[22:09:56] bronson: has joined #RubyOnRails
[22:10:31] mwlang: Pathfinder: I think I’d refactor to raise errors instead of if/else ad infintum
[22:11:31] TStap: Is there a Ruby way to sort an HTML table by a value that is not a column in ActiveRecord?
[22:11:39] Radar: Pathfinder: yes that's me :)
[22:11:51] Radar: Pathfinder: eh this code isn't so bad
[22:11:58] mwlang: so in the create method…use before_filter to authenticate and set the @member.
[22:14:41] Pathfinder: mwlang && Radar: Let me refactor is in a few minutes then if you have some time you can look at it and inform me if it's a least better of or DRYER
[22:15:08] Cohedrin: has joined #RubyOnRails
[22:15:11] mwlang: Pathfinder: more than just DRYer…make it testable
[22:16:09] Pathfinder: Lol...I have never written a line of test in my life. But I am getting there I believe
[22:16:10] willwright: has joined #RubyOnRails
[22:19:18] willwright: has left #RubyOnRails: ()
[22:19:26] benlieb: has joined #RubyOnRails
[22:19:41] SteenJobs: is a new rails controller instance created every time a that controller is put into action? or does rails create one instance and use that instance whenever the controller is put into action
[22:20:02] workmad3: SteenJobs: a new instance is created every time that controller is used in a request
[22:20:29] Cohedrin: has joined #RubyOnRails
[22:20:50] benlieb: can rspec and test:unit / minitest coexist?
[22:20:50] workmad3: SteenJobs: trying to safely clear out instance state between requests would be a nightmare :)
[22:21:01] mwlang: benlieb: yes
[22:21:24] Radar: benlieb: dogs and cats can too, just FYI
[22:22:07] benlieb: mwlang: have you done it? An old client wants work on an old app, but I don't want to add to the minitest base
[22:22:26] benlieb: I'll gradually port them, but I'd rather not do it all at once.
[22:22:38] SteenJobs: workmad3: ha yea, that’s definitely true. thing is i’m building an onboarding flow composed of multiple stages/forms, i want to keep track of the current_stage without having to use params, so that the current/next stage can’t be altered. originally i was just going to define current_stage at the global level of my controller’s class, but i guess I can just create a class var and it should be available to all instances
[22:23:04] workmad3: SteenJobs: right... up until you actually want to scale you app
[22:23:17] Radar: > without having to use params,
[22:23:18] workmad3: SteenJobs: as that would break the moment you had a multi-process app server (such as unicorn :) )
[22:23:19] Radar: have you heard of the session
[22:23:27] pipework: Radar: Jam session!
[22:23:32] SteenJobs: workmad3: why?
[22:23:33] Radar: pipework: *mouth guitar*
[22:23:49] workmad3: SteenJobs: because processes have separate memory space
[22:23:50] SteenJobs: Radar: i guess i don’t fully understand its relevance in this context?
[22:23:51] mwlang: benlieb: done it for much the same reason as you…as I remember it, just changing your Rakefile default to invoke both test and rspec after adding the rspec-rails gem.
[22:24:00] workmad3: SteenJobs: you could put stuff in the rails session and it couldn't be altered
[22:24:05] Radar: SteenJobs: Onboarding flow for the entire application?
[22:24:12] Radar: SteenJobs: Or for each user?
[22:24:18] quazimodo: has joined #RubyOnRails
[22:24:36] Radar: "I want to not use params" sounds like "I want to impose arbitrary restrictions to make my life harder than it needs to be"
[22:24:36] SteenJobs: Radar: for each user, when they create an account, it then walks them through creating a company and setting up some profile info
[22:24:48] mwlang: benlieb: or if you use guard, set it up for watching both spec and test folders.
[22:24:55] Radar: SteenJobs: So, yeah. That's usually what params or differing URLs are used for. You should do that.
[22:25:10] Radar: SteenJobs: i.e. I have /accounts/new as the first place users go, then they go to subdomain.twistbooks.com/accounts/choose_plan.
[22:25:16] workmad3: SteenJobs: alternatively, you could generate something like a random key, store that in the session (or in a param) and use that to stash data in redis with an expiration date
[22:25:23] SteenJobs: Radar: it was actually based on something sevenseacat said to me…originally i was using params, but she pointed out that if a user simply changes the next_stage param, it could easily throw a 500 and if it’s that easy, then she said she’d consider it broken
[22:25:31] baweaver: has joined #RubyOnRails
[22:25:33] dpg1: has joined #RubyOnRails
[22:25:43] Cohedrin_: has joined #RubyOnRails
[22:25:49] benlieb: mwlang: my current Rakefile doesn't seem to load anything test-specific
[22:26:01] SteenJobs: workmad3: i mean seems a bit overkill - i simply need to keep track of the current stage number so i know which view template to render next
[22:26:16] dpg1: when would a link_to with :method => :delete send the request as a post?
[22:26:20] workmad3: SteenJobs: I'd personally use either the session or params for that
[22:26:27] Radar: dpg_: all the time
[22:26:58] workmad3: SteenJobs: although I'd also want to validate that the param corresponded to a view and if it didn't then I'd translate that to a 404 rather than a 500 :)
[22:27:03] SteenJobs: yea so i was fine with using params honestly, but if a user skips let’s say from stage 1 to stage 3, by changing params[:current_stage], a bunch of 500s get thrown
[22:27:10] SteenJobs: because their sequentially dependent
[22:27:13] Arcaire: that sounds about right
[22:27:19] Arcaire: if a user fucks with your session cookies and things break
[22:27:22] Cohedrin_: has joined #RubyOnRails
[22:27:22] Arcaire: but break safely
[22:27:37] Arcaire: Nobody is going to do that who doesn't know what they're doing, really.
[22:27:37] Radar: dpg_: I believe it simulates the DELETE request by submitting a _method parameter with "delete" as the value.
[22:27:51] SteenJobs: workmad3: right - i meant changing the param that DOES correspond to a view, just not the next view in the sequence
[22:27:54] Radar: user will not mess with your session ;)
[22:27:59] SteenJobs: Arcaire: that’s what i thought!
[22:28:00] Radar: unless the user is Arcaire
[22:28:06] dpg1: thanks Radar
[22:28:16] Arcaire: I don't even mess with sessions anymore. I wrote a Chrome plugin to do it for me as I browse.
[22:28:17] workmad3: SteenJobs: session is probably the best bet then :)
[22:28:23] Arcaire: As a result I'm currently blocked from browsing a couple of sites. :(
[22:28:24] SteenJobs: Arcaire: my attitude was totally if they know enough to fuck with the params, then they deserve to get an error haha
[22:28:35] mwlang: benlieb: have you tried just running “rake” and seeing if both specs and tests run?
[22:28:49] Radar: Arcaire: some dbag tried hacking our German site over the Easter break. We were not amused.
[22:28:49] benlieb: mwlang: haven't installed rspec yet
[22:28:51] benlieb: doing thatnow
[22:28:59] Cohedrin: has joined #RubyOnRails
[22:28:59] _Tariq: has joined #RubyOnRails
[22:29:03] workmad3: SteenJobs: if a user messes with that, then they basically invalidate their session and get logged out (thanks to rails either signing on encrypting the session, based on version)
[22:29:05] mwlang: I thought I had to tweak this, but that must’ve been Rails 2 project as I don’t have a Rails 4 project with both anymore.
[22:29:42] SteenJobs: workmad3: is adding your own data to the session supported by devise without a ton of hacking?
[22:29:56] flashpoint9: has joined #RubyOnRails
[22:29:59] workmad3: SteenJobs: yup... `session[:foobar] = "WOO!"`
[22:30:01] Pathfinder: Is sidekiq good to be used to trigger a job like 30-40 days later other than on a short interval basis?
[22:30:12] SteenJobs: Arcaire: would it be bad, let’s say i’m using params, to simply add the :stage_num to params but not have it present in the url?
[22:30:18] SteenJobs: workmad3: oh no kidding
[22:30:23] SteenJobs: wait…so why session vs. params
[22:30:27] Radar: Pathfinder: yes.
[22:30:28] SteenJobs: oh as you said
[22:30:28] Arcaire: tbh I wouldn't even do that and just have each stage point to the next stage.
[22:30:35] SteenJobs: because if someone fucks with the session, they’ll be logged out
[22:30:35] Radar: SteenJobs: Users cannot tweak with the session as easy as they can with params.
[22:30:40] workmad3: SteenJobs: session == your session cookie, and it's tamper resistant
[22:30:50] SteenJobs: so it’s like - mess with me, fuck you i’m kicking you out
[22:30:54] SteenJobs: heh it’s like a bouncer
[22:31:29] mwlang: sigh, I give up. mocking and stubbing stuff just ain’t my cup-o’ tea.
[22:31:35] SteenJobs: Arcaire: well how would it know what the next stage is?
[22:31:47] Arcaire: How would you not?
[22:31:48] benlieb: mwlang: rspec?
[22:31:49] Arcaire: It's your app.
[22:31:54] mwlang: benlieb: yup.
[22:32:25] dmz: has joined #RubyOnRails
[22:32:26] mwlang: Trying to make it so an active model throws an exception when #create is called. allow(ImageObject).to receive(:create) { lambda ben{ raise 'a conniption fit' } }
[22:32:27] SteenJobs: Arcaire: meaning i render a template stage_1, and when the form is submitted, my create action needs to render stage_2, etc.
[22:32:33] workmad3: SteenJobs: I think Arcaire's point is that each view could submit to a different action, rather than using one action for everything
[22:32:40] SteenJobs: Arcaire: so the controller needs to know what the current template’s stage is in order to know what to render next
[22:33:07] mwlang: so I can exercise the exception handling logic in the service class that’s using that ImageObject instance.
[22:33:37] workmad3: SteenJobs: and then contrast that to my personal view - render one huge-ass form and split it into multiple stages with JS :)
[22:33:43] SteenJobs: i htought about doing it that way, but if i do it NOT that way, i can keep the controller logic restful, but that’s a fair point
[22:34:18] SteenJobs: workmad3: the controller logic is a bit more complicated though, because the various stages play with different models
[22:34:53] workmad3: SteenJobs: you're not exactly being rest compliant atm btw, because the current-stage is application state, and that shouldn't be sent with the request in a strict rest interpretation
[22:35:23] SteenJobs: true - but at least the logic is contained in my create (for stage_1) and update (stages 2 and onwards) actions
[22:35:24] SteenJobs: but yea i hear
[22:35:34] owenjones: has joined #RubyOnRails
[22:35:40] workmad3: SteenJobs: ok, so why couldn't you have one large submission that you pull apart in your create action and have it interact with multiple models? :)
[22:36:07] dpg1: Radar: so I have a link_to with a :delete method, but it sends a post and gives me a 404
[22:36:25] SteenJobs: workmad3: meaning instead of executing controller actions at every step, i’d collect the data through each of the stages and then commit the data upon completion of the final step?
[22:36:38] workmad3: SteenJobs: yeah
[22:36:39] SteenJobs: not a bad approach either heh
[22:36:59] workmad3: SteenJobs: one huge form for the user, and use JS to split it into multiple stages
[22:37:09] SteenJobs: so classic. now i’m coming out of this chat even more indecisive than when i came in haha
[22:37:12] SteenJobs: workmad3: although can you explain to me re the scalability you mentioned before? seems important to be aware of and i don’t fully understand
[22:37:17] ekinmur: has joined #RubyOnRails
[22:37:21] B1n4r10: has joined #RubyOnRails
[22:37:35] workmad3: SteenJobs: oh, that's basically a reason to *never* use class-variables in rails apps... ever
[22:37:39] SteenJobs: if i let’s say created a class var holding the number of the current_Stage
[22:37:57] workmad3: SteenJobs: then that's shared with every user that hits the same instance
[22:38:13] workmad3: SteenJobs: and also isn't shared with any user that hits a different instance (instance == server process)
[22:38:19] Radar: dpg_: Any errors in your JS console as that link renders?
[22:38:28] tubbo: workmad3: never use class variables ever #ftfy
[22:38:41] workmad3: SteenJobs: and you don't generally get to ensure that the same user will hit the same process on two subsequent requests
[22:38:48] workmad3: tubbo: true :)
[22:38:52] SteenJobs: right right
[22:39:04] mwlang: F I N A L L Y: allow(ImageObject).to receive(:create).and_return( raise 'a conniption fit' )
[22:39:11] tubbo: only reason i say that is because they rely on shared state
[22:39:22] mwlang: using “and_return()” was the trick.
[22:39:26] tubbo: mwlang: did you ever try allow(ImageObject).to receive(:create).and_raise(StandardError)
[22:39:55] tubbo: or potentially and_return { raise 'a conniption' }
[22:40:37] mwlang: tubbo: no…didn’t know that one…now I see on the documentation page (oh, if I’d only read just a little bit further…)
[22:40:38] SteenJobs: workmad3: after the onboarding flow is completed, is there any reason to bother removing the :stage_num key from the session?
[22:40:40] workmad3: SteenJobs: basically, don't forget that you're in an environment with lots of users at once... and there's only one class-variable per class, meaning anything there 'leaks' across requests
[22:40:51] SteenJobs: right - makes sense
[22:41:12] workmad3: SteenJobs: I'd probably remove it so that it doesn't cause confusion, and it'll also remove a byte or two from each request
[22:41:59] SteenJobs: cool, thanks as always guys. never cease to impress me with how helpful this place is.
[22:42:58] TStap: I have a beginner question about ActiveRecord and queries if someone can help :)
[22:43:46] blackmes1: has joined #RubyOnRails
[22:44:16] TStap: I want to order a table by a value that is not a column in ActiveRecord, but it's based off a calculation between 2 values in the DB
[22:44:22] TStap: Is this possible to accomplish in the controller?
[22:44:48] cnk: yes - but unless the calculation is complicated, you can probably do it in the db
[22:44:51] shinnya: has joined #RubyOnRails
[22:44:58] zave: has joined #RubyOnRails
[22:45:09] cnk: e.g.select a - b as sort_order
[22:45:26] dvinciguerra_: has joined #RubyOnRails
[22:45:32] TStap: so create a method in the model then?
[22:45:35] delgiudices: has joined #RubyOnRails
[22:46:12] cnk: I don't think that would allow the db to do the ordering
[22:46:36] cnk: how about you show some code and we mgith be able to give more specific advice
[22:47:03] cnk: you could sort after the rows come back too. But which is preferable depends on the caculation
[22:47:09] cnk: and the # of rows
[22:47:57] TStap: well all I'm really trying to do is something like this
[22:48:02] TStap: @tickets = Ticket.order(created_at: :desc)
[22:48:11] TStap: but I want to replace created_at with a different value
[22:49:05] helpa: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[22:49:29] workmad3: TStap: if it's something stored in the database, just change it... if it's a calculation you can express in SQL, you can do that and then sort by the result... if it's just pure ruby, then you can't use `.order` and you'll need to use `.sort` on the array once it's loaded into memory
[22:49:48] workmad3: TStap: a.k.a. pretty much what cnk just told you :)
[22:50:32] Regulati_: has joined #RubyOnRails
[22:53:56] Rubie: has joined #RubyOnRails
[22:55:02] dvinciguerra__: has joined #RubyOnRails
[22:57:11] delgiudices: has joined #RubyOnRails
[22:57:47] delgiudices: I'm trying to do natural language processing but there doesn't be much gem support for this
[22:57:57] delgiudices: Is it ok if i look for external tools not in ruby?
[22:57:58] yfeldblum: has joined #RubyOnRails
[22:58:02] delgiudices: For example a CLI and use it with ruby?
[22:58:25] havenwood: delgiudices: https://github.com/diasks2/ruby-nlp#readme
[22:59:07] pawnbox: has joined #RubyOnRails
[23:02:01] Rubie: has joined #RubyOnRails
[23:02:13] mwlang: does stubbing to raise an error just not do what I think it should do? Its like the error comes back to the spec and never sees the rescue block.
[23:03:05] dalbusch1t: has joined #RubyOnRails
[23:03:35] SteenJobs: any good way to set the model object in form_for dynamically? i have two radio buttons, and the model object the form corresponds to depends on which button is selected upon submission
[23:03:41] SteenJobs: oh i guess i can use form_tag
[23:03:41] smathy: I'd have to question an NLP resource that has Mastering Regular Expressions amongst its list.
[23:04:03] havenwood: delgiudices: But yeah you can shell out if you need to. First check if there's a native implementation or a wrapper. :)
[23:04:30] havenwood: smathy: hah
[23:04:45] workmad3: mwlang: gist your current spec?
[23:04:55] mwlang: https://gist.github.com/mwlang/63a30b5823385d63faa04ae59f91b29f
[23:05:03] DragonPunch: has joined #RubyOnRails
[23:05:59] workmad3: mwlang: ok... so would you like me to point out the mistake in excruciating detail, or would you like to consider the difference between () and {} quickly? :)
[23:06:08] fryguy: ruby-ffi will also be helpful
[23:06:25] mwlang: workmad3: let’s start with the latter. :-)
[23:06:59] smathy: delgiudices, I wouldn't be surprised if there was nothing in Ruby, it's not a very ruby-y thing. I'd go for a language that has a richer set of that sort of algorithmic lib available, like Python, Perl or C.
[23:07:23] havenwood: delgiudices: Whatcha trying to do?
[23:07:25] ramfjord_: has joined #RubyOnRails
[23:07:34] prgmmr: has joined #RubyOnRails
[23:07:53] havenwood: delgiudices: Have a particular lib in mind?
[23:08:05] GitGud: has joined #RubyOnRails
[23:08:29] flashpoint9: has joined #RubyOnRails
[23:09:27] mwlang: workmad3: sheez….such. a. simple. thing.
[23:09:56] mwlang: now I can fix stupid typos in real app code.
[23:10:57] workmad3: mwlang: I know right? It's almost as if you're providing excruciatingly detailed instructions to a device that has no capability to deviate from exactly what you type, and so you need to be pedantic on an almost socipathic scale?
[23:11:01] _Tariq: has joined #RubyOnRails
[23:11:05] workmad3: *sociopathic
[23:11:17] delgiudices: havenwood i have none in mind
[23:11:30] delgiudices: i was looking for a ruby one but i couldn't find a translation
[23:11:30] MrPunkin: has joined #RubyOnRails
[23:11:42] mwlang: workmad3: my thoughts exactly.
[23:11:44] delgiudices: smathy so is it ok if i find a python one and call it via cli or something?
[23:11:49] uglybandersnatch: has joined #RubyOnRails
[23:11:59] mwlang: precision is everything and today, I don’t have it.
[23:12:13] workmad3: mwlang: take some time out and write documentation? :)
[23:12:43] smathy: delgiudices, no clue what you're doing, I'm just telling you that I wouldn't be surprised if you didn't find a Ruby one.
[23:12:55] mwlang: workmad3: nah, checking this sucker in and going to go play tennis. smashing the crapola outta fuzzy yellow orb will bring much satisfaction.
[23:13:05] havenwood: delgiudices: Say more about what you're doing. It has to do with language but what?
[23:13:32] workmad3: mwlang: heh :) have fun (I'm off to bed myself... it's past midnight, and I only had 5 hours of sleep last night)
[23:13:34] delgiudices: havenwood well i'm trying to parse a collection of reviews
[23:13:43] delgiudices: And recommend the place based on it or not
[23:13:48] krz: has joined #RubyOnRails
[23:13:53] delgiudices: And say why the place is recommended
[23:14:46] mwlang: workmad3: and yet, you still spotted the () vs {} in 30 secs
[23:14:53] Dimik: has joined #RubyOnRails
[23:15:02] d0nn1e: has joined #RubyOnRails
[23:15:28] zave: has joined #RubyOnRails
[23:16:27] dpg1: has joined #RubyOnRails
[23:16:32] FooMunki: has joined #RubyOnRails
[23:16:53] Pathfinder: has joined #RubyOnRails
[23:16:58] havenwood: delgiudices: Here's an article that might get you started: https://www.igvita.com/2007/05/23/bayes-classification-in-ruby/
[23:17:32] havenwood: delgiudices: Or take a look at these: https://github.com/diasks2/ruby-nlp#classification
[23:18:11] delgiudices: I'll take a look at it havenwood thanks
[23:18:30] djbkd: has joined #RubyOnRails
[23:18:31] havenwood: delgiudices: There are some other sentiment analysis gems as well.
[23:18:34] havenwood: delgiudices: you're welcome
[23:19:04] KensoDev: has joined #RubyOnRails
[23:21:32] flashpoint9: has joined #RubyOnRails
[23:21:52] jstransky: has joined #RubyOnRails
[23:22:47] Cohedrin_: has joined #RubyOnRails
[23:24:24] mwlang: well, as painful as this learning exercise is, I now know I can go back to other areas of the code and boost coverage on several exception handling blocks that I wasn’t quite sure how to force into error condition at will.
[23:25:16] mwlang: IMHO, this is about the *only* real use I’ve found for mocking/stubbing methods in a Rails project.
[23:26:13] mwlang: well, one other area is external system interactions as done with VCR gem….
[23:27:44] GodFather: has joined #RubyOnRails
[23:29:08] pawnbox: has joined #RubyOnRails
[23:31:12] uglybandersnatch: has joined #RubyOnRails
[23:31:37] baweaver: has joined #RubyOnRails
[23:33:51] space_bug: has joined #RubyOnRails
[23:34:20] dustinm`: has joined #RubyOnRails
[23:34:41] space_bug: has left #RubyOnRails: ()
[23:35:01] space_bug: has joined #RubyOnRails
[23:35:05] space_bug: has left #RubyOnRails: ()
[23:35:35] djinni`: has joined #RubyOnRails
[23:37:59] DLSteve: has joined #RubyOnRails
[23:42:20] Inside: has joined #RubyOnRails
[23:42:20] Inside: has joined #RubyOnRails
[23:42:55] sevenseacat: has joined #RubyOnRails
[23:45:13] Inside_: has joined #RubyOnRails
[23:46:48] pwnd_nsfw: has joined #RubyOnRails
[23:47:19] flashpoint9: has joined #RubyOnRails
[23:47:30] beauby: has joined #RubyOnRails
[23:48:40] georgedrummond: has joined #RubyOnRails
[23:48:45] krz: has joined #RubyOnRails
[23:48:51] maxx88: has joined #RubyOnRails
[23:50:18] adamsilver: has joined #RubyOnRails
[23:50:20] owenjones: has joined #RubyOnRails
[23:51:19] SeanLazer: has joined #RubyOnRails
[23:52:00] SeanLazer: has joined #RubyOnRails
[23:53:05] SeanLazer: has joined #RubyOnRails
[23:54:24] wethu: has joined #RubyOnRails
[23:54:54] FooMunki: has joined #RubyOnRails
[23:56:10] diegoaguilar: has joined #RubyOnRails
[23:57:04] one_zero: has joined #RubyOnRails