« Back to channel list

#RubyOnRails - 26 July 2015

« Back 1 day Forward 1 day »
[00:00:08] dcunit3d: for rails api POST/PUT actions, where do the attributes usually go for the object being created/modified?
[00:00:30] dcunit3d: in the past, when updating a User model for example, i usually put the attributes of the user in params[:user]
[00:01:15] dcunit3d: i haven't really thought about it much, but that's what i usually do.
[00:02:17] dcunit3d: however, i'm using restangular and i'm getting some wierd behavior. it's putting the user attributes in the root of the params, but then also putting them in params[:user]
[00:03:08] idd2d_: has joined #RubyOnRails
[00:03:24] dcunit3d: that's what's showing up in the Users#update action anyways. in the Chrome debugger, the request params don't show anything in the :user key. all the attributes are in the root of the JSON
[00:03:28] saneki: has joined #RubyOnRails
[00:04:16] hahuang65: has joined #RubyOnRails
[00:04:19] dcunit3d: but i'm mostly wondering about where to put the user params for a PUT/POST. do most people put them in params[:user] or just at the params root?
[00:04:43] DylanJ: dcunit3d: are you using @model.update in your controller?
[00:04:53] DylanJ: @model.update(model_params)
[00:05:44] DylanJ: then send it like normal. { 'model': { 'attribute': 'value' } }
[00:06:27] dcunit3d: k, thanks DylanJ. i'm just trying to figure out what the normal rails way to do it is.
[00:06:56] kazoo: has joined #RubyOnRails
[00:07:18] dcunit3d: not sure why restangular is doing it differently and why the params are showing up differently in the chrome debugger than in User#update
[00:07:53] dcunit3d: i'll probably ask on the angular channel about that
[00:10:42] bonhoeffer: has joined #RubyOnRails
[00:15:16] chancancode: has joined #RubyOnRails
[00:15:28] kazoo: has joined #RubyOnRails
[00:17:24] shwoodard: has joined #RubyOnRails
[00:18:12] christiandsg: has joined #RubyOnRails
[00:18:13] ellisTAA: has joined #RubyOnRails
[00:19:25] bonhoeffer: has joined #RubyOnRails
[00:20:01] Iacobus: has joined #RubyOnRails
[00:20:46] kumavis: has joined #RubyOnRails
[00:23:10] givanse: has joined #RubyOnRails
[00:24:14] drale2k_: has joined #RubyOnRails
[00:26:02] SteenJobs: has joined #RubyOnRails
[00:26:15] bonhoeffer: has joined #RubyOnRails
[00:27:48] nobitanobi: has joined #RubyOnRails
[00:31:28] hahuang65: has joined #RubyOnRails
[00:32:06] erichu: has joined #RubyOnRails
[00:35:48] arooni-mobile: has joined #RubyOnRails
[00:36:50] culturelabs: has joined #RubyOnRails
[00:37:35] ephantmon: has joined #RubyOnRails
[00:37:55] valetudo: has joined #RubyOnRails
[00:38:47] amitchellbullard: has joined #RubyOnRails
[00:47:39] user1138: has joined #RubyOnRails
[00:49:58] erichu: has joined #RubyOnRails
[00:50:03] shock_one: has joined #RubyOnRails
[00:51:03] zrl: has joined #RubyOnRails
[00:54:24] DoctorMonocular: has joined #RubyOnRails
[00:56:14] hahuang65: has joined #RubyOnRails
[00:57:09] nomadicoder: has joined #RubyOnRails
[00:58:17] dcunit3d: has joined #RubyOnRails
[00:59:17] Limix: has joined #RubyOnRails
[01:00:20] Maletor: has joined #RubyOnRails
[01:00:54] wethu: has joined #RubyOnRails
[01:02:41] ellisTAA: has joined #RubyOnRails
[01:03:22] ellisTAA: has joined #RubyOnRails
[01:03:46] jlpeters: has joined #RubyOnRails
[01:03:49] doodlehaus: has joined #RubyOnRails
[01:04:49] Pazician: has joined #RubyOnRails
[01:05:37] tuelz: has joined #RubyOnRails
[01:05:50] Hackbinary: has joined #RubyOnRails
[01:06:07] workmad3: has joined #RubyOnRails
[01:06:26] Pazician: has joined #RubyOnRails
[01:09:03] centrx: has joined #RubyOnRails
[01:09:47] hahuang65: has joined #RubyOnRails
[01:10:38] tuelz: I've got a model survey_instance that belongs to survey. I want to order survey_instances by the name attribute on the survey they belong to, I thought it would be straight forward, but I'm having no luck
[01:11:04] tuelz: survey_instances.order("survey.name desc") doesn't work where I'd expect it to
[01:11:49] Lightsword: has joined #RubyOnRails
[01:12:03] lethjakman: has joined #RubyOnRails
[01:12:14] tuelz: says I'm missing a from clause entry for table survey
[01:12:36] spastorino: has joined #RubyOnRails
[01:14:54] Rubie: has joined #RubyOnRails
[01:21:33] centrx: tuelz, Models are named with CamelCase ?
[01:22:09] centrx: tuelz, Sounds like you want .joins(:surveys)
[01:22:50] tuelz: centrx: yeah sorry, they are CamelCase, not sure why I typed snake
[01:23:18] lethjakman: has joined #RubyOnRails
[01:23:21] tuelz: would surveys be plural since it's a belongs to and has_one relationship in the join?
[01:23:53] centrx: ok might be singular
[01:24:48] tuelz: okay so I think I need to be more specific here. I have an array of survey_instances and want to order them by the name of the survey they belong to
[01:25:35] tuelz: it's been a while since I've touched ActiveRecord, I feel like this should be easy, but I'm just being dumb
[01:26:44] tuelz: joins also gives me the `PG::UndefinedTable: ERROR: missing FROM-clause entry for table "survey"` btw
[01:30:05] bulldawgden: has joined #RubyOnRails
[01:30:08] hahuang65: has joined #RubyOnRails
[01:30:27] eggoez: has joined #RubyOnRails
[01:32:24] jottr: has joined #RubyOnRails
[01:32:36] centrx: tuelz, Well it might want the plural
[01:33:01] centrx: tuelz, The table will have the plural name, the name to use in the order()
[01:33:15] centrx: tuelz, The joins may be singular because it's belongs_to/has_one
[01:33:40] michael_mbp: has joined #RubyOnRails
[01:33:42] centrx: tuelz, but in the order(), you are using a SQL fragment, with the table name, and the default table name ould be 'surveys'
[01:38:00] iateadonut: has joined #RubyOnRails
[01:38:04] tuelz: I think that did it, thanks a ton
[01:38:48] hahuang65: has joined #RubyOnRails
[01:41:43] dideler94: has joined #RubyOnRails
[01:46:28] nickfausnight: has joined #RubyOnRails
[01:47:07] zorak8: has joined #RubyOnRails
[01:47:23] sump: has joined #RubyOnRails
[01:48:14] one_zero: has joined #RubyOnRails
[01:48:33] RegulationD: has joined #RubyOnRails
[01:50:26] stardiviner: has joined #RubyOnRails
[01:54:07] segy: has joined #RubyOnRails
[01:55:02] robbyoconnor: has joined #RubyOnRails
[01:58:48] DoctorMonocular: has joined #RubyOnRails
[02:00:02] Craiga1121: has joined #RubyOnRails
[02:01:14] Pazician: has joined #RubyOnRails
[02:01:24] shyshy: has joined #RubyOnRails
[02:02:34] nickenchuggets: has joined #RubyOnRails
[02:04:59] SteenJobs: has joined #RubyOnRails
[02:09:41] chipotle: has joined #RubyOnRails
[02:10:38] hahuang65: has joined #RubyOnRails
[02:11:23] iamjarvo: has joined #RubyOnRails
[02:13:15] tyl: has joined #RubyOnRails
[02:18:50] bonhoeffer: has joined #RubyOnRails
[02:24:27] bmurt: has joined #RubyOnRails
[02:24:29] noodman: has joined #RubyOnRails
[02:25:26] kies^: has joined #RubyOnRails
[02:29:01] cytoskeletor: has joined #RubyOnRails
[02:30:13] zorak8: has joined #RubyOnRails
[02:30:58] Maletor: has joined #RubyOnRails
[02:33:12] jottr: has joined #RubyOnRails
[02:33:23] hahuang65: has joined #RubyOnRails
[02:34:28] JohnFord: has joined #RubyOnRails
[02:34:55] tejasmanohar: has joined #RubyOnRails
[02:38:23] willywos: has joined #RubyOnRails
[02:40:09] blackhuey: has joined #RubyOnRails
[02:42:20] tejasmanohar: is there a page that gives a comparison of job queues / infra that can be used w/ rails?
[02:42:30] tejasmanohar: and their advantages/disadvantages or just use cases / how do i decide
[02:42:54] tejasmanohar: if not, anyone know what are some of the major ones i should consider? or just a piece of advice on the subject like just start with X?
[02:43:55] willywos: I like using Resque https://github.com/resque/resque
[02:44:36] willywos: there is also a really nice resque mailer gem that lets you move all your mails to a background queue
[02:44:55] willywos: https://github.com/zapnap/resque_mailer
[02:45:57] tejasmanohar: i'll explain some more about what i'm doing- need to have jobs on a schedule to go fetch stuff from RSS feeds, scraping from websites, APIs, etc. (each separate jobs) and populate the DB
[02:46:27] willywos: oh ok so something like cron
[02:46:28] Mendenhall: has joined #RubyOnRails
[02:46:58] willywos: there is a gem called rufus-scheduler that works pretty well
[02:46:59] willywos: https://github.com/jmettraux/rufus-scheduler
[02:48:03] tejasmanohar: for the RSS feed, say i'm fetching "deals" by location and i have 50 location codes and need to go fetch the deals for each and populate db with some data from the rss feed (for each location).... well, i don't wanna spam the rss feed source by sending 50 requests one after another every hour or something because then i could get blocked since this is probably not intended for apps
[02:48:43] tejasmanohar: i'd rather loop thru the 50 location codes- fetch RSS from 1, populate db, pause X, go to next
[02:49:22] tejasmanohar: and maybe X would just be `rand(a..b)` so it varies
[02:50:39] ellisTAA: has joined #RubyOnRails
[02:50:41] tejasmanohar: willywos: ^ so if i wanted a "job" doing this running forever, would i want to use a queue?
[02:50:57] tejasmanohar: and make job for location A schedule B when it finishes etc etc until going thru all 50 for example?
[02:51:03] tejasmanohar: and restarting
[02:51:23] diego1: has joined #RubyOnRails
[02:51:30] tejasmanohar: but scheduling it in X `rand(a..b)` minutes from when job for location A ends
[02:51:59] tejasmanohar: or would i just want a rake job that i keep running continuously in an infinite loop using `sleep` to deal w/ the gaps b/w each request?
[02:52:09] hahuang65: has joined #RubyOnRails
[02:52:11] konsolebox: has joined #RubyOnRails
[02:52:20] willywos: oh yeah i would probably schedule it
[02:52:23] tejasmanohar: i'm thinking a queue could be better as i add a more advanced system, say if i wanted 10 data sources later and different rules like RSS has 15 minute gaps b/w each location
[02:52:31] chinmay_dd: has joined #RubyOnRails
[02:52:33] tejasmanohar: and web scraping site Z has 10 minute gaps
[02:53:08] tejasmanohar: and, for that, you'd recommend resque, correct? willywos
[02:53:15] christiandsg: has joined #RubyOnRails
[02:53:43] tejasmanohar: basically, what i'm trying to get at is can't activejob or something else in rails out-of-the-box do the same thing? willywos
[02:54:49] willywos: i would really only use resque if i wanted to move jobs off my main process so they could be processed later
[02:54:50] tejasmanohar: willywos: i looked at rufus, looks like for static jobs - not the type i'm looking for.... so i'm looking for a real queue?
[02:54:51] workmad3: has joined #RubyOnRails
[02:55:01] tejasmanohar: hm, what do you mean? willywos
[02:55:08] tejasmanohar: off my main process meaning rails server?
[02:55:09] willywos: what your describing, i would probably just use cron or that rufus scheduler
[02:55:25] tejasmanohar: but rufus scheduler and cron seem to say do this at time X, right?
[02:55:38] tejasmanohar: i want to be like do these things all day forever but put an X (varies) gap b/w each one willywos
[02:55:46] tejasmanohar: (as described w/ the 50 locations example)
[02:55:48] dgibs0n: has joined #RubyOnRails
[02:56:15] tejasmanohar: *do this at static time X
[02:56:49] PhantomS_: has joined #RubyOnRails
[02:57:20] shinnya: has joined #RubyOnRails
[02:57:26] yfeldblum: has joined #RubyOnRails
[02:57:39] dcunit3d: has joined #RubyOnRails
[02:57:45] tejasmanohar: because i'm thinking if i go hit the RSS feed 50 times every hour that may be sketchy, no? willywos
[02:57:55] tejasmanohar: or do RSS clients do stuff like that sometimes
[02:58:02] willywos: i dunno, i wouldn't think it would be that big of a deal
[02:58:21] willywos: could always ask the people who have the rss feed
[02:59:01] tuelz: has joined #RubyOnRails
[03:01:34] mois3x: has joined #RubyOnRails
[03:03:22] sump: has joined #RubyOnRails
[03:04:40] doodlehaus: has joined #RubyOnRails
[03:05:26] cytoskeletor: has joined #RubyOnRails
[03:09:57] braincrash: has joined #RubyOnRails
[03:10:35] kies^: has joined #RubyOnRails
[03:11:33] hahuang65: has joined #RubyOnRails
[03:14:14] bronson: has joined #RubyOnRails
[03:20:18] Arnie25: has joined #RubyOnRails
[03:20:43] portiad: has joined #RubyOnRails
[03:21:16] ellisTAA: can anyone recommend a good resource that explains how active record is communicatiing in reails with a database like postgres?
[03:21:22] Arnie25: hey guys... model_path(@model) ..how do i specify a format to that? I googled model_path(format: :xml) is how you do it, but how do you combine it with a model? model_path(model: @model, format: :xml) or something?
[03:23:39] michael_mbp: has joined #RubyOnRails
[03:24:39] Radar: Arnie25: did you try model_path(@model, format :xml)?
[03:27:52] centrx: EllisTAA, It's just composing SQL strings and sending them to the database and receiving any results, sometimes mapping them to model instances
[03:28:17] l0oky: has joined #RubyOnRails
[03:29:03] nettoweb: has joined #RubyOnRails
[03:30:16] ellisTAA: centrx: oh lol that makes a lot of sense
[03:30:23] willywos_: has joined #RubyOnRails
[03:30:23] SteenJobs: has joined #RubyOnRails
[03:32:01] hahuang65: has joined #RubyOnRails
[03:32:15] baweaver: has joined #RubyOnRails
[03:33:00] ecksit: has joined #RubyOnRails
[03:34:50] nettoweb_: has joined #RubyOnRails
[03:35:37] JoshGlzBrk: has joined #RubyOnRails
[03:35:46] ellisTAA: i have a sql file with a bunch of sql statements, i want to get all the data into my pg db, should i treat it as a csv or is there a better way of getting the data into my db?
[03:35:50] dopie: has joined #RubyOnRails
[03:37:24] SteenJobs: hellloooo rails friends
[03:38:09] michael_mbp: has joined #RubyOnRails
[03:38:18] dopie: SteenJobs, watch out this place isn't that friendly
[03:38:34] SteenJobs: dopie: hey hey, i???ve spent a lifetime???s worth of time here.
[03:38:46] dopie: So you should know :)
[03:38:49] SteenJobs: dopie: i love this place though!
[03:39:02] SteenJobs: dopie: especially in contrast to some other unnamed channels...
[03:39:14] SteenJobs: dopie: although very different crowd on the weekends.
[03:39:30] duncannz: has joined #RubyOnRails
[03:40:38] duncannz: has joined #RubyOnRails
[03:41:28] DoctorMonocular: has joined #RubyOnRails
[03:42:40] chinmay_dd: has joined #RubyOnRails
[03:46:36] nettoweb: has joined #RubyOnRails
[03:49:13] tyl: has joined #RubyOnRails
[03:49:48] hahuang65: has joined #RubyOnRails
[03:50:33] lethjakman: has joined #RubyOnRails
[03:51:00] wethu: has joined #RubyOnRails
[03:53:06] tejasmanohar: has left #RubyOnRails: ("WeeChat 1.1.1")
[03:53:53] nettoweb: has joined #RubyOnRails
[03:57:07] scatterscript: has joined #RubyOnRails
[03:58:10] nettoweb: has joined #RubyOnRails
[03:59:15] scatterscript: has left #RubyOnRails: ()
[04:05:18] SteenJobs: it???s like a desert in here???an unpopulated desert.
[04:10:28] hahuang65: has joined #RubyOnRails
[04:12:57] Lightsword: has joined #RubyOnRails
[04:13:36] sevenseacat: has joined #RubyOnRails
[04:18:00] arup_r: has joined #RubyOnRails
[04:18:06] rickmasta: has joined #RubyOnRails
[04:20:18] hahuang65: has joined #RubyOnRails
[04:23:19] rickmasta: has joined #RubyOnRails
[04:23:40] tyl: has joined #RubyOnRails
[04:26:08] givanse: has joined #RubyOnRails
[04:30:27] tyl: has joined #RubyOnRails
[04:34:17] jottr: has joined #RubyOnRails
[04:35:05] raboid: has joined #RubyOnRails
[04:36:53] Sylario: has joined #RubyOnRails
[04:40:22] SteenJobs: sevenseacat: you???re never here on weekends!
[04:41:14] CheckYourSix: has joined #RubyOnRails
[04:41:37] johnMcLain: has joined #RubyOnRails
[04:42:09] SteenJobs: sevenseacat: is the ! part of the face?
[04:43:19] SteenJobs: haha wasn???t sure
[04:43:35] workmad3: has joined #RubyOnRails
[04:45:47] Maletor: has joined #RubyOnRails
[04:46:25] eggoez: has joined #RubyOnRails
[04:46:30] SteenJobs: i actually have a q, but you???re not gonna be very happy about it ha
[04:50:41] Lytol: has joined #RubyOnRails
[04:51:07] Rubie: has joined #RubyOnRails
[04:52:14] ellisTAA: i???m trying to wrap my head around what the files in the bin folder are doing, can someone help me do that, i???ve pasted the code that is int hose files here: https://gist.github.com/ellismarte/9a57fb5438bff563d1fe
[04:53:04] ellisTAA: i???m adding comments to the files that are my guesses on what they do
[04:55:14] SteenJobs: sevenseacat: so here???s the deal, i ideally would like to call controller B???s action from controller A, but i know that???s very very anti-rails, so was hoping maybe you could help me come up with a workaround that???s more rails in style.
[04:55:40] sevenseacat: definitely not a good thing to do. why do you want to call the other action?
[04:57:37] lxsameer: has joined #RubyOnRails
[04:58:21] SteenJobs: sevenseacat: bbak in a sec
[05:00:24] hahuang65: has joined #RubyOnRails
[05:01:42] existensil: has joined #RubyOnRails
[05:03:05] shifty_lemur: has joined #RubyOnRails
[05:04:09] SteenJobs: has joined #RubyOnRails
[05:05:02] iamse7en: has joined #RubyOnRails
[05:05:30] doodlehaus: has joined #RubyOnRails
[05:06:07] bratsche: has joined #RubyOnRails
[05:06:09] riotjones: has joined #RubyOnRails
[05:07:38] badmadrad: has joined #RubyOnRails
[05:07:53] maodun: has joined #RubyOnRails
[05:07:57] rickmasta: has joined #RubyOnRails
[05:08:50] maodun: I have a bunch of models I want to update together, where I either update all or none, but an update_all won't cut it because the updates to each model are different. What's the right way to tackle this?
[05:11:31] ElSif: wrap it in a ActiveRecord Transaction :D
[05:11:47] ElSif: http://api.rubyonrails.org/classes/ActiveRecord/Transactions/ClassMethods.html
[05:12:19] DoctorMonocular: has joined #RubyOnRails
[05:12:54] armyriad: has joined #RubyOnRails
[05:13:49] Babelfish: has joined #RubyOnRails
[05:14:18] maodun: thanks ElSif
[05:15:12] rickmasta: has joined #RubyOnRails
[05:22:15] existensil: has joined #RubyOnRails
[05:23:44] rickmasta: has joined #RubyOnRails
[05:25:04] tuelz: has joined #RubyOnRails
[05:26:03] lala: has joined #RubyOnRails
[05:26:07] hahuang65: has joined #RubyOnRails
[05:26:39] rickmasta: has joined #RubyOnRails
[05:32:55] ellisTAA: has joined #RubyOnRails
[05:34:47] Hoeveer: has joined #RubyOnRails
[05:35:09] Hoeveer: has left #RubyOnRails: ()
[05:35:14] shifty_lemur: has joined #RubyOnRails
[05:36:59] ellisTAA: has joined #RubyOnRails
[05:37:10] shanson: has joined #RubyOnRails
[05:39:38] lethjakman: has joined #RubyOnRails
[05:40:36] yardenbar: has joined #RubyOnRails
[05:44:17] rickmasta: has joined #RubyOnRails
[05:44:48] baweaver: has joined #RubyOnRails
[05:46:12] ephantmon: has joined #RubyOnRails
[05:46:43] kahuna_: has joined #RubyOnRails
[05:49:32] SteenJobs: sevenseacat: back. sorry about that.
[05:50:10] RegulationD: has joined #RubyOnRails
[05:50:20] djbkd: has joined #RubyOnRails
[05:50:44] SteenJobs: sevenseacat: so here???s the deal, i have my frontend making a post request to my rails backend, which makes an api call to Stripe to process a payment. I have my charges controller handling that logic. However, i only want a new ???cleaning job??? to be created upon a successful charge, so the original plan would???ve been to redirect from the charges create action to the job create action.
[05:52:14] sevenseacat: that doesnt make a lot of sense
[05:52:44] sevenseacat: ideally you would have a job creation service object that you would use in both actions - job create and charges create
[05:52:46] ss_much: has joined #RubyOnRails
[05:56:36] SteenJobs: sevenseacat: not sure i totally understand that
[05:57:21] SteenJobs: sevenseacat: never used service objects, this could be a cool opportunity to learn something new
[05:57:36] sevenseacat: http://blog.codeclimate.com/blog/2012/10/17/7-ways-to-decompose-fat-activerecord-models/ see #2
[05:57:45] SteenJobs: sevenseacat: well i???ve used services in angular if that???s similar at all.
[05:58:47] SteenJobs: sevenseacat: oh cool, so it???s just a way to create a piece of reusable code?
[05:59:16] SteenJobs: sevenseacat: so i assume the service i???d be creating is for the charge, and then call the class and its associated methods within the jobs controller?
[05:59:47] antlong: has joined #RubyOnRails
[05:59:50] sevenseacat: thats the opposite of what you originally said i think
[06:00:05] hahuang65: has joined #RubyOnRails
[06:00:06] sevenseacat: you said you want to create a job when you create a charge, not the other way arouns
[06:00:15] SteenJobs: sevenseacat: create charge => success => create job
[06:00:36] sevenseacat: so no, you dont create a service for the charge because you're only creating it in one place
[06:00:44] sevenseacat: its the job logic you want to reuse
[06:01:10] SteenJobs: sevenseacat: ah gotcha. so place all the job logic into a service, and call that service both in the charges controller and the jobs controller. cool stuff.
[06:01:18] SteenJobs: great link also
[06:01:22] SteenJobs: well done as always
[06:02:17] SteenJobs: i thought having to work with non-rails things would be nice and interesting, but every time i have to implement something i can???t help but think ???if only this was in rails???"
[06:03:07] rails114: has joined #RubyOnRails
[06:03:17] SteenJobs: sevenseacat: ohhh here???s a good q. if i???m sending ???head :ok??? back to my frontend, is there a way to configure what objects exactly rails is sending to the frontend? right now it???s forwarding the entire callback it receives from stripe, and i???d like to minimize the transfer of sensitive information.
[06:03:47] sevenseacat: well head :ok is an empty response with a ok status, no objects at all
[06:04:16] safeforge: has joined #RubyOnRails
[06:04:58] SteenJobs: sevenseacat: that???s what i thought too, but angular seems to be receiving a pretty hefty object. maybe it???s coming directly from stripe???i thought it was being routed through my server.
[06:05:35] SteenJobs: sevenseacat: aright cool. that def helps me narrow it down. thanks!
[06:05:44] sevenseacat: web console should be able to help out with what requests are returning what
[06:06:41] SteenJobs: sevenseacat: right i tried sifting through its contents and was so incredibly lost.
[06:06:53] riotjones: has joined #RubyOnRails
[06:07:25] SteenJobs: sevenseacat: gonna give it another try later. jsut realized though that i???m actually gonna create a service for the charge, it???ll be super useful to allow interacting with stripe in multiple locations (saving a CC separately from making a payment, etc.)
[06:07:44] SteenJobs: sevenseacat: and found a great blog post about using services for things like stripe in particular, so thanks for that direction. game changer.
[06:12:33] elia: has joined #RubyOnRails
[06:13:59] guest85554: has joined #RubyOnRails
[06:14:41] czerasz: has joined #RubyOnRails
[06:15:44] zemmihates: has joined #RubyOnRails
[06:16:03] Guest93100: has joined #RubyOnRails
[06:17:56] lethjakman: has joined #RubyOnRails
[06:20:43] Olumayowa: has joined #RubyOnRails
[06:25:10] Mendenhall: has joined #RubyOnRails
[06:26:20] aldto: has joined #RubyOnRails
[06:27:49] hahuang65: has joined #RubyOnRails
[06:29:33] aldto: has left #RubyOnRails: ()
[06:31:45] ellisTAA: has joined #RubyOnRails
[06:32:22] workmad3: has joined #RubyOnRails
[06:33:54] Pazician_: has joined #RubyOnRails
[06:34:02] elia: has joined #RubyOnRails
[06:35:00] jottr: has joined #RubyOnRails
[06:37:04] heidar: has joined #RubyOnRails
[06:37:13] aldto: has joined #RubyOnRails
[06:38:24] hahuang65: has joined #RubyOnRails
[06:40:55] Pazician_: has joined #RubyOnRails
[06:41:05] safeforge: has joined #RubyOnRails
[06:47:46] dans: has joined #RubyOnRails
[06:50:48] Maletor: has joined #RubyOnRails
[06:51:48] SteenJobs: sevenseacat: hate to have to come back, but my jobs controller isn???t recognizing CreditCardService.new, and it???s giving me NameError (uninitialized constant Api::JobsController::CreditCardService). i???ll gist the code.
[06:52:54] sevenseacat: probably just the filename not matching the class name, or not restarting your server after creating the services folder
[06:54:26] SteenJobs: sevenseacat: the latter is most def the answer. thank you madame.
[06:55:02] sevenseacat: the autoload paths of the app is set up at server start, so wanting to add a new folder to it means restarting server
[06:55:25] SteenJobs: sevenseacat: right. you get so focused on the complicated things you tend to forget the most simple of issues.
[06:55:50] sevenseacat: can happen sometimes, yeah
[06:56:02] SteenJobs: sevenseacat: any idea if i can do something like rescue Stripe::CardError => e within my service, since it???s not part of ActiveModel?
[06:56:22] sevenseacat: I'm not sure what ActiveModel has to do with rescuing an exception
[06:56:53] SteenJobs: sevenseacat: read somewhere that without inheriting from ActiveModel it won???t work. guess not!
[06:57:09] SteenJobs: sevenseacat: most likely misunderstood
[06:59:04] DoctorMonocular: has joined #RubyOnRails
[06:59:24] baweaver: has joined #RubyOnRails
[07:02:09] yfeldblum: has joined #RubyOnRails
[07:04:36] sarink: has joined #RubyOnRails
[07:04:37] l0oky: has joined #RubyOnRails
[07:04:59] yfeldblum: has joined #RubyOnRails
[07:06:25] doodlehaus: has joined #RubyOnRails
[07:07:28] hahuang65: has joined #RubyOnRails
[07:07:32] SteenJobs: sevenseacat: last Q and then i???m done haha. i???m getting an unpermitted params error because the frontend is sending through stripe params, which aren???t permitted params for creating a ???job???. i can hack around it by just adding them to permitted params, but that doesn???t feel right. how do i tell rails to ignore params that aren???t pertinent to creating a ???job????
[07:07:55] sevenseacat: why is the frontend sending the wrong params?
[07:08:35] yfeldblum: has joined #RubyOnRails
[07:09:27] SteenJobs: sevenseacat: it???s not, i think what???s happening is since it???s sending its params to the jobs create action, the jobs controller is mistaking those params as unpermitted, even though they have nothing to do with the jobs objects.
[07:10:18] sevenseacat: the jobs controller isnt mistaking anything, it expects a set of params, and you're passing in some other unrelated params for unknown reason
[07:10:44] GriffinHeart: has joined #RubyOnRails
[07:10:49] SteenJobs: sevenseacat: i need to pass the stripe params to the jobs create action, so the charge can be put through and then if it???s complete, it should create a job object.
[07:11:02] SteenJobs: sevenseacat: unless i???m doing that totally wrong
[07:11:09] SteenJobs: sevenseacat: lemme gist you my code so you don???t need to guess
[07:11:14] sevenseacat: ok so why are you passing those stripe params through to your model?
[07:11:24] sevenseacat: if theyre not needed there
[07:11:38] SteenJobs: sevenseacat: that???s the thing???i???m not. which is why i???m confused.
[07:13:05] SteenJobs: sevenseacat: https://gist.github.com/SteenJobs/98d120846370a3d890e2
[07:14:07] rickmasta: has joined #RubyOnRails
[07:15:26] rickmasta: has joined #RubyOnRails
[07:15:53] benhuda: has joined #RubyOnRails
[07:16:03] sevenseacat: right, so you have params coming in in some weird format
[07:16:18] sevenseacat: so in this case, strong params probably isnt what you want
[07:16:28] sevenseacat: especially multiple permit calls like that
[07:16:57] SteenJobs: sevenseacat: oh interesting. so that stuff isn???t my code.
[07:17:07] SteenJobs: i inherited this project with the sole purpose of implementing stripe
[07:17:11] SteenJobs: totally meant to mention that.
[07:17:15] sevenseacat: great. go ask whoever wrote it then.
[07:17:26] SteenJobs: the guy???s an idiot, he won???t be able to help
[07:17:37] SteenJobs: like he won???t know how to fix what he did to work with what i???m trying to add
[07:17:44] kitsuneyo: has joined #RubyOnRails
[07:17:58] darutoko: has joined #RubyOnRails
[07:17:58] sevenseacat: well I can tell that from the code
[07:18:10] elia: has joined #RubyOnRails
[07:18:25] SteenJobs: i???d love to understand more about what???s wrong/bad about it though
[07:19:43] slydrive: has joined #RubyOnRails
[07:20:04] SteenJobs: sevenseacat: and why my code wouldn???t be able to work with it
[07:20:14] sevenseacat: well, there's 21 different render calls in it
[07:20:36] sevenseacat: for seven actions, some of which arent restful
[07:21:10] SteenJobs: sevenseacat: yea that part i was able to pick up on
[07:21:39] eGGsha: has joined #RubyOnRails
[07:21:53] SteenJobs: sevenseacat: like make a rating controller. it was weird for me to read because i???m used to restful rails, i think this guy is mostly an angular programmer.
[07:22:10] SteenJobs: sevenseacat: but even his angular code really doesn???t follow best practice. seems like he does similar stuff.
[07:22:23] stardiviner: has joined #RubyOnRails
[07:22:27] sevenseacat: from what I've heard, angular doesnt have best practices, it has bad and worse practices
[07:22:50] SteenJobs: ha yea it kind???ve feels that way
[07:23:28] SteenJobs: which is frustrating. iOS is also annoying because there???s very little out there about best practices.
[07:23:35] SteenJobs: no one seems to know
[07:24:17] fgo: has joined #RubyOnRails
[07:25:02] nobitanobi: has joined #RubyOnRails
[07:25:31] dlousy: has joined #RubyOnRails
[07:26:03] tuelz: has joined #RubyOnRails
[07:26:28] tvw: has joined #RubyOnRails
[07:27:55] PhantomSpank: has joined #RubyOnRails
[07:28:35] SteenJobs: sevenseacat: i don???t even know where ???job => {}??? is coming from. thanks for the help, i???ll try and ask the guy. but why wouldn???t my code be able to work around it?
[07:28:50] sevenseacat: i have no idea what 'your code' us
[07:28:57] sevenseacat: seeing as you said you didnt write that code
[07:29:55] srinidhi: has joined #RubyOnRails
[07:29:57] SteenJobs: sevenseacat: i wrote all the stripe related stuff???the whole service and its implementation in the jobs controller.
[07:30:14] sevenseacat: then your code seems unrelated to the problem
[07:30:21] safeforge: has joined #RubyOnRails
[07:31:18] SteenJobs: sevenseacat: haha right, that???s why i was confused! his code was working fine, as messy as it is. but for some reason it???s passing in the stripe params (for the credit_card_service) to something that???s flagging it as unpermitted params.
[07:31:55] ElSif: has joined #RubyOnRails
[07:32:16] sevenseacat: https://gist.github.com/SteenJobs/98d120846370a3d890e2#file-controller-rb-L30 ?
[07:32:35] hahuang65: has joined #RubyOnRails
[07:32:58] Gabriel403: has joined #RubyOnRails
[07:33:02] GriffinHeart: has joined #RubyOnRails
[07:33:20] SteenJobs: sevenseacat: right. so i guess my original question, how do i separate the params for the charge creation from the params for the job creation?
[07:33:30] SteenJobs: sevenseacat: or should i just add the charge params to permitted params
[07:33:44] sevenseacat: honestly, I dont see what you're looking at as a problem
[07:33:59] SteenJobs: i???m getting that error when i try to create a charge
[07:34:01] sevenseacat: no, you shouldnt, because you dont want to permit them
[07:34:05] sevenseacat: its not an error, its a warning
[07:34:21] sevenseacat: the error is here https://gist.github.com/SteenJobs/98d120846370a3d890e2#file-error-L10-L11
[07:35:17] SteenJobs: sevenseacat: oh
[07:35:28] SteenJobs: but that???s weird because his code was working fine before i touched it
[07:35:41] SteenJobs: sorry, even my earlier implementation was working
[07:36:00] SteenJobs: sevenseacat it was when i abstracted the charge logic into a service that i hit this error for the first time
[07:37:29] sevenseacat: well, Time.zone.local(0,0,0,0,0,0) isnt a valid time, hence argument error
[07:38:08] sevenseacat: why are all your date-related params not present? thats for you to figure out
[07:38:33] SteenJobs: sevenseacat: that???s crazy that you can answer the question without having any idea what else is going on. i think i got it, one sec, lemme check.
[07:38:43] Lytol: has joined #RubyOnRails
[07:38:52] sevenseacat: its just from reading the error and the line of code that it points to :/
[07:40:32] SteenJobs: damn still didn???t work.
[07:41:16] SteenJobs: sevenseacat: i thought maybe because the date and time weren???t selected when i submitted the payment, because they didn???t need to be in the past, i guess because the payment had nothing to do with creating jobs at that point.
[07:41:58] SteenJobs: sevenseacat: however, now that they???re controller logic is linked, perhaps when i send the charge payment, the code executes the charge controller logic which then calls the job controller logic, when really there were no jobs params.
[07:43:34] Mendenhall: has joined #RubyOnRails
[07:46:33] krz: has joined #RubyOnRails
[07:49:30] hahuang65: has joined #RubyOnRails
[07:54:53] stardiviner: has joined #RubyOnRails
[07:57:01] duncannz: has joined #RubyOnRails
[07:57:53] duncannz: has joined #RubyOnRails
[07:58:05] hahuang65: has joined #RubyOnRails
[07:58:43] duncannz: has joined #RubyOnRails
[07:59:34] duncannz: has joined #RubyOnRails
[08:00:30] duncannz: has joined #RubyOnRails
[08:03:13] chiru: has joined #RubyOnRails
[08:05:59] zpe: has joined #RubyOnRails
[08:09:04] Lytol: has joined #RubyOnRails
[08:11:31] hahuang65: has joined #RubyOnRails
[08:13:36] eGGsha: has joined #RubyOnRails
[08:14:00] kham: has joined #RubyOnRails
[08:16:50] sarink: has joined #RubyOnRails
[08:18:36] Peteykun: has joined #RubyOnRails
[08:18:39] Peteykun: has left #RubyOnRails: ()
[08:19:06] GarethAdams: has joined #RubyOnRails
[08:21:15] workmad3: has joined #RubyOnRails
[08:21:45] sinkensabe: has joined #RubyOnRails
[08:25:26] kham: has joined #RubyOnRails
[08:26:22] eGGsha: has joined #RubyOnRails
[08:26:49] fgo: has joined #RubyOnRails
[08:27:19] Rubie: has joined #RubyOnRails
[08:28:41] hahuang65: has joined #RubyOnRails
[08:32:15] xkickflip: has joined #RubyOnRails
[08:33:57] Trynemjoel: has joined #RubyOnRails
[08:36:27] Tinyyy: has joined #RubyOnRails
[08:37:19] SteenJobs: has joined #RubyOnRails
[08:39:03] yaw: has joined #RubyOnRails
[08:40:05] Sylario: has joined #RubyOnRails
[08:41:25] TomasAchmedovas: has joined #RubyOnRails
[08:43:03] PhantomSpank: has joined #RubyOnRails
[08:44:28] GriffinHeart: has joined #RubyOnRails
[08:47:59] Tinyyy: Hey guys I have a question - I???m building a Rails App and I want to be able to dynamically schedule cron jobs for scripts in /lib. I???m going to be running at least 10 scripts/second, the scripts have to be run in parallel and I have to start/cancel jobs. I need the rails environment too. How should I best do this?
[08:53:19] tyl: has joined #RubyOnRails
[08:56:47] blackmes1: has joined #RubyOnRails
[08:57:29] Trynemjoel: has joined #RubyOnRails
[08:59:41] hahuang65: has joined #RubyOnRails
[09:00:24] IanV0rn2341: has joined #RubyOnRails
[09:00:25] hololeap: has joined #RubyOnRails
[09:02:59] Trynemjoel: has joined #RubyOnRails
[09:07:05] antgel: has joined #RubyOnRails
[09:07:17] doodlehaus: has joined #RubyOnRails
[09:08:12] eGGsha: has joined #RubyOnRails
[09:08:24] comm64x: has joined #RubyOnRails
[09:09:58] Lytol: has joined #RubyOnRails
[09:10:32] comm64x: I'm trying to run bundle install and bundle gets to the point of installing capybara-webkit when I get the Bundler cannot continue error. I've run gem install capybara-webkit as the error instructed and everything seemed to install fine but bundle install still errors out when trying to install capybara-webkit. Any ideas of how to get around this.
[09:10:59] TomasAchmedovas: has joined #RubyOnRails
[09:11:06] hahuang65: has joined #RubyOnRails
[09:11:24] sevenseacat: comm64x: without seeing the error? no
[09:11:41] comm64x: ok I'll pastebin it
[09:11:46] helpa: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[09:11:56] sevenseacat: not pastebin, thanks.
[09:13:01] comm64x: https://gist.github.com/anonymous/cbede1218328ba7db6ce
[09:13:30] blackmesa: has joined #RubyOnRails
[09:16:56] bronson: has joined #RubyOnRails
[09:18:34] comm64x: I see it says that qmake isn't available...the only qmake I have is qmake-qt4 and 5
[09:20:32] bmalum: has joined #RubyOnRails
[09:21:32] zpe: has joined #RubyOnRails
[09:23:06] stamina: has joined #RubyOnRails
[09:25:26] sevenseacat: ok, so you're missing some dependencies
[09:25:57] comm64x: I think I have it...capybara-webkit requires the qtwebkit but Fedora (which I'm using) calls qmake qmake-qt4
[09:26:39] comm64x: I added an environment variable to my bashrc now I'm trying to gem install capybara-webkit and it seems to be working
[09:26:47] tuelz: has joined #RubyOnRails
[09:27:24] kham: has joined #RubyOnRails
[09:28:07] comm64x: hey it worked! lol
[09:30:24] comm64x: This happens to me all the time, well most of the time. I'll have a problem, exhaust my usual sources, come to the IRC channel, and then everything seems to work fine lol
[09:34:44] comm64x: I think it's a conspiracy lol jk
[09:36:35] jottr: has joined #RubyOnRails
[09:37:31] hahuang65: has joined #RubyOnRails
[09:38:14] marr: has joined #RubyOnRails
[09:39:23] cornerma1: has joined #RubyOnRails
[09:42:02] l0oky: has joined #RubyOnRails
[09:44:13] Tinyyy: has joined #RubyOnRails
[09:46:35] wabisuke: has joined #RubyOnRails
[09:47:36] DEA7TH: has joined #RubyOnRails
[09:48:38] Tinyyy: Hey is is possible to setup a cronjob that doesn't need to start the environment every time the script is called?
[09:49:00] pwnd_nfsw|2: has joined #RubyOnRails
[09:51:14] wabisuke: has left #RubyOnRails: ()
[09:51:48] RegulationD: has joined #RubyOnRails
[09:54:17] fgo: has joined #RubyOnRails
[09:54:30] tbuehlmann: Tinyyy, I assume you are starting a rake task?
[09:55:15] Tinyyy: I'm using 'rails r test.rb', so that I can use ActiveRecord
[09:55:48] tbuehlmann: if you want to use AR, you need to require the environment
[09:55:53] hahuang65: has joined #RubyOnRails
[09:56:00] Tinyyy: Yea but is there a way to only require it once
[09:56:04] Tinyyy: not for every single script
[09:56:17] Kilo`byte: has joined #RubyOnRails
[09:56:21] tbuehlmann: I don't know what you mean
[09:56:24] Tinyyy: because I'll be running a ton of scripts
[09:56:57] wabisuke: has joined #RubyOnRails
[09:57:45] roolo_: has joined #RubyOnRails
[09:58:18] wabisuke: i have probleam, im newbie to rails and i create my project this way http://pastebin.com/tK1zwL61 and i get this error http://ibin.co/29wjplLzHTyb how can i solve my problem?
[09:59:14] shpoont: has joined #RubyOnRails
[09:59:15] wabisuke: sorry i'm newbie and i can't speak EN very will but i can understand
[10:00:20] Tinyyy: tbuehlmann I mean for example I want to loop a function, I could while true ... , or if I want a delay, I can run the function then sleep(5), but to start the script at a set time, my situation is that I have to start it at a predefined time - so I run a cronjob to start it. But then if I use the cronjob to run a script.rb, I will have to load the environment every single time. Is there a way to avoid that?
[10:03:36] tbuehlmann: Tinyyy, not with that setup
[10:03:46] Tinyyy: then how? D:
[10:04:10] tbuehlmann: you could have a single process running the rails environment and communicate with it somehow (IPC, with a database, ???)
[10:04:25] tvw: has joined #RubyOnRails
[10:05:04] Tinyyy: that sounds complicated as duck
[10:06:09] tbuehlmann: you could also have a background worker running (like sidekiq, resque, delayedjob, ???) and queue tasks that will be worked off by the worker. but that probably involves queuing a job with the rails environment loaded again
[10:06:38] arup_r: has joined #RubyOnRails
[10:09:48] workmad3: has joined #RubyOnRails
[10:09:56] arBmind: has joined #RubyOnRails
[10:11:03] Trynemjoel: has joined #RubyOnRails
[10:12:56] bonhoeffer: has joined #RubyOnRails
[10:13:54] hahuang65: has joined #RubyOnRails
[10:16:18] jsrn_: has joined #RubyOnRails
[10:21:03] tyl: has joined #RubyOnRails
[10:21:59] blackmesa: has joined #RubyOnRails
[10:23:20] Pazician: has joined #RubyOnRails
[10:23:50] blackmes1: has joined #RubyOnRails
[10:26:18] drale2k: has joined #RubyOnRails
[10:26:50] tyl: has joined #RubyOnRails
[10:27:33] tuelz: has joined #RubyOnRails
[10:28:27] FernandoBasso: has joined #RubyOnRails
[10:28:39] cac: has joined #RubyOnRails
[10:34:19] blackmes1: has joined #RubyOnRails
[10:34:35] Trynemjoel: has joined #RubyOnRails
[10:36:15] hahuang65: has joined #RubyOnRails
[10:38:43] fgo: has joined #RubyOnRails
[10:41:12] FernandoBasso: has joined #RubyOnRails
[10:42:10] quazimodo: has joined #RubyOnRails
[10:43:22] mhib: has joined #RubyOnRails
[10:47:00] kham: has joined #RubyOnRails
[10:48:24] Papierkorb: has joined #RubyOnRails
[10:49:19] iateadonut: has joined #RubyOnRails
[10:49:40] yaw: has joined #RubyOnRails
[10:49:54] Marquel: has joined #RubyOnRails
[10:50:10] zpe: has joined #RubyOnRails
[10:50:12] jottr: has joined #RubyOnRails
[10:50:36] Trynemjoel: has joined #RubyOnRails
[10:53:14] mostlybadfly: has joined #RubyOnRails
[10:53:46] hahuang65: has joined #RubyOnRails
[10:54:38] cac: has joined #RubyOnRails
[10:56:17] Silent__: has joined #RubyOnRails
[10:56:41] helpa: has joined #RubyOnRails
[10:56:49] tenderlo_: has joined #RubyOnRails
[10:56:51] vale_tudo: has joined #RubyOnRails
[10:56:55] seank_: has joined #RubyOnRails
[10:57:36] fcser_: has joined #RubyOnRails
[10:57:45] DoctorMonocular: has joined #RubyOnRails
[10:58:04] Lytol: has joined #RubyOnRails
[10:58:05] AckZ_: has joined #RubyOnRails
[10:58:06] neilfse__: has joined #RubyOnRails
[10:58:12] DoctorMonocular: has joined #RubyOnRails
[10:58:15] shwoodard_: has joined #RubyOnRails
[10:58:25] cornerman: has joined #RubyOnRails
[10:58:30] MiracleBlue_: has joined #RubyOnRails
[10:58:44] nickfausnight_: has joined #RubyOnRails
[10:58:54] nightsh_: has joined #RubyOnRails
[10:59:06] maZtah_: has joined #RubyOnRails
[10:59:08] kapowaz_: has joined #RubyOnRails
[10:59:15] Iacobus_: has joined #RubyOnRails
[10:59:35] aeffle: has joined #RubyOnRails
[11:00:35] codelahoma_: has joined #RubyOnRails
[11:00:46] Wobni: has joined #RubyOnRails
[11:00:56] fryguy9: has joined #RubyOnRails
[11:00:56] lathiat_: has joined #RubyOnRails
[11:00:57] many_: has joined #RubyOnRails
[11:01:05] thang_: has joined #RubyOnRails
[11:01:28] brandon: has joined #RubyOnRails
[11:01:29] bmalum: has joined #RubyOnRails
[11:02:46] cornerman: has joined #RubyOnRails
[11:03:13] hahuang65: has joined #RubyOnRails
[11:03:53] ktchup: has joined #RubyOnRails
[11:04:00] alex88_: has joined #RubyOnRails
[11:04:14] dr_Poggs: has joined #RubyOnRails
[11:04:18] dfoolz_: has joined #RubyOnRails
[11:04:23] synfinatic_: has joined #RubyOnRails
[11:04:26] constantinexvi: has joined #RubyOnRails
[11:04:27] Bearie: has joined #RubyOnRails
[11:04:32] herenow: has joined #RubyOnRails
[11:04:37] Trynemjoel2: has joined #RubyOnRails
[11:04:39] mhf^: has joined #RubyOnRails
[11:04:43] lele`: has joined #RubyOnRails
[11:04:46] Emily_: has joined #RubyOnRails
[11:04:48] elektronaut_: has joined #RubyOnRails
[11:04:51] riotjones: has joined #RubyOnRails
[11:04:58] blackmes1: has joined #RubyOnRails
[11:04:58] Matadoer_: has joined #RubyOnRails
[11:05:08] jonee: has joined #RubyOnRails
[11:06:28] dustinm`: has joined #RubyOnRails
[11:07:32] cgrieger^away: has joined #RubyOnRails
[11:08:02] x3cion: has joined #RubyOnRails
[11:08:02] amitchellbullard: has joined #RubyOnRails
[11:08:05] kiki_lamb: has joined #RubyOnRails
[11:08:08] doodlehaus: has joined #RubyOnRails
[11:08:13] noodman: has joined #RubyOnRails
[11:11:36] bmalum: has joined #RubyOnRails
[11:11:44] defswork: has joined #RubyOnRails
[11:11:46] sinkensabe: has joined #RubyOnRails
[11:12:23] Megatomte: has joined #RubyOnRails
[11:12:39] Rylee: has joined #RubyOnRails
[11:12:40] ciree: has joined #RubyOnRails
[11:13:18] michael_mbp: has joined #RubyOnRails
[11:13:19] danlucraft: has joined #RubyOnRails
[11:13:34] machty: has joined #RubyOnRails
[11:14:21] mdel: has joined #RubyOnRails
[11:14:29] Tinyyy: has joined #RubyOnRails
[11:15:42] zemmihates: has joined #RubyOnRails
[11:16:02] jlpeters: has joined #RubyOnRails
[11:16:16] chancancode: has joined #RubyOnRails
[11:16:48] Tinyyy: For a basic project with ~5 models, how much is the cost to load up Rails environment?
[11:19:19] cornerman: has joined #RubyOnRails
[11:19:40] nfk: has joined #RubyOnRails
[11:19:48] wethu: has joined #RubyOnRails
[11:20:53] soahccc: has joined #RubyOnRails
[11:20:53] Papierkorb: What's a "basic project"? What "cost"?
[11:21:06] JonasOSDever: has joined #RubyOnRails
[11:22:47] bruno-: has joined #RubyOnRails
[11:23:22] vedu: has joined #RubyOnRails
[11:23:26] phrozen77: has joined #RubyOnRails
[11:24:23] kham: has joined #RubyOnRails
[11:24:35] differentreality: has joined #RubyOnRails
[11:25:38] Trynemjoel: has joined #RubyOnRails
[11:26:09] Tinyyy: papierkorb, a basic project where theres ~5 models? Not too complicated. but I will have >10 cronjobs running / sec, so loading up the environment >10 times / second. Whats the performance cost of that?
[11:26:23] Papierkorb: what's "performance"?
[11:27:03] Papierkorb: Without knowing exactly what everything does line by line it's impossible to estimate.
[11:27:46] Papierkorb: But loading it up >10 times/second sounds like a bad idea. Rails usually takes slightly over a second to boot up.
[11:28:12] bruno-: has joined #RubyOnRails
[11:28:18] tuelz: has joined #RubyOnRails
[11:28:59] bauruine: has joined #RubyOnRails
[11:30:00] hahuang65: has joined #RubyOnRails
[11:36:10] FernandoBasso: has joined #RubyOnRails
[11:38:28] boxmein: has joined #RubyOnRails
[11:38:41] boxmein: has left #RubyOnRails: ()
[11:42:09] Trynemjoel: has joined #RubyOnRails
[11:44:53] ArchRogem: has joined #RubyOnRails
[11:45:40] sonOfRa: has joined #RubyOnRails
[11:46:02] chrissonar: has joined #RubyOnRails
[11:46:32] Lightsword: has joined #RubyOnRails
[11:47:18] AzaToth: has joined #RubyOnRails
[11:48:42] naftilos76: has joined #RubyOnRails
[11:49:18] Ropeney: has joined #RubyOnRails
[11:49:40] Trynemjoel: has joined #RubyOnRails
[11:49:45] Tinyyy: Papierkorb the cronjob calls an online API and uses ActiveRecord to store the response into a database. Sorry for not replying earlier. Is there a way to schedule it but not have to boot up rails environment?
[11:51:38] jhass: Tinyyy: just write a never ending loop (that measures the start time, end time and sleeps for the rest of the second) and run it under a supervisor (systemd, daemontools, god, monit, eye, ...)
[11:52:15] naftilos76_: has joined #RubyOnRails
[11:53:52] Tinyyy: jhass thanks for the response - I've never used any of those before and I'll try to figure out I guess
[11:54:53] shpoont: has joined #RubyOnRails
[11:55:33] Tinyyy: jhass by the way, is my method even sane? suppose I have 1000 scripts that I have to run in a 5 minute interval. Can I start all of them every 5 minutes, then sleep most of them for a certain amount of time to spread them out?
[11:56:46] Papierkorb: Tinyyy: why note have an array like a job queue and then call each of those entries?
[11:57:00] fgo: has joined #RubyOnRails
[11:57:10] Trynemjoel: has joined #RubyOnRails
[11:57:14] Tinyyy: I need to ensure that everything is called every 5 minutes, and each call takes ~1 second to respond
[11:57:40] Tinyyy: if I structure it as a linear queue, I don't think it'll finish
[11:57:55] zpe: has joined #RubyOnRails
[11:57:56] Papierkorb: that'd take some 16minutes for a single run ..
[11:58:14] Tinyyy: but if I make the calls together or something it will be faster, will it?
[11:58:41] workmad3: has joined #RubyOnRails
[11:58:54] Papierkorb: You could push a job into sidekiq for each, which will run them in parallel
[11:59:00] Tinyyy: By the way, jhass, what is a supervisor supposed to do?
[11:59:34] Papierkorb: Tinyyy: A supervisor takes care of managing the process, e.g. it makes sure (if wanted) to restart the app if it were to crash
[12:00:07] jhass: ^ also if it's http requests check typhoeus hydra for high performance
[12:00:46] Tinyyy: thanks :)
[12:00:51] tyl: has joined #RubyOnRails
[12:02:07] Tinyyy: I have a (potential) problem that I want to spread out all the calls to API over the entire 5 minutes, yet I want to make sure that everything is finished
[12:02:19] krz: has joined #RubyOnRails
[12:02:43] Tinyyy: the way I plan to solve it is that given interval t, I'll call it at time 0, t/2, t/4, 3/4t, 1/8t, 3/8t, 5/8t, 7/8t, etc
[12:02:56] Papierkorb: Tinyyy: decide what's more important. Always being under 5 minutes (and thus use short itmeouts to kill requests taking too long), or finishing everything but risking going over that time
[12:03:06] Tinyyy: that way I can increase and decrease the number of things called but ensuring they all finish
[12:03:11] Tinyyy: yet still spreading them out kinda evenly
[12:03:17] Tinyyy: is there a way I can keep that?
[12:03:30] Rubie: has joined #RubyOnRails
[12:04:39] gavit: I am trying t program for a repairshop. They get an item that needs to be repaired and goes through a sort of state machine. received -> repaired -> picked up. How would the second model look like assuming the first would be receipt(id, customer_name, item_description)
[12:06:04] hahuang65: has joined #RubyOnRails
[12:07:02] pcpanic: gavit: im a noob, so take my advise with double caution, I would have a Status model with receipt_id, status_id
[12:07:11] Trynemjoel: has joined #RubyOnRails
[12:07:51] jhass: Tinyyy: not with typhoeus, but using a long running loop under a supervisor should make it even easier
[12:08:05] pcpanic: gavit: with another model Status with just an id and name where name would have received,repaired,picked up
[12:09:09] ktchup: has joined #RubyOnRails
[12:09:48] Tinyyy: I'm really unfamiliar with supervisors, so pardon my stupid question, but what exactly is a supervisor and what language is it written in
[12:09:48] michael_mbp: has joined #RubyOnRails
[12:10:38] bonhoeffer: has joined #RubyOnRails
[12:14:10] gavit: pcpanic: I take all advise with caution, but if you don't mind I want to critisize your idea
[12:14:15] jonee: has joined #RubyOnRails
[12:14:31] pcpanic: gavit: please do :)
[12:14:33] Tinyyy: Hm jhass is there a way to set a delay between requests in typhoeus? Then I can just precompute the delay and spread it evenly
[12:14:53] gavit: pcpanic: I was thaught at the university that there is a difference between data and information: data stays the same over time, while information is 'computable'
[12:14:59] jhass: Tinyyy: maybe but I'm not aware of any
[12:15:16] gavit: pcpanic: in this case your status changes, so you shouldn't store the status, but compute it
[12:16:21] pcpanic: gavit: so instead of storing status names, you would want to store status codes ? E.g. 0,1 and 2 ?
[12:16:26] jhass: Tinyyy: supervisors are written in whatever language (I gave you a bunch of examples, just look them up), they just start your process, watch if it crashes and do some action you configure (like restarting it) on that. They also give you an interface to start/stop/restart it
[12:17:45] Tinyyy: jhass I'm still not sure how its gonna work with my loop. Which part takes the time and runs my script / function at a specific time?
[12:18:15] pcpanic: gavit: So you have a receipt, someone needs to update the progress of the receipt. You are saying you should, within the Receipt model, to have a :status attribute?
[12:18:31] gavit: pcpanic: well, it was explained with memberships where they had a field isAMember, which was changed to people have_many memberships. Membership has a start_date and might have a end_date(or null) so user.memberships.calculate if membership has an end_date if not, we assume it hasn't ended yet, else get the last end_membership date and check if that date has passed
[12:19:10] jhass: Tinyyy: you do. your script is something like loop do; spawn_threads_that_sleep_and_then_do_the_request; sleep 5.minutes; end;
[12:20:42] pcpanic: gavit: Do dates play a role in receipt status changes in your case?
[12:20:43] allcentury: has joined #RubyOnRails
[12:20:43] hahuang65: has joined #RubyOnRails
[12:20:46] gavit: pcpanic: you seem to have solved it partly by having a seperate model instead of a field though, so that part is good. However your status doesn't hold true I guess? maybe it's the naming? changedToStatus date?
[12:21:06] skroon: has joined #RubyOnRails
[12:21:07] Tinyyy: oh okay thans
[12:21:12] gavit: pcpanic: well it's important for the people to figure out if it has changed status and when.
[12:21:38] gavit: pcpanic: also I assume it cannot be given back if it hasnt been received
[12:21:41] pcpanic: gavit: for that you have :updated_at in your Status model
[12:22:29] pcpanic: gavit: :created_at for the received date, and :updated_at for the status change
[12:22:42] yaw: has joined #RubyOnRails
[12:23:15] gavit: also, in regards to your :status attribute @ receipt model: I think its important to be able to ask the receipt the status, ut it should be a function and not an attribute
[12:24:03] gavit: pcpanic: I'm wondering if your idea is correct apart from the naming.
[12:24:51] gavit: StatusChanges - changedStatusTo, description, date, receipt_id
[12:25:00] gavit: brb, need to go help in garden
[12:25:20] pcpanic: gavit: you should probably get an opinion from a pro, sorry if I blocked from someone more worthy of answering your question. It seemed simple to me :)
[12:29:02] tuelz: has joined #RubyOnRails
[12:34:21] jonee: has joined #RubyOnRails
[12:34:39] Tinyyy: jhass btw, is it a good idea to spawn >1000 threads?
[12:34:54] Tinyyy: It's probably gonna increase to 2000-3000 too
[12:37:07] ddv: has joined #RubyOnRails
[12:37:18] hahuang65: has joined #RubyOnRails
[12:37:31] vickleton: has joined #RubyOnRails
[12:39:44] Tinyyy: What's the difference between spawning a new fork and a new thread? Does either of them have to load the Rails environment again?
[12:40:25] jhass: Tinyyy: no, but you should read up on what a process is and what a thread isi
[12:40:53] Tinyyy: I'm trying to read up, its quite confusing though. So which one should I use assuming I'm on a unix machine?
[12:43:07] jhass: for your usecase I'd stick with threads
[12:44:17] iamse7en: has joined #RubyOnRails
[12:44:22] jhass: and it's not all that complicated, a process is a running program, it has one or more threads which concurrently execute a part of the program. A fork is a copy of a process, a new process copied from an old one
[12:45:14] Tinyyy: what does 'copied' mean?
[12:46:03] Lytol: has joined #RubyOnRails
[12:46:21] Tinyyy: from my perspective, they both sound about the same - they both run a part of the code. I'll read up on it on my own though :)
[12:46:37] jhass: your process owns a chunk of your memory to which it reads and writes data to. A fork copies that chunk of memory and gives it to a new process
[12:46:57] jhass: a thread keeps the same chunk of memory
[12:47:33] bruno-: has joined #RubyOnRails
[12:49:24] svdb64: has joined #RubyOnRails
[12:51:10] gavit: pcpanic: no hrm done, I much rather prefer a discussion than a solution!
[12:52:13] Tinyyy: you know the problem I've had reading up on these kinda stuff is that they present you with vocabulary that you don't really understand, then you have to figure out what they mean, then you end up stuck in a circular dependency
[12:53:18] kham: has joined #RubyOnRails
[12:53:23] ktchup: has joined #RubyOnRails
[12:54:55] bonhoeffer: has joined #RubyOnRails
[12:54:56] konsolebox: has joined #RubyOnRails
[12:56:00] gavit: Tinyyy: If you order a coffee, that's a process. The guy washes the cup, while the coffeemaker warms up the water, while the pressure builds up and the fridge cools the milk. When the guy is finished washing, he checks if the water is hot enough. if it is, he puts the cup in the coffee machine <- these are threads
[12:56:25] jhass: eh, not IME. The rabbit hole can go quite deep but is rarely circular
[12:58:06] fgo: has joined #RubyOnRails
[12:58:16] Tinyyy: thanks, you guys are really nice and patient with me :)
[12:58:22] gavit: Tinyyy: a new thread would be the water was contaminated, so we throw away the water and heat it up again. a fork would be, ask another aiter to make a cup of cofeee
[12:58:41] skroon_: has joined #RubyOnRails
[12:59:15] gavit: jhass: what does IME mean?
[12:59:24] jhass: in my experience
[12:59:27] gavit: in my experience?
[12:59:31] gavit: aah oky :)
[12:59:42] gavit: I guessed it :P and then saw your message
[12:59:58] Olumayowa: has joined #RubyOnRails
[13:00:20] hahuang65: has joined #RubyOnRails
[13:00:42] jhass: the important part about the fork is that while you call the other waiter to also fulfill the same order, the original carries on with it too or decides to do something else
[13:01:01] jhass: but you don't cease to exist
[13:02:41] svdb64: has joined #RubyOnRails
[13:05:28] pontiki: has joined #RubyOnRails
[13:06:06] tvw: has joined #RubyOnRails
[13:06:07] Tinyyy: Are there good books on stuff like these? How did you learn these stuff?
[13:06:18] erichu: has joined #RubyOnRails
[13:06:27] svdb64: has joined #RubyOnRails
[13:08:42] Arnie25: has joined #RubyOnRails
[13:09:01] doodlehaus: has joined #RubyOnRails
[13:10:18] tbuehlmann: I liked these books: http://www.jstorimer.com/pages/books
[13:12:32] Tinyyy: tbh I'm a student and I don't buy any books
[13:13:21] stantonnet: has joined #RubyOnRails
[13:14:22] pontiki: morning, railsters
[13:14:34] x3cion: has joined #RubyOnRails
[13:16:43] doodlehaus: has joined #RubyOnRails
[13:18:28] hahuang65: has joined #RubyOnRails
[13:18:37] chinmay_dd: has joined #RubyOnRails
[13:18:51] bronson: has joined #RubyOnRails
[13:18:59] umo: has joined #RubyOnRails
[13:21:13] Hates_: has joined #RubyOnRails
[13:22:00] Palsson: has joined #RubyOnRails
[13:23:40] lapide_viridi: has joined #RubyOnRails
[13:29:32] skroon: has joined #RubyOnRails
[13:29:47] tuelz: has joined #RubyOnRails
[13:30:40] zorak8: has joined #RubyOnRails
[13:34:51] Rubie: has joined #RubyOnRails
[13:35:37] Tinyyy: I just realized that what I said sounded quite retarded so I have to clarify that I try to get books from IRC highway #ebooks or something, but they only have popular books
[13:36:47] artto: has joined #RubyOnRails
[13:36:53] hahuang65: has joined #RubyOnRails
[13:38:04] ddv: has joined #RubyOnRails
[13:38:19] RegulationD: has joined #RubyOnRails
[13:39:48] Trynemjoel: has joined #RubyOnRails
[13:40:34] iamse7en: has joined #RubyOnRails
[13:41:45] dpritchett: has joined #RubyOnRails
[13:43:39] FernandoBasso: I am reading http://guides.rubyonrails.org/form_helpers.html about radio_button_tag. How to relate radio buttons with the f in form_for @user_category do |f| ?
[13:44:13] zorak8: has joined #RubyOnRails
[13:45:04] FernandoBasso: Ah, I think radio_button_tag(:status, 'Active') will automatically relate the status attribute of my model.
[13:46:29] dell_some1: has joined #RubyOnRails
[13:47:27] workmad3: has joined #RubyOnRails
[13:51:04] artto: has joined #RubyOnRails
[13:51:34] jonee: has joined #RubyOnRails
[13:52:00] shyshy: has joined #RubyOnRails
[13:53:51] kham: has joined #RubyOnRails
[13:58:12] x3cion: has joined #RubyOnRails
[14:00:40] yardenbar: has joined #RubyOnRails
[14:01:16] christiandsg: has joined #RubyOnRails
[14:02:11] bruno-: has joined #RubyOnRails
[14:07:42] bruno-: has joined #RubyOnRails
[14:07:47] konsolebox: has joined #RubyOnRails
[14:07:54] hahuang65: has joined #RubyOnRails
[14:11:37] christiandsg: has joined #RubyOnRails
[14:11:53] l0oky: has joined #RubyOnRails
[14:12:26] nya: has joined #RubyOnRails
[14:13:09] bruno-: has joined #RubyOnRails
[14:16:40] l0oky: wabisuke: Does product model exist?
[14:18:17] ych_: has joined #RubyOnRails
[14:18:34] bruno-: has joined #RubyOnRails
[14:25:28] FernandoBasso: I am stil confused about strong parameters.
[14:25:49] FernandoBasso: params.require(:user_category).permit(:description, :status) <-- I'm not sure :user_category is the right thing I have to write there.
[14:26:16] FernandoBasso: How do I know what I have to write in .require(...) ?
[14:26:16] hahuang65: has joined #RubyOnRails
[14:27:08] l0oky: if you want to require a hash called user_category with description and status arguments you do that line
[14:28:08] l0oky: in url it would look line ?user_category[description]=mydesc&user_category[status]=true
[14:29:03] l0oky: rails will interpret user_category as a hash that is required
[14:29:09] FernandoBasso: loglaunch, I want to require the things I specified in this form: https://gist.github.com/FernandoBasso/9b464113064af2b02075
[14:29:47] FernandoBasso: (reading your explanation closely)
[14:30:31] FernandoBasso: Oops, that was meant to l0oky
[14:31:00] drale2k: has joined #RubyOnRails
[14:31:16] l0oky: FernandoBasso: whehers your file with params.require(:user_category)....
[14:31:32] l0oky: whehehehers :P
[14:32:10] FernandoBasso: l0oky, Just reload the gist.
[14:33:00] sankaber: has joined #RubyOnRails
[14:33:12] l0oky: So whats your problem?
[14:33:35] Pazician: has joined #RubyOnRails
[14:33:51] FernandoBasso: When I submit the form, params[:user_category].inspect is nil.
[14:34:18] Lytol: has joined #RubyOnRails
[14:34:38] FernandoBasso: And if I remove that return and actually try to persist the data, I get "param is missing or the value is empty: user_category"
[14:34:39] thsig: has joined #RubyOnRails
[14:35:09] thsig_: has joined #RubyOnRails
[14:35:14] l0oky: try calling user_categories_params at the beginning of your class
[14:35:29] l0oky: It will check your params first then continue that way
[14:35:40] roolo: has joined #RubyOnRails
[14:36:57] noodman: has joined #RubyOnRails
[14:37:02] l0oky: FernandoBasso: Can you add your UserCategory.rb file
[14:37:26] FernandoBasso: It is empty so far.
[14:37:40] qejk: has joined #RubyOnRails
[14:37:55] FernandoBasso: Just lines one and two, class Admin:: ... end
[14:37:58] l0oky: uh oh I excuse me
[14:38:11] l0oky: what columns in Admin::UserCategory do you have?
[14:38:23] FernandoBasso: description and status
[14:38:32] FernandoBasso: Besides id, created/updated at
[14:39:44] l0oky: you can do this put `params.require(:user_category).permit(:description, :status)` at the beginning and call your `@user_category = Admin::UserCategory.new(params[:user_category][:description], params[:user_category][:status])`
[14:40:06] rickmasta: has joined #RubyOnRails
[14:40:40] l0oky: ill make a fork of that gist
[14:40:57] FernandoBasso: I'm very confused at this point. Sorry for taking your time like that.
[14:41:37] l0oky: what you've been doing is another way to pass parameters in your model
[14:41:52] l0oky: ill show you the less confusing one
[14:43:02] l0oky: FernandoBasso: https://gist.github.com/l0oky/f8a5c9124ac1d06c71c0
[14:44:02] l0oky: params[:user_category][:description] is the description passed from your hash :user_category
[14:45:00] l0oky: we first require that hash to be passed in UserCategoriesController or rails raises an exception that not all params are passed
[14:46:51] l0oky: I think that you'll still get params is missing exception because you don't pass user_category hash at all
[14:47:15] l0oky: form_for posts raw params in your controller
[14:47:28] FernandoBasso: Yep, that is what is happening, an exception.
[14:47:31] busterarm: look in chrome inspector and see what data you're passing back in the params
[14:48:02] l0oky: FernandoBasso: Ill do a revise on my gist
[14:48:41] poli: has joined #RubyOnRails
[14:49:04] FernandoBasso: It should be :admin_user_cateogory instead of :user_category
[14:49:51] dangerousdave: has joined #RubyOnRails
[14:50:00] FernandoBasso: I looked at the code I wrote yesterday, where I GUESSED it should be :admin_user (because I am in Admin::User), so I now guessed it should be :admin_user_cateogory because I am in Admin::UserCategory.
[14:50:08] FernandoBasso: But I am still confused :D
[14:50:24] l0oky: Did you try it?
[14:50:54] FernandoBasso: Yes, and it is inserted in the DB now.
[14:51:14] kham: has joined #RubyOnRails
[14:51:29] l0oky: Glad that you found solution for your problem :D
[14:51:32] FernandoBasso: But yesterday someone here told me that that parameter had nothing to do with the model name, or anything like that.
[14:51:32] rickmasta: has joined #RubyOnRails
[14:51:44] FernandoBasso: But it seems it has. I'm confused :D
[14:52:01] l0oky: what parameter?
[14:52:06] FernandoBasso: l0oky, I'm sorry I made you waste so much time. I really appreciate your help.
[14:52:25] FernandoBasso: params.require(:something_here)
[14:52:26] l0oky: np, we're here to help, or waste our time :D
[14:52:37] allcentury: has joined #RubyOnRails
[14:52:54] FernandoBasso: That :something_here is what I do not understand yet.
[14:53:27] FernandoBasso: busterarm, Yep, looking at the inspector proved that :admin_user_category is what is being sent.
[14:53:32] yaw: FernandoBasso it's a key of the params hash
[14:53:41] l0oky: :something_here can be a hash
[14:53:55] busterarm: just change to require(:admin_user_category) then if you wanna be lazy
[14:53:57] yaw: it means the params hash should have that key. it could map to anything though
[14:54:16] FernandoBasso: yaw, Yeah, but how do I know what that key should be named?
[14:54:18] l0oky: :admin_user_category is a hash of your model
[14:54:31] l0oky: rails generates it depending on the name
[14:54:37] FernandoBasso: I am in a namespece "admin", in the model "user_category".
[14:54:47] FernandoBasso: So I guess it makes sense.
[14:54:49] l0oky: just add underscores XD
[14:55:00] yaw: FernandoBasso follow the Rails convention
[14:55:36] busterarm: yeah i said this yesterday but your models didn't make sense to me
[14:55:38] Papierkorb_: has joined #RubyOnRails
[14:56:17] hahuang65: has joined #RubyOnRails
[14:56:29] FernandoBasso: Well, it was my fault I was not clear.
[14:56:40] FernandoBasso: Thank you all for helping me out.
[14:57:17] l0oky: nah we just didn't figure it out long time ago there was a Admin:: namespace all over your code :P
[14:59:12] FernandoBasso: It is my first rails app. I'm not sure of anything yet :)
[14:59:27] FernandoBasso: For instance, I'll have users in admin, but also users of a public area.
[15:00:15] FernandoBasso: So, controlers will have subdirs like admin (the one I'm doing right now), and something else for the public users.
[15:01:01] FernandoBasso: The admin ones will be "editors" and "admins", for instance. The public ones will have only one permission level.
[15:01:19] busterarm: you're probably duplicating a ton of work that way
[15:01:27] blackmes1: has joined #RubyOnRails
[15:01:29] busterarm: and that will likely make it hard for admins to do regular user tasks
[15:01:32] srinidhi: has joined #RubyOnRails
[15:01:54] FernandoBasso: I think you are right, I'm just not sure how to proceed.
[15:02:33] FernandoBasso: For instance, I want an admin area where I will add products, for instance, and there will be the commong CRUD operations on those products from and "admin" perspective.
[15:02:44] FernandoBasso: But on the other hand, I'll also list those products on a public area.
[15:02:47] pcpanic: Hello Rails masters, I am trying to pass a parameter from a link_to to a collection_select :selected | https://gist.github.com/ysinc88/2982555bf525b631c9f5
[15:02:57] pcpanic: Anyone have an idea how to do it?
[15:02:59] cytoskeletor: has joined #RubyOnRails
[15:03:05] busterarm: are you rolling your own authentication or using devise or something?
[15:03:33] FernandoBasso: busterarm, I will probably use devise.
[15:04:02] FernandoBasso: This is my first rails app. I don't know what I am doing, to tell the truth.
[15:04:08] jhass: pcpanic: you have access to the params hash in the view
[15:04:39] busterarm: with strong params you're probably pretty safe to turn Admin role into an attribute on the user model
[15:04:40] FernandoBasso: I am willing to restart from scratch at some point, and avoid errors I'll undoubtedly commit now.
[15:05:00] busterarm: i don't usually use devise but here's a guide https://github.com/plataformatec/devise/wiki/How-To:-Add-an-Admin-Role
[15:05:02] pcpanic: jhass: But the :selected accepts a string, no ? I am an :id
[15:05:03] givanse: has joined #RubyOnRails
[15:05:31] FernandoBasso: busterarm, I consider devise because it is what it seems people most talk about when it comes to rails auth.
[15:05:42] l0oky: FernandoBasso: You remind me of myself hah I learn practically just like you. Making a real world project as my first, fastest way to learn :P
[15:05:51] busterarm: yeah i'm not saying not to use Devise
[15:06:03] busterarm: more that I can't verify that's 100% right
[15:06:09] busterarm: looked solid though
[15:06:10] l0oky: Don't use devise for your first project
[15:06:19] busterarm: ^ what l0oky said
[15:06:19] l0oky: because youll miss a lot of stuff
[15:06:35] busterarm: also you'll run into problems that will be hard to debug
[15:06:52] jhass: pcpanic: never used simple form, but I mean you can just query the text from the ID if so
[15:06:58] FernandoBasso: So, I should consider rolling my auth system myself?
[15:07:03] pcpanic: jhass: to make a long gist short: <%= q.q %><%= link_to t("answer"), new_answer_path(:question_id => q) %> and the collection: <%= f.collection_select(:user_id, User.all, :id, :fname, prompt: true ) %>
[15:07:07] busterarm: it's actually not difficult
[15:07:09] FernandoBasso: (I did some in PHP aready)
[15:07:21] busterarm: a couple of methods using BCrypt and a session cookie
[15:07:26] l0oky: FernandoBasso: just some simple auth for your app nothing special
[15:07:29] pcpanic: jhass: interesting, let me try that
[15:07:36] FernandoBasso: Okay, I'll consider it.
[15:07:39] busterarm: stuff gets more complicated when you want multiple sessions
[15:07:47] jhass: pcpanic: okay, I assumed you marked the wrong one. Then I have no clue at all how you go from a question_id to selecting a user
[15:07:52] l0oky: you can watch a tutorial how to do it from scratch from railscasts.com
[15:07:58] busterarm: i have a live app where I rolled my own basic auth if you want an example to look at
[15:08:00] FernandoBasso: I am always inclined to do things myself anyway, whenever possible. For instance, I do LOTS of stuff in JS without jquery.
[15:08:20] pcpanic: jhass: forget the user, i want to send the question_id so that it would be preselected for an :answer
[15:08:22] FernandoBasso: busterarm, Sure.
[15:08:24] busterarm: and it's just an API
[15:08:28] l0oky: FernandoBasso: https://www.youtube.com/watch?v=Hw6WtWJwRtU
[15:08:34] busterarm: so you can ignore all the frontend js
[15:08:45] busterarm: https://github.com/slancio/meeplespace
[15:09:12] busterarm: focus on the the application_controller and the session and user controllers in API
[15:09:52] FernandoBasso: l0oky, I'm donloading that video.
[15:10:23] busterarm: the ones outside the api folder aren't actually getting used anymore :)
[15:10:28] busterarm: i need to remove them -.-
[15:10:48] pcpanic: jhass: no luck | :selected => Question.find(@question).q
[15:10:52] l0oky: sure :) I like railscasts.com It has a lot of useful stuff including paypal or stripe integration so you can get your money flowing right away :P
[15:11:10] pcpanic: jhass: where @question holds the question_id and :q is the actual question text
[15:11:12] rickmasta: has joined #RubyOnRails
[15:11:28] busterarm: user model also has part of the auth stuff as well
[15:11:37] karmapolice: has joined #RubyOnRails
[15:11:49] busterarm: the meat of it, actually
[15:12:50] rickmasta: has joined #RubyOnRails
[15:13:15] arBmind: has joined #RubyOnRails
[15:13:21] kidoz: has joined #RubyOnRails
[15:14:25] Lightsword: has joined #RubyOnRails
[15:14:47] sankaber: has joined #RubyOnRails
[15:15:13] jhass: pcpanic: try setting @answer.question_id = params[:question_id] in your controller
[15:15:23] eggoez: has joined #RubyOnRails
[15:15:32] tuelz: has joined #RubyOnRails
[15:15:35] pcpanic: jhass: on it
[15:15:55] hahuang65: has joined #RubyOnRails
[15:17:11] pcpanic: jhass: THANK YOU!!!!! that worked.
[15:17:27] JDeen: has joined #RubyOnRails
[15:17:28] l0oky: dont panic :P
[15:17:39] Hates_: has joined #RubyOnRails
[15:17:59] pcpanic: l0oky: that was for me :) ?
[15:18:16] mhf^: has left #RubyOnRails: ()
[15:19:33] shanson: has joined #RubyOnRails
[15:20:19] jhass: pcpanic: you also could @answer = Question.find(params[:question_id).answers.new (or .build? I never remember) iirc
[15:21:11] mrchris: has joined #RubyOnRails
[15:21:15] busterarm: .create or new
[15:21:21] mrchris: Good morning
[15:21:28] busterarm: also don't forget the ] :)
[15:21:53] busterarm: .create will try to save though, .new will have to explicitly be saved
[15:22:33] svdb64: has joined #RubyOnRails
[15:22:38] PlasmaStar: has joined #RubyOnRails
[15:22:39] Rubie: has joined #RubyOnRails
[15:23:30] sarink: has joined #RubyOnRails
[15:23:47] jhass: build works too http://api.rubyonrails.org/classes/ActiveRecord/Relation.html#method-i-build
[15:23:51] bmalum: has joined #RubyOnRails
[15:24:18] busterarm: never used it :) interesting
[15:24:25] JDeen: I am interested in writing a method that takes dynamic set of arguments and then pass it to another method. The thought was for sending mail I have a general Sidekiq PostmanWorker to do the job. Can this be done? I guess I will have to use the splat def process(klass, *args); end; operator but how do I send it to the other method?
[15:25:04] busterarm: when you say "it" do you mean the processed arguments or something like the method itself?
[15:32:54] DLSteve: has joined #RubyOnRails
[15:33:05] nickenchuggets: has joined #RubyOnRails
[15:34:54] nobitanobi: has joined #RubyOnRails
[15:36:08] fighella: has joined #RubyOnRails
[15:36:10] workmad3: has joined #RubyOnRails
[15:39:03] skroon_: has joined #RubyOnRails
[15:42:54] drale2k: has joined #RubyOnRails
[15:44:20] mhib: has joined #RubyOnRails
[15:45:08] krz: has joined #RubyOnRails
[15:46:37] baweaver: has joined #RubyOnRails
[15:47:40] poli: has joined #RubyOnRails
[15:50:10] sarink: has joined #RubyOnRails
[15:50:35] xhoy: has joined #RubyOnRails
[15:55:18] GriffinHeart: has joined #RubyOnRails
[15:55:23] hahuang65: has joined #RubyOnRails
[15:56:18] christiandsg: has joined #RubyOnRails
[15:57:09] badmadrad: has joined #RubyOnRails
[15:57:23] c2k4vr: has joined #RubyOnRails
[15:58:18] n1lo: has joined #RubyOnRails
[15:58:41] n008f4g_: has joined #RubyOnRails
[15:59:27] Lytol: has joined #RubyOnRails
[15:59:34] tuelz: has joined #RubyOnRails
[15:59:41] fgo: has joined #RubyOnRails
[16:00:17] diegoviola: has joined #RubyOnRails
[16:00:42] jonee: has joined #RubyOnRails
[16:01:50] adac: has joined #RubyOnRails
[16:04:03] Lytol: has joined #RubyOnRails
[16:05:18] Grundell: has joined #RubyOnRails
[16:07:02] Node1: has joined #RubyOnRails
[16:07:36] PhantomSpank: has joined #RubyOnRails
[16:08:54] Node1: has left #RubyOnRails: ()
[16:09:58] doodlehaus: has joined #RubyOnRails
[16:10:17] bmurt: has joined #RubyOnRails
[16:10:30] l0oky: has joined #RubyOnRails
[16:10:40] l0oky: Can I optimize this query? https://gist.github.com/l0oky/cf63df96b105757447c0
[16:14:19] devdazed: has joined #RubyOnRails
[16:15:02] triangles: has joined #RubyOnRails
[16:15:53] [H]unt3r: has joined #RubyOnRails
[16:19:16] Papierkorb: Is it possible to enumerate all sessions? I want to have a feature where when the user resets their accounts password, all logged in sessions of that users are 'kicked'
[16:19:17] mhib: has joined #RubyOnRails
[16:19:34] busterarm: change the session token
[16:19:42] shock_one: has joined #RubyOnRails
[16:19:51] busterarm: if you're validating the token on every action, they won't be able to do anything on the site
[16:20:06] busterarm: (and you can redirect them)
[16:20:33] Papierkorb: I store the session in a DB through the AR store, and there I just store the user id to look it up (for every request)
[16:21:29] busterarm: that might be a big problem
[16:21:55] busterarm: how do you enforce that the user is who they say they are? I can send up any ID in the params
[16:22:06] Papierkorb: busterarm: Session cookie.
[16:22:17] busterarm: just the ID in the cookie?
[16:22:21] busterarm: or a token?
[16:23:28] Papierkorb: busterarm: using https://github.com/rails/activerecord-session_store the user gets a session id cookie, thus the session data itself is persisted in my local DB.
[16:23:42] Papierkorb: The user never gets hold of anything but that.
[16:23:59] Papierkorb: If you can crack that randomly generated token id, then every webservice out there is broken
[16:24:16] poli_: has joined #RubyOnRails
[16:24:32] busterarm: destroy the session?
[16:24:45] Papierkorb: I would have to find the sessions for that first ...
[16:24:59] Tinyyy: has joined #RubyOnRails
[16:25:01] Papierkorb: Which is what I want
[16:25:19] busterarm: that's probably why I haven't used that :B
[16:26:02] Tinyyy: hey guys is it possible to assume that for the Time module, if Time.to_i % 60 == 0, the seconds is '0'?
[16:26:03] hahuang65: has joined #RubyOnRails
[16:26:16] busterarm: i'm looking into it Papierkorb...
[16:27:06] erichu: has joined #RubyOnRails
[16:27:19] jonee: has joined #RubyOnRails
[16:27:32] Papierkorb: It's base64'd marshalled data, so I can't do a SELECT query for it. Meh. Though it should be fine for the store to store JSON data into the PostgreSQL DB, then I could use PSQL's JSON functions to find sessions
[16:28:35] busterarm: how does it know it belongs to the user?
[16:29:06] busterarm: checks every time it gets the cookie back
[16:29:45] busterarm: you might have to add a flag of some kind to the user model and in the session check dump sessions when it sees they're set
[16:30:08] busterarm: but then you have the problem of old sessions on other devices after they've signed back in
[16:31:17] czerasz: has joined #RubyOnRails
[16:31:48] busterarm: i feel like maybe that tool is designed for sessions that are meant to have a short time out, like bank websites
[16:32:11] busterarm: delete if updated_at > 15.minutes sort of stuff
[16:32:25] Papierkorb: Afaik it doesn't get rid of sessions itself, I doubt so. Still have to get sorted that out too
[16:33:01] Papierkorb: Like I had sessions in the DB that were active over a month ago.
[16:33:09] busterarm: well, there'd be a table...you'd have a recurring job to delete most likely
[16:33:33] Papierkorb: Just have to periodically change the session so it doesn't time out. Not a big deal.
[16:34:18] adac: has joined #RubyOnRails
[16:35:18] l0oky: What can I do when I have 2 or 3 models that I need to merge into one so I can display a table on my view easily
[16:35:20] Papierkorb: I'm also wondering if it's possible to only create a session (and thus a cookie) when something happens, e.g., when the user logs in. Before that, I'm just transferring junk data, store junk data in my DB, and if the cookie law of GB would swap over here, I'd have a problem too
[16:36:04] arup_r: has joined #RubyOnRails
[16:37:32] busterarm: l0oky: are the records not related or do you need more than one of each model?
[16:38:11] Palsson: has joined #RubyOnRails
[16:38:35] mrchris: how do you set attributes on a joining model?
[16:38:35] l0oky: they are related..
[16:38:41] Cache_Money: has joined #RubyOnRails
[16:38:53] busterarm: you should be able to access them through the relation then?
[16:39:27] kitsuneyo: has joined #RubyOnRails
[16:39:36] l0oky: but I need to join them into one so I can easily do a .each on my view
[16:39:50] l0oky: I don't really have a clue how to do it..
[16:40:03] nickenchuggets: has joined #RubyOnRails
[16:40:08] rakm: has joined #RubyOnRails
[16:40:49] lurch_: has joined #RubyOnRails
[16:42:13] busterarm: ehhhh, you can pass whatever you want to the view in your controller
[16:42:18] kitsuneyo: has joined #RubyOnRails
[16:42:22] busterarm: create instances variables out of thin air and pass them
[16:42:28] l0oky: i know that -.-'
[16:42:57] busterarm: can only speculate without seeing code
[16:43:04] l0oky: give me a few secs let me generate a diagram :D
[16:43:05] nfk: has joined #RubyOnRails
[16:43:53] drale2k: has joined #RubyOnRails
[16:43:58] Diabolik: how do you access arguments passed into an initialize method in other methods in coffeescript?
[16:45:40] kitsuneyo: has joined #RubyOnRails
[16:48:46] max_v: has joined #RubyOnRails
[16:49:44] lethjakman: has joined #RubyOnRails
[16:54:06] annlewis: has joined #RubyOnRails
[16:56:38] hahuang65: has joined #RubyOnRails
[16:58:45] Lytol: has joined #RubyOnRails
[16:58:50] ellisTAA: has joined #RubyOnRails
[16:59:44] lethjakman: has joined #RubyOnRails
[17:00:34] Pazician: has joined #RubyOnRails
[17:00:46] fgo: has joined #RubyOnRails
[17:01:18] pontiki: has joined #RubyOnRails
[17:03:46] mary5030: has joined #RubyOnRails
[17:04:54] ephantmon: has joined #RubyOnRails
[17:07:09] zorak8: has joined #RubyOnRails
[17:09:25] Lytol: has joined #RubyOnRails
[17:09:48] bratsche: has joined #RubyOnRails
[17:09:55] tyl: has joined #RubyOnRails
[17:15:28] FernandoBasso: I have Users and Categories (of users). The User model and migration doesn't know about categories so far (crud is working independently for them). How to make User reference a Category now?
[17:16:03] FernandoBasso: If I add belongs_to :category in User, I still have to change/add a migration, right?
[17:17:33] fedexo: has joined #RubyOnRails
[17:18:11] Diabolik: yes FernandoBasso
[17:18:29] FernandoBasso: Something like "rails generate migration add_category_to_admin_users user_category_id" ?
[17:19:31] noodman: has joined #RubyOnRails
[17:20:28] bruno-: has joined #RubyOnRails
[17:20:55] Siyo: hey, is this expected behavior with nested attributes? http://pastebin.com/TbUiMEqu
[17:22:06] Siyo: gist version https://gist.github.com/anonymous/c88806b501133e3d4813
[17:24:52] workmad3: has joined #RubyOnRails
[17:25:04] Siyo: actually nevermind
[17:25:26] kham: has joined #RubyOnRails
[17:25:44] dented42: has joined #RubyOnRails
[17:25:45] bruno-: has joined #RubyOnRails
[17:26:01] t_mmyv: has joined #RubyOnRails
[17:26:02] SteenJobs: has joined #RubyOnRails
[17:26:55] Siyo: it's actually correct in the gist
[17:26:56] Siyo: in the actual code i had "has_and_belongs_to_many :placements, has_many :ads" in different order
[17:28:59] noodman: has joined #RubyOnRails
[17:29:12] chipotle: has joined #RubyOnRails
[17:30:05] nobitanobi: has joined #RubyOnRails
[17:30:39] noodman_: has joined #RubyOnRails
[17:31:32] workmad3: has joined #RubyOnRails
[17:32:33] Axilla: has joined #RubyOnRails
[17:32:59] christiandsg: has joined #RubyOnRails
[17:33:14] konsolebox: has joined #RubyOnRails
[17:33:52] werelivinginthef: has joined #RubyOnRails
[17:34:05] noodman: has joined #RubyOnRails
[17:34:20] SteenJobs: has joined #RubyOnRails
[17:36:09] noodman: has joined #RubyOnRails
[17:37:43] blackmes1: has joined #RubyOnRails
[17:38:05] jdayvie: has joined #RubyOnRails
[17:38:58] mrchris: has joined #RubyOnRails
[17:39:42] noodman: has joined #RubyOnRails
[17:42:23] noodman_: has joined #RubyOnRails
[17:45:52] antlong: has joined #RubyOnRails
[17:46:28] Dopagod: has joined #RubyOnRails
[17:46:44] qejk: has joined #RubyOnRails
[17:47:58] bradleyprice: has joined #RubyOnRails
[17:48:44] DEA7TH: has joined #RubyOnRails
[17:49:24] FernandoBasso: rails generate migration add_user_category_reference_to_admin_users admin_user_category:references <-- This is a sign of bad design, isn't it?
[17:49:42] drale2k: has joined #RubyOnRails
[17:50:05] SteenJobs: has joined #RubyOnRails
[17:50:33] nfk: has joined #RubyOnRails
[17:50:39] antlong: devise is the bottleneck for me, specifically when i run load tests. logging in 100 users is very intensive. is there a way to speed up authentication, perhaps do it outside of the test and use stored data?
[17:51:23] noodman: has joined #RubyOnRails
[17:51:38] tuelz: has joined #RubyOnRails
[17:54:41] SteenJobs: has joined #RubyOnRails
[17:54:41] Papierkorb: FernandoBasso: ?
[17:54:49] jonee: has joined #RubyOnRails
[17:55:26] FernandoBasso: Papierkorb, DB table names are too long: admin_user_categories, and columns like admin_user_category_id ...
[17:55:57] doodlehaus: has joined #RubyOnRails
[17:56:26] jdayvie: Good Morning Everyone =) Hope you are all doing well. I have a question regarding Mailgun within my application. I've set it up but when I try to create an article (which is the action I attached to sending the mailer), it returns to two errors:
[17:56:39] Jarboe: has joined #RubyOnRails
[17:56:39] Papierkorb: FernandoBasso: aha. So, I can't judge if that's good design without knowing code, but then, what else should it be named?
[17:56:47] jdayvie: Here is a gist of the errors and the corresponding code if anyone is able to view: https://gist.github.com/Jdayvie/a75b5a8cc6943cda84c7 =)
[17:57:34] FernandoBasso: Papierkorb, I don't know. It just feels bad. My models are Admin::User and Admin::UserCategory, for now.
[17:57:39] mhib: has joined #RubyOnRails
[17:57:56] FernandoBasso: and thus the tables became admin_users and admin_user_categories.
[17:58:52] annlewis: has joined #RubyOnRails
[17:59:58] sarink: has joined #RubyOnRails
[18:00:07] karmapolice: FernandoBasso: how would you call them?
[18:00:36] SteenJobs: hey guys, is render not available within a service?
[18:00:44] FernandoBasso: In this case I would call them exactly as they are, because of the way the models are.
[18:01:16] FernandoBasso: But perhaps my model hierarchy should be different, idk.
[18:01:36] noodman_: has joined #RubyOnRails
[18:02:00] GreatDanton: has joined #RubyOnRails
[18:02:19] nofxx: has joined #RubyOnRails
[18:02:29] kitsuneyo: has joined #RubyOnRails
[18:02:43] SteenJobs: better yet, how can i make render available within my service class?
[18:07:10] shanson: has joined #RubyOnRails
[18:08:07] Trynemjoel: has joined #RubyOnRails
[18:08:48] Maletor: has joined #RubyOnRails
[18:08:51] FernandoBasso: Okay, I have belongs_to :admin_user_category in Admin::User, and if I do user.admin_user_category_id = 1 and then user.save, I get NameError: uninitialized constant Admin::User::AdminUserCategory
[18:09:25] IceyEC: has joined #RubyOnRails
[18:09:27] FernandoBasso: I don't understand why this Admin::User::AdminUserCategory in the error.
[18:10:30] centrx: has joined #RubyOnRails
[18:11:02] FernandoBasso: A User::Admin references Admin::UserCategory.
[18:11:12] Rubie: has joined #RubyOnRails
[18:12:53] sinkensabe: has joined #RubyOnRails
[18:13:10] charliesome: has joined #RubyOnRails
[18:13:38] Trynemjoel: has joined #RubyOnRails
[18:15:16] skroon: has joined #RubyOnRails
[18:15:59] SteenJobs: has joined #RubyOnRails
[18:18:00] Lightsword: has joined #RubyOnRails
[18:18:11] Mendenhall: has joined #RubyOnRails
[18:18:22] CanTonic: has joined #RubyOnRails
[18:20:05] blackmes1: has joined #RubyOnRails
[18:21:03] FernandoBasso: So, I have a reference to Admin::UserCategory, and another to Admin::User. Why would user.admin_user_category_id = cat.id produce NameError: uninitialized constant Admin::User::AdminUserCategory?
[18:21:37] FernandoBasso: I am reading in the docs: "belongs_to associations must use the singular term. ...". I am using singular.
[18:23:11] centrx: Seems related to the namespacing you have
[18:23:17] centrx: which the :: indicates
[18:23:39] yardenbar: has joined #RubyOnRails
[18:23:59] n1lo: has joined #RubyOnRails
[18:24:05] FernandoBasso: Perhaps, since inside the class I am already in that namespace (admin), I should use just belongs_to :user_category instead of :admin_user_category.
[18:24:51] FernandoBasso: Yep, it seems to have been that.
[18:25:12] FernandoBasso: My head is spinning today with all these naming stuff all around... :p
[18:26:40] skroon: has joined #RubyOnRails
[18:27:03] SteenJobs: has joined #RubyOnRails
[18:28:10] werelivinginthef: has joined #RubyOnRails
[18:28:12] pontiki_: has joined #RubyOnRails
[18:28:30] doodlehaus: has joined #RubyOnRails
[18:28:52] Grundell: has joined #RubyOnRails
[18:29:14] joshsmith: has joined #RubyOnRails
[18:29:29] umo20: has joined #RubyOnRails
[18:33:53] CanTonic: Hey everybody. i would like to get your opinion on something. In our app we have a `Role` model with the constant `NAMES = %i(admin moderator user)`. Now a colleague wants to change it to `NAMES = {admin: 'admin', moderator: 'moderator', user: 'user'}` and tell that the reason for it is that it is a common design pattern to use constants instead of magic numbers/string.
[18:34:22] CanTonic: I don't get it and it makes no sense to me why this is necessary and how a hash with same key and value brings any benefit
[18:34:38] Lytol: has joined #RubyOnRails
[18:35:20] mnms_: has joined #RubyOnRails
[18:35:23] ElSif: from just that info i would agree with you
[18:35:40] CanTonic: he furthermore says "In php for example we have to use own constant for each role like define("ADMIN", "admin");", but as ruby allow us use hashes in constants we can put all these constants together
[18:35:42] mnms_: Hi, someone use angular rails templates ?
[18:36:16] karmapolice: in rails doing &:nil? is like !
[18:36:48] ElSif: CanTonic: im a little dubious as to why these 'name's are not columns in the db
[18:36:53] mnms_: I cannot make it work with rails 4
[18:37:22] CanTonic: has joined #RubyOnRails
[18:38:34] ElSif: CanTonic: i meant 'set in a column in the roles table in the db'
[18:38:51] ElSif: im just starting my first cup of coffee
[18:39:52] busterarm: i mean, following his logic, just turn them all into symbols while you're at it :)
[18:40:02] busterarm: (actually i like that idea)
[18:40:12] ElSif: its not a bad one
[18:40:29] ElSif: but making it a hash doesn't give any benefit
[18:40:36] busterarm: 100% agreed
[18:40:49] busterarm: associative arrays have addled the PHP programmer's brain
[18:40:54] busterarm: sorry, that's not polite
[18:41:36] busterarm: i'd say just find a style guide and shove it in his face :B
[18:41:40] Trynemjoel: has joined #RubyOnRails
[18:41:44] busterarm: Eloquent probably has you covered on that case
[18:42:07] ElSif: lol you could also just send him a link...
[18:42:17] busterarm: not to assume a he, but yeah
[18:42:25] doodlehaus: has joined #RubyOnRails
[18:42:29] CanTonic: ElSif: I told him that it makes no sense to me to define hashes with same key and value.
[18:42:35] bonhoeffer: has joined #RubyOnRails
[18:43:01] ElSif: that is a good point, it doesnt make a lot of sense
[18:43:02] FernandoBasso: I need to create a migration that renames a column of admin_user_category_id to simply category_id. I would appreciate some help. My previous migration created that long column name, altough the other columns are short (name, email, instead of admin_user_name and admin_user_email).
[18:43:15] ElSif: but i am still curios why you don't have the name's values in the roles table
[18:43:29] ElSif: mostly curious what is really IN the roles table
[18:43:56] CanTonic: ElSif: and they are in the roles table. The constant is for making sure that the :name attribute only contains values that are in that constant
[18:44:09] CanTonic: validates_inclusion_of :name, in: NAMES.
[18:44:18] busterarm: that's what I figured you'd done
[18:44:20] CanTonic: And in order to be able to iterate over all available roles
[18:44:20] ElSif: ok, then yea, i have idea why you would want to make it a hash
[18:44:26] svdb64: has joined #RubyOnRails
[18:44:52] busterarm: i would just make it an array of symbols
[18:46:00] busterarm: or at least freeze the strings when you're pulling them out of the DB ^^:
[18:46:10] Papierkorb: You could also use a DB enum type
[18:46:18] CanTonic: ElSif. he said: This is common design pattern called "Use constants instead of magic numbers/strings". In php for example we have to use own constant for each role: define("ADMIN", "admin"); - But as ruby allow us use hashes in constants we can put all these constants together.
[18:46:23] Papierkorb: If you want it validated on the DB level
[18:46:34] CanTonic: busterarm: currently it is an Array of symbols which he wants to change
[18:47:05] busterarm: oh, was that %i?
[18:47:07] CanTonic: busterarm: currently it is Role::NAMES = %i(admin moderator user)
[18:47:14] ElSif: Papierkorb: im not opposed to enums but it often confuses people
[18:47:14] busterarm: thought that was w
[18:47:45] ElSif: Papierkorb: yea i dont know why, but ive had to fight to even try to get people to use them before
[18:47:46] CanTonic: so i am really confused why he insists on that and I just don't get what the problem about magic strings is
[18:47:52] ElSif: Papierkorb: and i lost :(
[18:48:13] Papierkorb: ElSif: I think we should reconsider using if anywhere. it might be confusing.
[18:48:26] ElSif: Papierkorb: lol right
[18:48:30] busterarm: it sounds like your coworker hasn't grasped the immutability of symbols yet
[18:48:37] busterarm: and that's what I'd focus on
[18:48:45] christiandsg: has joined #RubyOnRails
[18:48:48] centrx: demote him to subworker
[18:49:00] CanTonic: busterarm: so I should tell him about the immutability of symbols?
[18:49:01] n1lo: has joined #RubyOnRails
[18:49:06] busterarm: they are constant
[18:49:21] Papierkorb: CanTonic: if he doesn't know, tell him right now. that's Ruby 101 stuff.
[18:50:11] busterarm: in fairness, symbols were the second to last thing that I really grokked coming to ruby
[18:51:08] BaNzounet: Hey guys, could you help me with this : https://gist.github.com/AlexGaspar/4e6b226cdd84f0582bc8 I'm trying to test the fact my `belong_to` relation update the parent model, but in my tests the values are not updated, but If I add `put` in the code I can see the values being updated, but once I'm in the test there are not updated anymore
[18:51:40] ariedler: has joined #RubyOnRails
[18:51:47] drale2k: has joined #RubyOnRails
[18:52:05] ElSif: Papierkorb: if i remember correctly (as i dont work there anymore) the argument was, 'if we want to use enums then we are stuck with the values we choose, so lets not strictly valdiate the data so we can change it later more easily', my reply was 'let's just agree on what the values should be now, its just a set of words and the meaning is more important anyway'.
[18:52:25] kitsuneyo: has joined #RubyOnRails
[18:52:46] ElSif: Papierkorb: i lost to the majority of the team not really caring i think and the architect and manager not agreeing with me
[18:52:47] Papierkorb: ElSif: And even enums aren't set in stone. you can easily add values later on. Not remove them though, and while it has its downsides, it makes sense
[18:53:03] arBmind: has joined #RubyOnRails
[18:53:21] ElSif: Papierkorb: yea, im in agreement, if nothing else it forces you to think clearly on what your model really is doing for you
[18:53:26] SteenJobs: hey guys, any idea how to make ???render??? available within a service?
[18:54:00] CanTonic: Thanks a lot guys for your opinion
[18:54:35] ElSif: CanTonic: np
[18:55:43] nickenchuggets_: has joined #RubyOnRails
[18:55:52] hololeap: has joined #RubyOnRails
[18:56:28] cac: has joined #RubyOnRails
[18:56:45] ElSif: BaNzounet: my first guess (not looking at your code) is that you have a stale version of your model, try reloading it :)
[18:56:45] busterarm: ...i used enumberable db types on my first production rails project...
[18:56:56] busterarm: and I didn't have to ask anybody, I just f'in did it!
[18:57:10] Olumayowa: has joined #RubyOnRails
[18:57:15] ElSif: busterarm: if only T_T
[18:57:49] busterarm: Too Many Cooks
[18:58:08] BaNzounet: ElSif: Thanks
[18:58:11] BaNzounet: ElSif: that was it
[18:58:20] Signum: has joined #RubyOnRails
[18:59:17] ElSif: busterarm: that phrase always makes me think how different software would end up if you everyone building it had to taste it after they made a change
[18:59:34] busterarm: that's how code review should work, tbh
[18:59:38] annlewis: has joined #RubyOnRails
[18:59:50] busterarm: the time to discuss the finer points of implementation are after somebody has actually done some work
[18:59:58] busterarm: otherwise you end up bikeshedding
[19:00:12] IceyEC: has joined #RubyOnRails
[19:00:18] busterarm: a little hyperbole on my part
[19:00:39] ElSif: busterarm: true, ive only ever worked at a place that really had communal code reviews though
[19:00:47] ElSif: seems a lot more rare than i expected
[19:00:48] busterarm: have a style guide, have code reviews, make people care about them too
[19:01:18] busterarm: i don't even think it needs to be communal
[19:01:44] busterarm: everyone should be the final responsibility of one person
[19:01:59] busterarm: whether that's a whole project or just a part of it (and then that team is responsible to one person)
[19:02:07] ElSif: i like getting as many people involved as possible
[19:02:14] ElSif: but only if they actually care
[19:02:15] busterarm: err everything should be, i mean, not everyone
[19:02:19] ktchup: has joined #RubyOnRails
[19:02:51] busterarm: too many people are busy trying to keep their head down in life to really care
[19:02:53] ElSif: yea, i think for large teams style guides and sub groups are the better option
[19:03:10] busterarm: caring means taking responsibility and that's super taboo
[19:03:42] busterarm: again hyperbole
[19:03:48] busterarm: there is a way to handle decision by concensus
[19:04:16] ElSif: meh, im not really too much into consensus
[19:04:19] zorak8: has joined #RubyOnRails
[19:04:22] ElSif: humans are very bad at it
[19:04:42] ElSif: but everyone should be able to be involved in the discussion
[19:05:37] ElSif: ive just seen consensus end up being 'lets argue about minutia until everyone with a dissenting opinion gives up'
[19:05:42] ElSif: far too often
[19:08:23] CanTonic: has joined #RubyOnRails
[19:08:39] bricker: has joined #RubyOnRails
[19:10:51] iamse7en: has joined #RubyOnRails
[19:11:35] erichu: has joined #RubyOnRails
[19:13:24] tuelz: has joined #RubyOnRails
[19:15:03] sarink: has joined #RubyOnRails
[19:17:24] ktchup: has joined #RubyOnRails
[19:17:40] JoshGlzBrk: has joined #RubyOnRails
[19:18:02] kies^: has joined #RubyOnRails
[19:19:02] IceyEC: has joined #RubyOnRails
[19:21:34] FernandoBasso: I cannot find a way to create a foreign key named 'category_id' rather than 'admin_user_category_id'.
[19:22:43] FernandoBasso: I tried "rails generate migration add_user_category_reference_to_admin_users admin_user_category:references" and then edited the migration in several ways already. Either I get errors and the migration won't run, or it runs but I am left with that very lengthy column name (while the others are very short).
[19:23:02] Papierkorb: Anyone knows how to tell to not eager-load certain directories?
[19:24:00] Papierkorb: their FAQ mentions that I can control that through the config.eager_load_paths variable, but I don't have that anywhere
[19:24:17] lord4163: has joined #RubyOnRails
[19:24:33] FernandoBasso: Generally you can create those vars yourself inside config files.
[19:24:54] Papierkorb: yeah, but I'm looking more for a black list
[19:24:55] kham: has joined #RubyOnRails
[19:25:13] Papierkorb: I could move that directory outside of app/, but it's app specific, so IMO that's where it belongs
[19:28:24] Papierkorb: FernandoBasso: Ah. simpler than I thought. just use Enumerable#reject: http://stackoverflow.com/questions/13756986/how-to-blacklist-directory-loading-in-rails?answertab=votes#tab-top
[19:28:46] ChadyG: has joined #RubyOnRails
[19:29:54] SteenJobs: hey guys - i have an angular frontend and a rails backend - when processing a stripe payment, i want to create a new ???job??? upon a successful charge. can i implement that logic, only creating a new job if the charge goes through, on the frontend or should it really be done on the server?
[19:30:53] busterarm: i wouldn't let the frontend dictate anything that happens related to payment processing
[19:31:44] SteenJobs: busterarm: it???s not
[19:31:51] imkj: has joined #RubyOnRails
[19:31:53] SteenJobs: busterarm: let me clarify. all of the payment processing is done on the backend.
[19:33:15] Olumayowa: has joined #RubyOnRails
[19:33:16] SteenJobs: busterarm: however, i only want to create a new ???job??? if the payment is successfully processed. i???ve tried to implement that logic within rails but it???s proving rather difficult, so my solution would be on the frontend, receive a callback from the server - if the callback tells the frontend that the payment was successful on the server, then the frontend executes ???createJob()??? which then creates a new job on the
[19:33:47] SteenJobs: busterarm: rather than making a payment request to the server, and then having the server create a new job if the payment was successful. the ???if payment is successful logic??? would be easier done on the frontend
[19:34:16] busterarm: and what's to prevent the browser from initiating that process anytime it feels like?
[19:34:42] SteenJobs: busterarm: which process?
[19:34:49] busterarm: createJob()
[19:34:52] Kilo`byte: has joined #RubyOnRails
[19:35:46] SteenJobs: busterarm: i guess because i in the frontend code in angular, i send the payment info to the server, and then i wait for the response - if the response is :ok, createJob() executes, and if it isn???t, an error is displayed. would that not prevent that process from initiating whenever?
[19:36:12] Papierkorb: That's something you NEVER ever want to decide on the client
[19:36:14] busterarm: but the user or someone else can modify your javascript and execute whatever JS functions they like
[19:36:26] FernandoBasso: So, how do I `add_reference` and specify the column name manually?
[19:36:28] busterarm: whenever they like
[19:36:34] Papierkorb: Else someone comes around and just sends the createJob() through some cURL command. done.
[19:36:42] busterarm: Papierkorb: yup
[19:36:58] kitsuneyo: has joined #RubyOnRails
[19:37:16] SteenJobs: Papierkorb, busterarm: but the createJob() isn???t in the html...
[19:37:19] Papierkorb: SteenJobs: sorry to say, but your front-end idea is bad and could end up costing you thousands of dollars.
[19:37:29] busterarm: but the decision to execute it is
[19:37:34] SteenJobs: busterarm: no it???s not
[19:37:46] SteenJobs: busterarm: it???s in what???s known as a ???directive??? in angular.
[19:37:47] Papierkorb: SteenJobs: The client can do what it wants. the client is always malicious and must not be trusted.
[19:37:53] busterarm: that's what you were saying
[19:37:56] SteenJobs: Papierkorb: i???m aware
[19:38:06] SteenJobs: busterarm: like i guess it???s kind of the backend of the frontend?
[19:38:08] Papierkorb: SteenJobs: I'll just rip that code out and dispatch it myself and get something for free
[19:38:35] SteenJobs: busterarm: how would it be accessible? it operates behind the scenes of angular
[19:38:49] Papierkorb: SteenJobs: So thank you for working for me. That's on the level of horrific of this fuck up by VALVe's Steam gaming service: https://www.youtube.com/watch?v=QPl_BJoBaVA
[19:38:58] busterarm: open up inspector, look at JS, look at what requests are being sent
[19:39:07] busterarm: write request yourself to the server
[19:40:01] SteenJobs: busterarm: so assuming that???s the case, i now have no idea what to do - i was trying to do the logic on the server side, but it wasn???t playing nicely. i???ll gist you my server code.
[19:40:22] whatasunnyday: has joined #RubyOnRails
[19:40:28] Papierkorb: SteenJobs: it ends up on my harddrive throug the cache. whatever ends up in there I own, I don't care about any petty licenses. People like me would just rip your code apart and laugh at your mistakes while enjoying free stuff, knowing that you'll sue the VPN provider in russia who'll use your court documents to fire up the furnace. So thank you for the kind donation.
[19:40:56] whatasunnyday: Does anyone know of a tool that can help me visualize a rails code base? I was thinking something that tells me where models are used or something in that nature. I'm just looking for something to help me dive into a new code base :).
[19:40:59] SteenJobs: not sure what ???it??? is
[19:41:22] Papierkorb: SteenJobs: your code, angular js, HTML data, assets, everything your server sends my way
[19:41:43] busterarm: at the end of the day, it's all just HTTP requests
[19:42:00] SteenJobs: busterarm: https://gist.github.com/SteenJobs/98d120846370a3d890e2#file-error-L10-L11
[19:42:25] SteenJobs: busterarm: (most of the code you???re looking at isn???t mine, only the stuff pertaining to stripe payments and its implementaiton is mine)
[19:42:44] Papierkorb: whatasunnyday: Hardly possible for dynamic languages like Ruby. Try tools like grep or 'the silver searcher' (google it, really, it's great) to search for the models class name. Maybe your editor has some fancy search view as well
[19:43:31] SteenJobs: busterarm: but basically in the create action, createing a job gets executed when a payment gets processed, but obviously there are no jobs params being sent since i???m not creating a job, and then i hit an error
[19:44:02] SteenJobs: busterarm: because the create action gets called when the user pays, and then ???if @charge??? leads to the job creation
[19:44:12] busterarm: Can't verify CSRF token authenticity
[19:44:48] SteenJobs: busterarm: don???t worry about that. it???s just a warning and it???s just because i???m running it locally
[19:44:53] SteenJobs: busterarm: on two different servers
[19:44:57] SteenJobs: (9000 and 3000
[19:45:28] busterarm: and params isn't passing back the values you're looking for in that Time.now.local call where the error is
[19:45:36] SteenJobs: busterarm: correct.
[19:45:44] whatasunnyday: Papierkorb, thanks for the suggestion. I appreciate it!
[19:46:18] djbkd: has joined #RubyOnRails
[19:46:21] SteenJobs: busterarm: the plan was i need some way to only create a job if a payment is processed
[19:46:28] SteenJobs: busterarm: so i abstracted out the payment logic into a service
[19:46:59] busterarm: and you've unpermitted paramaters
[19:47:13] SteenJobs: busterarm: but based on my current code, when the user submits a payment, it also tries to create a job, but obviously there are no job params because the user is only creating a payment.
[19:47:14] Trynemjoel: has joined #RubyOnRails
[19:48:07] busterarm: so the server doesn't know when the payment completes processing?
[19:48:08] SteenJobs: busterarm: it used to be the case that when createJob() on the FE was called, the job create action would execute perfectly fine. however, now the job create action is being called when a payment is processed even if createJob() isn???t being called, hence the missing params.
[19:48:17] SteenJobs: busterarm: it does, and it sends a callback to the frontend
[19:48:41] SteenJobs: busterarm: which back to earlier, i can then call createJob() upon a success callback.
[19:48:45] SteenJobs: (in the FE)
[19:49:56] shyshy: has joined #RubyOnRails
[19:50:52] busterarm: so the method that creates a Stripe charge
[19:51:11] busterarm: it returns an object on success but raises an exception when the charge fails
[19:51:32] busterarm: would it not be possible to initiate the job there?
[19:51:52] SteenJobs: busterarm: where exactly?
[19:51:56] busterarm: before you rescue
[19:52:11] busterarm: line 23 of service.rb
[19:52:19] bin_005: has joined #RubyOnRails
[19:52:24] SteenJobs: busterarm: i mean that would kind???ve defeat the purpose of a service, no?
[19:52:33] SteenJobs: busterarm: because then i???m mixing job and charge logic
[19:52:38] drale2k: has joined #RubyOnRails
[19:52:39] busterarm: i don't disagree
[19:52:40] SteenJobs: busterarm: and i won???t be able to reuse the charge logic in other places
[19:52:42] SteenJobs: busterarm: hmm
[19:53:16] busterarm: another option
[19:53:20] SteenJobs: busterarm: yesh?
[19:53:24] busterarm: have the default case of the service return something
[19:53:31] busterarm: and the rescue cases return something else
[19:53:38] busterarm: and based on the return of that method, initiate job
[19:53:51] busterarm: wherever it's being called
[19:54:04] bonhoeffer: has joined #RubyOnRails
[19:54:04] SteenJobs: busterarm: again though, i don???t think that???s different really than the implementation i have now. and i would still run into the problem of ???where are the job params??"
[19:54:05] busterarm: line 130 in your controller
[19:54:08] superlou: has joined #RubyOnRails
[19:55:04] busterarm: or actually...line 21?
[19:55:06] SteenJobs: busterarm: yea, i mean i only allow a new job to be created ???if @charge??? which essentially does that
[19:55:14] busterarm: i'm not sure what to do about the params just yet
[19:55:27] meoblast001: has joined #RubyOnRails
[19:55:53] SteenJobs: busterarm: but youre right, line 21 should determine job creation, one sec lemme change it
[19:56:35] busterarm: now the params you're missing, day, month, etc
[19:57:04] busterarm: you're getting a created param back in unix time. You should be able to get those values from that
[19:57:06] yfeldblum: has joined #RubyOnRails
[19:57:09] givanse: has joined #RubyOnRails
[19:57:50] SteenJobs: busterarm: nah, that time is the time for the job, unrelated to the time for the payment
[19:58:24] SteenJobs: busterarm: there are no jobs params, that???s the problem. because from the frontend, only payment is being created, not a job, yet job is in the same create action as the payment.
[19:59:46] busterarm: well, if you're creating the job on the backend now, does it need any data from the frontend to successfully complete the job?
[19:59:55] drale2k: has joined #RubyOnRails
[20:00:21] annlewis: has joined #RubyOnRails
[20:00:43] SteenJobs: busterarm: yea, those params i believe, which is why it???s throwing an error
[20:00:45] busterarm: is it the photo and user info (being a cleaner)?
[20:01:04] pkrnj: has joined #RubyOnRails
[20:01:14] kadoppe: has joined #RubyOnRails
[20:02:26] busterarm: i just wanna be clear, are we talking about tokenInfo, amount and job?
[20:02:35] busterarm: they're not included in your strong params, it looks like
[20:02:37] SteenJobs: busterarm: that???s not the error
[20:02:41] SteenJobs: busterarm: that???s a warning
[20:03:02] busterarm: it's that you're asking for stuff that you're not getting then
[20:03:03] SteenJobs: busterarm: and tokeninfo and amount shouldn???t be in strong params as they have nothing to do with jobs anyway
[20:03:16] SteenJobs: busterarm: right, it???s because the line with the time params isn???t receiving any jobs params
[20:03:33] SteenJobs: busterarm: and that???s because no job is being created, only a payment is - yet since they???re in the same action, it tries to create a job.
[20:03:35] busterarm: yeah that stuff would have to be passed up in the frontent
[20:03:38] busterarm: err frontend
[20:04:11] busterarm: one sec, just looking it over again to make sure that all happens before you create the job
[20:04:48] SteenJobs: busterarm: so i don???t think it does which i think might be the problem - the frontend doesn???t receive the payment callback until the create action is finished.
[20:05:22] wheeee: has joined #RubyOnRails
[20:05:37] busterarm: yeah but they should be sending up the requested date and all the job info before they actually make a payment for it, right?
[20:05:58] sinkensabe: has joined #RubyOnRails
[20:06:09] busterarm: or are you taking all that info in after confirmed payment?
[20:06:27] Lightsword: has joined #RubyOnRails
[20:06:55] JohnBat26: has joined #RubyOnRails
[20:06:56] SteenJobs: busterarm: open to anything, not sure exactly how i???d do the job part first on the front end, but i guess you???re saying maybe do Job.new, then process payment, then if payment processed, job.save
[20:07:10] busterarm: i guess what I mean is, i'm not seeing why that info doesn't come in the POST request that calls your create action
[20:07:46] busterarm: as long as you're supplying rails all that info in params and it has the code to initialize the job, it should be able to do it
[20:08:37] SteenJobs: busterarm: presumably because they only get passed if the createJob() method is called on the frontend. i tried calling it simultaneously with the payment req but it didn???t work.
[20:09:54] allcentury: has joined #RubyOnRails
[20:09:59] busterarm: i guess my confusion here is that in the create action of your Job is where it actually looks like the credit card is getting charged
[20:10:11] SteenJobs: busterarm: it is???
[20:10:31] SteenJobs: busterarm: everything is subject to change though?
[20:10:35] busterarm: but we're discussing as if it creates the job after the payment completes. Should we be saying saves instead?
[20:10:48] busterarm: or am I misunderstanding
[20:11:20] shpoont: has joined #RubyOnRails
[20:12:50] SteenJobs: busterarm: yea i guess. i think the problem is i need the create action to fire when a payment is being processed, and first process ONLY the payment. but when the create action is called, it runs the job creation part too. so maybe the only solution is 1) send job params and create NEW job object, 2) process payment, 3) save job.
[20:13:23] busterarm: yeah it's almost like a chicken and egg situation then though, and you have this really big controller
[20:13:32] busterarm: you might need a separate PaymentsController and JobsController
[20:15:06] SteenJobs: busterarm: right, because then i would have the same problem but in reverse, it would execute a new job but then would throw an error because there would be no payment params. chicken and egg.
[20:15:23] SteenJobs: busterarm: but then how would that work with two separate controllers? how would i make creating a job contingent on a successful payment?
[20:15:34] SteenJobs: busterarm: i???m totally open to that
[20:16:08] busterarm: i'm thinking one option would be that you land at a jobs page and when they make a payment it submits an AJAX request to your create action on payments
[20:16:35] busterarm: stores a token in the DB and fires that up to the browser which then needs to be submitted to successfully create the job
[20:17:35] busterarm: so you're validating that the payment token they send you is the same one you have in the db
[20:17:48] michael_mbp: has joined #RubyOnRails
[20:17:57] SteenJobs: busterarm: i mean i???d really rather not save an CC info, even said tokens in my db.
[20:18:12] kitsuneyo: has joined #RubyOnRails
[20:18:27] busterarm: was thinking the token would be a SecureRandom::urlsafe_base64 or something
[20:18:48] SteenJobs: busterarm: even so, risky business and liability storing that stuff.
[20:18:53] SteenJobs: busterarm: ugh i???ll give it some thought.
[20:19:00] busterarm: it's actually not the right solution
[20:19:06] busterarm: unless you're enforcing HTTPS
[20:19:09] davidheward_: has joined #RubyOnRails
[20:19:26] SteenJobs: busterarm i will be, but still. gotta use https anyway because of the sensitive data being transfered to my server and to stripe
[20:19:35] busterarm: well, actually with CSRF token in the form it should be fine
[20:19:46] SteenJobs: busterarm: but i???m surprised there isnt an easy solution, considering conditional actions based on payment is pretty common
[20:20:38] busterarm: that took a long time to wrap my head round :B sorry
[20:21:04] SteenJobs: no worries!
[20:21:13] nickenchuggets: has joined #RubyOnRails
[20:21:46] busterarm: the big problem actually what that suggestion I made is that if the payment goes through but for some reason the form doens't complete...
[20:21:58] workmad3: SteenJobs: https://www.masteringmodernpayments.com/ <-- that may be of some use to you
[20:22:19] busterarm: which leads me to think that you're right about firing off the payment in the create action for job...but they still might be best as separate controllers
[20:22:20] SteenJobs: workmad3: the problem is i???m using an angular frontend
[20:22:31] christiandsg: has joined #RubyOnRails
[20:22:37] workmad3: SteenJobs: it may still be of some use to you ;)
[20:22:40] busterarm: everyone shits on Backbone, but I never run into these kind of problems
[20:22:49] SteenJobs: workmad3: ha yea, possibly.
[20:23:14] busterarm: I just have to write tons of boilerplate and struggle with views -.-
[20:23:26] bronson: has joined #RubyOnRails
[20:23:28] busterarm: maybe once Marionette has better documentation for the new version
[20:23:51] workmad3: SteenJobs: I'd also recommend using the stripe.js payment path, so that your payment form submits directly to stripe with CORS... you'll still need to store some details in your db, but it's not full CC info, and you don't need to pass full CC info to your server either (which gets you out of a lot of PCI compliance issues)
[20:24:10] busterarm: ahh! that's a really good point
[20:24:10] SteenJobs: workmad3: i???m not saving any info with my current implementation
[20:24:15] SteenJobs: workmad3: i???m using stripe checkout
[20:24:20] SteenJobs: workmad3: pretty much takes care of all that
[20:24:21] workmad3: SteenJobs: you *have* to save some info
[20:24:31] SteenJobs: workmad3: not really. all i save is a customer.id
[20:24:46] SteenJobs: workmad3: even the saved CC info is on stripe???s server
[20:24:46] busterarm: hope that you never have to issue a refund
[20:24:55] SteenJobs: busterarm: refund is pretty easy
[20:25:05] workmad3: SteenJobs: no, I don't mean in a technical sense... I mean you *have* to save some transaction details for legal audit-trail reasons
[20:25:19] SteenJobs: workmad3: stripe saves all of it
[20:25:24] workmad3: SteenJobs: you can't rely on stripe for it
[20:25:29] workmad3: SteenJobs: you need to keep your own records
[20:25:35] SteenJobs: workmad3: on their servers, i can see all of it in my dashboard.
[20:25:39] SteenJobs: workmad3: aright so they have an export feature
[20:25:46] busterarm: what if they lose disks
[20:25:47] workmad3: SteenJobs: right... and what if they go down in the middle of you being audited
[20:25:49] busterarm: data loss happens
[20:26:02] SteenJobs: so we export regularly?
[20:26:16] workmad3: SteenJobs: and what if they then loose the last week/day/hour between exports?
[20:26:24] SteenJobs: what if i lose it?
[20:26:38] busterarm: i've worked at financial companies who have data retention compliance requirements and we found out that none of our backups were working correctly for 9 months
[20:26:42] sinkensabe: has joined #RubyOnRails
[20:27:05] workmad3: SteenJobs: that could happen... at which point you can then recover from stripe's data as an offsite backup
[20:27:22] workmad3: SteenJobs: but you're responsible for maintaining the offsite backup of your data from their platform too ;)
[20:27:31] busterarm: the thing is, if somebody's suing you and somehow Stripe doesn't have those specific records, they're not going to shed a single tear and you're going to lose
[20:27:37] SteenJobs: workmad3: with that logic it becomes a reductio. so should i create a backup, of my backup, of my backup, ad infinitum?
[20:27:39] busterarm: and if it's a small data loss they can claim due diligence
[20:27:43] workmad3: SteenJobs: and then you just need to decide whether the risk of both going down at the same time is worth it
[20:27:53] workmad3: SteenJobs: it's risk mitigation, not perfect risk removal
[20:28:01] SteenJobs: aright, i???ll let the other guys worry about this stuff. my job is to implement stripe.
[20:28:10] workmad3: SteenJobs: chance of 2 unrelated services going down at the same time is much lower than a single third party service going down
[20:28:35] workmad3: SteenJobs: as busterarm said, if they lose your data, they probably don't care too much... it's *your* ass on the line legally
[20:28:45] busterarm: everyone I know in the mobile payments game today is in love with vantiv all of a sudden
[20:29:35] workmad3: SteenJobs: also, for all I know, there could be PCI regulations about needing to maintain your own records outside of any third-party processing too
[20:29:47] workmad3: ok, must run :)
[20:29:48] SteenJobs: i???ll look into it
[20:29:51] SteenJobs: peace brother
[20:30:08] busterarm: i recently interviewed for two different companies doing payments
[20:30:13] workmad3: SteenJobs: that book should go over the relevant parts of PCI (although I can't confirm... it's on my to-read list)
[20:30:28] busterarm: and first they weren't storing any data and then were making a huge push to store the data they needed to
[20:30:36] busterarm: it's pretty hard to fix later
[20:31:18] busterarm: once payment backends are done and working you don't really want to change them :)
[20:35:05] SteenJobs: busterarm: i might have a solution, if it works you wanna take a quick look?
[20:35:07] drale2k: has joined #RubyOnRails
[20:35:37] busterarm: i'm doing absolutely nothing for a week until my contract starts (though I should be watching SGDQ!)
[20:35:59] sypheren: has joined #RubyOnRails
[20:36:25] shanson: has joined #RubyOnRails
[20:37:03] willywos: has joined #RubyOnRails
[20:38:51] nya: has joined #RubyOnRails
[20:39:09] nya: has joined #RubyOnRails
[20:39:11] Gabriel403: has joined #RubyOnRails
[20:39:11] Gabriel403: has joined #RubyOnRails
[20:39:28] arup_r: what is SGDQ?
[20:40:02] {756d6f}: has joined #RubyOnRails
[20:40:06] busterarm: Summer Games Done Quick
[20:40:13] busterarm: people speedrun and raise a lot of money for charity
[20:40:26] busterarm: it's a week long, 24 hours
[20:40:39] busterarm: i usually donate, but I'm broke
[20:41:58] aevitas: has joined #RubyOnRails
[20:42:34] Papierkorb: busterarm: is trihex still running?
[20:42:55] iateadonut: has joined #RubyOnRails
[20:43:01] busterarm: some sonic game
[20:43:05] busterarm: (i hate sonic games)
[20:43:19] _puddy: has joined #RubyOnRails
[20:44:15] VeryBewitching: has joined #RubyOnRails
[20:44:32] ktchup: has joined #RubyOnRails
[20:46:02] zpe: has joined #RubyOnRails
[20:47:24] xMopxShell: has joined #RubyOnRails
[20:47:29] chridal: has joined #RubyOnRails
[20:48:02] sinkensabe: has joined #RubyOnRails
[20:48:51] aevitas: has joined #RubyOnRails
[20:49:24] Papierkorb: Firefox not only auto-fills inputs, no, it also persists the disabled property. Genius browser. Uargh.
[20:49:41] Papierkorb: How on earth do I now force it to be not disabled at first through HTML?
[20:49:53] towski_: has joined #RubyOnRails
[20:49:57] tuelz: has joined #RubyOnRails
[20:50:19] Trynemjoel: has joined #RubyOnRails
[20:52:16] Oog: has joined #RubyOnRails
[20:55:04] thsig: has joined #RubyOnRails
[20:55:25] markholmes: has joined #RubyOnRails
[20:56:41] drale2k_: has joined #RubyOnRails
[20:56:54] Papierkorb: Would it be a good or bad idea to measure time taken to process a 'request' in a controller spec for speed analysis and to have some kind of trigger which warns when a call takes too long?
[20:58:17] busterarm: why not just log it and look at it later?
[20:58:29] thsig_: has joined #RubyOnRails
[20:58:35] busterarm: benchmarking is fine, IMO
[20:58:53] Papierkorb: Having the test suite yelling at you helps fixing issues early
[20:59:35] Papierkorb: Doesn't even have to be perfect, just to uncover general stupid mistakes. Not to replace production diagnostics of sorts
[21:00:00] Rubie: has joined #RubyOnRails
[21:01:06] annlewis: has joined #RubyOnRails
[21:02:07] kham: has joined #RubyOnRails
[21:02:45] eggoez: has joined #RubyOnRails
[21:03:37] diegoviola: has joined #RubyOnRails
[21:03:55] bin_005: has joined #RubyOnRails
[21:03:56] SteenJobs: busterarm: is there a way to get a variable to persist across multiple executions of the create action?
[21:04:23] SteenJobs: busterarm: basically first time create is executed, create a NEW job, then second time it???s executed, when payment is processed, SAVE the previous created job
[21:05:20] pkrnj: has joined #RubyOnRails
[21:05:24] sarink: has joined #RubyOnRails
[21:05:26] atmosx: has joined #RubyOnRails
[21:05:40] busterarm: I don't want to say no, but the whole point of REST is that it's stateless
[21:05:59] busterarm: your server shouldn't be retaining state between requests
[21:06:11] SteenJobs: busterarm: right but the only other option is combining the payment and job request
[21:06:23] busterarm: i'd say use cookies at that point
[21:06:42] bmurt: has joined #RubyOnRails
[21:06:58] SteenJobs: busterarm: i feel like that could open up more potential security holes so would like to avoid it if possible.
[21:07:00] busterarm: shopping carts do it1
[21:07:07] SteenJobs: yea but not with CC info
[21:07:15] SteenJobs: then if someone gets someone elses cookie, they can charge their CC
[21:07:19] nobitanobi: has joined #RubyOnRails
[21:07:31] busterarm: you don't need to save CC info, you just need to verify a secure token
[21:07:44] busterarm: + CSRF token
[21:07:58] busterarm: CSRF mitigates the cookie issue
[21:08:18] busterarm: and ideally the cookie wouldn't allow them to charge the card, it would allow them to create the job
[21:08:24] kahuna_: has joined #RubyOnRails
[21:08:34] busterarm: token would be on completion of a successful transaction - card has already been charged
[21:11:18] pontiki: has joined #RubyOnRails
[21:12:36] SteenJobs: busterarm: basically i wanted to create a new job when the modal popup opens, and then save the job if payment is received.
[21:12:50] SteenJobs: busterarm: my problem is the newly created job obviously doesn???t persist so i can???t then save it upon payment
[21:13:25] r4pha: has joined #RubyOnRails
[21:16:02] nickenchuggets: has joined #RubyOnRails
[21:16:07] aevitas_: has joined #RubyOnRails
[21:17:22] Radar: GOOD MORNING
[21:18:40] busterarm: yeah i think unavoidably you're making two separate POST requests from the client
[21:18:44] busterarm: for the job and the payment
[21:19:25] SteenJobs: busterarm: right
[21:19:27] idd2d_: has joined #RubyOnRails
[21:19:36] SteenJobs: busterarm: but it seems like such a common use case!
[21:19:48] bruno-: has joined #RubyOnRails
[21:19:59] busterarm: one of those would have to be an AJAX request (if you want a good user experience)
[21:20:02] SteenJobs: it would be so much easier if i could just have the conditional for creating a new job in the front end.
[21:20:21] SteenJobs: busterarm: i???m using angular, don???t worrry about that.
[21:20:31] kitsuneyo: has joined #RubyOnRails
[21:21:35] sinkensabe: has joined #RubyOnRails
[21:21:50] Papierkorb: Radar: OOHHAAAYOOOOOO
[21:22:09] Papierkorb: Radar: where are you that it's morning at your place?
[21:22:13] Papierkorb: It's almost midnight here
[21:22:36] Radar: Papierkorb: Melbourne, Australia
[21:22:54] Radar: It's 7:30am here and I'm about to do some updates to Multitenancy with Rials.
[21:23:00] sinkensabe: has joined #RubyOnRails
[21:23:20] SteenJobs: busterarm: maybe i need to combine them into a single post req
[21:23:44] SteenJobs: Radar: you ever use stripe and condiitonally execute an action based on payment success?
[21:24:02] Radar: SteenJobs: if payment.success?
[21:24:07] kitsuneyo: has joined #RubyOnRails
[21:24:13] Radar: or I guess Stripe calls them charges, so if charge.success?
[21:24:17] SteenJobs: Radar: ha c???mon, you know that???s obvs not my question.
[21:24:18] Radar: SteenJobs: I am not understanding what is complex here
[21:24:24] SteenJobs: Radar: apparently!!
[21:25:16] SteenJobs: Radar: i want to create a ???job??? if payment is successful. however, there are two sets of params, one for payment and one for jobs. if both the payment and job creation are in the same controller, the params of at least one of them will be missing when the post req is made.
[21:25:18] baweaver: has joined #RubyOnRails
[21:25:36] SteenJobs: Radar: so basically payment makes a post req, and the create action throws because the job params aren???t present. or vice versa
[21:25:40] Radar: I can't help you right now.
[21:29:39] redmaverick: has joined #RubyOnRails
[21:30:04] christiandsg: has joined #RubyOnRails
[21:30:36] redmaverick: How do I structure my Ruby project which is not a Rails one
[21:30:43] redmaverick: it is not a gem
[21:30:52] Trynemjoel: has joined #RubyOnRails
[21:31:26] busterarm: that's another option
[21:32:04] busterarm: you can just return out of the job controller with some error data to the frontend if the payment fails
[21:32:08] busterarm: don't process the rest of it
[21:32:16] SteenJobs: tried that already???.and then what?
[21:32:48] weaksauce: redmaverick perhaps similar to a gem folder structure?
[21:33:54] redmaverick: weaksauce: so I can use bundle gem myproject? Is this the regular way of doing things
[21:34:07] redmaverick: for non gem projects as well
[21:34:08] kitsuneyo: has joined #RubyOnRails
[21:34:19] busterarm: lib, spec, bin, doc folders are a common pattern
[21:34:20] antlong: has left #RubyOnRails: ("Textual IRC Client: www.textualapp.com")
[21:36:01] weaksauce: yeah just a good way to organize it. you don't need to make it a gem though
[21:37:06] redmaverick: ok.. thanks..
[21:37:09] redmaverick: has left #RubyOnRails: ()
[21:37:30] Papierkorb: Is there btw a redis mock which simulates a redis instance in-process for tests?
[21:38:30] busterarm: fakeredis, mock_redis
[21:39:03] Procule: has joined #RubyOnRails
[21:39:24] Papierkorb: busterarm: Hah. That one was easy. thanks
[21:40:10] busterarm: no promises as to quality
[21:40:21] Procule: Hi everyone, I have what I think is a simple question but I can't find the correct answer out of google
[21:40:34] fryguy9: has left #RubyOnRails: ()
[21:40:56] fryguy: has joined #RubyOnRails
[21:41:24] busterarm: i've never had a use case that required speed over reliability...so for anywhere I'd use Redis, there's Postgres
[21:41:51] territorial: has joined #RubyOnRails
[21:42:39] chipotle: has joined #RubyOnRails
[21:43:40] Procule: I want to process data on-the-fly with a template but it's not related to a database per se, it's data coming out of Elasticsearch. I want to update the browser with the current status of the importation of millions of lines. What I have now is the streaming but it only append the html. I would want something like ANSI code but on the browser.
[21:45:27] busterarm: that sounds like needing WebSockets
[21:45:41] Procule: I would something like: "Rendered #{nbentries}" changing a percentage of the whole job
[21:46:12] busterarm: do you know the limit before hand?
[21:46:25] busterarm: or are you going to get X amount of data?
[21:46:48] zpe: has joined #RubyOnRails
[21:47:05] Procule: are you asking me, busterarm ?
[21:48:15] Procule: the limit is not important, but it is in the millions. First, I would parse a file and load it into an array and then import the array to Elasticsearch
[21:48:24] ProLoser: has joined #RubyOnRails
[21:48:38] Procule: I would want a way to tell the user the progress
[21:48:44] christiandsg: has joined #RubyOnRails
[21:48:58] busterarm: what I'm asking is, is your browser getting that data in a stream or in one big chunk?
[21:49:27] busterarm: or is that all happening on the backend?
[21:49:34] busterarm: (what you mentioned)
[21:49:48] Procule: From what I have already here, the action to upload the file is made
[21:50:15] Procule: It's the parsing after that, which is yes, backend job
[21:51:10] [H]unt3r: has joined #RubyOnRails
[21:51:15] Procule: actually, all the app is working in the backend, i'm trying to get an "update" for the browser for the user
[21:51:20] busterarm: then you would need a websocket and also some way for the backend to know how much of the job is complete
[21:51:49] earthquake: has joined #RubyOnRails
[21:51:55] busterarm: you don't have a persistent connection between the client and server unless you've set up a socket.
[21:52:22] busterarm: probably a lot of work for the feature that you want
[21:52:36] Hates_: has joined #RubyOnRails
[21:52:49] Procule: do you know what is elasticsearch ?
[21:53:09] pjbugz: has joined #RubyOnRails
[21:53:30] Procule: I'm using their ruby gem for the importation
[21:53:52] Procule: but, as you know, it blocks the main thread
[21:54:45] Procule: that, I will figure out with the bulk_update function
[21:55:16] Procule: it's a two problems in one
[21:55:16] bruno-: has joined #RubyOnRails
[21:55:35] Procule: first thing, I parse the file uploaded, which is a CSV
[21:55:53] Procule: second, I import the data to elasticsearch
[21:56:16] Procule: I would want the user to see the progress of both
[21:56:31] Procule: and don't get a timeout out of the reverse proxy
[21:56:43] busterarm: yeah i'm saying you have no way to get that data to the browser unless there's a connection between them
[21:57:05] robbyoconnor: has joined #RubyOnRails
[21:57:06] Procule: I understand you
[21:57:34] Procule: but let's get into the first thing I want
[21:57:40] Procule: I parse a big csv
[21:57:49] Procule: with the CSV gem
[21:58:18] pjbugz: has joined #RubyOnRails
[21:58:45] pjbugz: Anyone know why the API docs aren't actually those for 4.2.3?
[21:58:51] pjbugz: They say they are, but they're not.
[21:58:55] Procule: I guess it's something quite simple to update the browser with but my template is still waiting for the end of the each. loop
[21:59:08] pjbugz: All of the new AR association stuff hasn't been updated.
[21:59:13] nofxx: has joined #RubyOnRails
[21:59:13] nofxx: has joined #RubyOnRails
[22:00:01] busterarm: well, the response to the broser request only gets processed and sent at the end
[22:00:15] Hates_: pjbugz: which association stuff?
[22:00:27] busterarm: there may be something you can cludge together with EventMachine
[22:00:36] busterarm: and EM-WebSockets
[22:00:41] bruno-: has joined #RubyOnRails
[22:00:47] t_mmyv: has joined #RubyOnRails
[22:00:53] pjbugz: Hates_: The way @associations works has been completely changed to be more consistent.
[22:01:04] pjbugz: Hates_: Type casting has been completely re-written.
[22:01:06] Hates_: Procule: Why not just show the user a "Processing..." page?
[22:01:06] busterarm: oooh interesting, i'll have to look at that
[22:01:14] Procule: busterarm, that I know. That's why i'm wondering how to update the template after rendering like with calls with jquery or something like that
[22:01:45] Hates_: Procule: put the job in a background process and send them to a page which just polls a url with jquery until it's finished, then redirect
[22:01:52] annlewis: has joined #RubyOnRails
[22:02:06] busterarm: i'm just going to stop saying that you can't do it
[22:02:39] Procule: Hates_, it looks what I want to do
[22:03:05] SteenJobs: has joined #RubyOnRails
[22:03:27] pjbugz: I see that http://apidock.com/rails/ActiveRecord/AttributeSet mentions it, but nothing there. Maybe the docs are yet to be written?
[22:03:47] Procule: Hates_, so I send the job background with "proc" but how do I get feedback from it ?
[22:03:59] pjbugz: Actually (stoopid me), there appears to be no comments whatsoever in all the new code! That could explain it!
[22:05:21] Hates_: Procule: no you would use a background processor like delayed job or resque
[22:05:46] annlewis_: has joined #RubyOnRails
[22:06:00] bruno-: has joined #RubyOnRails
[22:06:53] busterarm: you can't get feedback to the user unless you have a socket
[22:07:07] Hates_: busterarm: or if your page polls with ajax
[22:07:12] Radar: pjbugz: Comments? In Rails code? lol
[22:07:19] michael_mbp: has joined #RubyOnRails
[22:07:36] Procule: Delayed::Job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background.
[22:07:41] busterarm: Hates_: that's probably worse than a socket, imo
[22:07:52] Procule: It looks like what I'm looking for
[22:08:05] pjbugz: Radar: Realising this ;-)
[22:08:24] Procule: thanks Hates_ I'm going to try that
[22:08:49] Hates_: busterarm: yeah, websockets are better, but I don;'t know what their support is like in all browsers
[22:08:59] Procule: I'm quite new to rails so I thought there was already something for that
[22:09:06] busterarm: yeah it's not going to work if you need like...IE6/7
[22:09:10] busterarm: and mobile Opera
[22:09:32] Procule: busterarm, IE6 is awesome. don't dare tell me otherwise
[22:09:35] busterarm: making ajax requests on a timed loop could get really messy
[22:09:37] Hates_: I thought IE8/9 don't support it, unless there are shims for it?
[22:09:46] busterarm: there's shims
[22:09:59] busterarm: at least, i was told there were :P
[22:10:02] busterarm: i didn't go look for mysef
[22:10:09] Hates_: "I was told there would be shims!"
[22:10:16] IceyEC: has joined #RubyOnRails
[22:10:22] Hates_: shrimps in Radar's case
[22:10:30] Procule: and, as a last question
[22:10:58] Procule: could Elasticsearch API be integrated with ActiveRecord ?
[22:11:26] busterarm: https://github.com/elastic/elasticsearch-rails ?
[22:11:36] Procule: yes that's what I use
[22:11:40] glennt: has joined #RubyOnRails
[22:12:29] fighella: has joined #RubyOnRails
[22:12:50] christiandsg: has joined #RubyOnRails
[22:13:27] busterarm: oh, you're indeed right Hates_
[22:13:30] busterarm: no 8/9 support at all
[22:14:01] busterarm: which is a real shame, because the other unsupported browsers are irrelevant
[22:14:40] djbkd: has joined #RubyOnRails
[22:14:49] busterarm: there's always Flash! (ew)
[22:14:59] Procule: but who develops application for browsers like IE ? In a intranet environment at least
[22:15:11] cornerman: has joined #RubyOnRails
[22:15:22] busterarm: IE 8 and 9? Companies that have customers
[22:15:41] shock_one: has joined #RubyOnRails
[22:15:49] Procule: customers are out of the intranet
[22:15:54] busterarm: and corproate intranets are the most common source of machines that aren't up to date
[22:15:58] Hates_: then you're lucky :P
[22:16:06] Procule: I don't even allow IE in my company
[22:16:19] Hates_: ACTION had to fire up vms with IE7/8/9/10/11 today for testing
[22:16:37] busterarm: 10 and 11 are actually pretty good
[22:17:10] busterarm: I wish Firefox's dev tools were on par with Chrome so I could stop using this pos
[22:17:18] Procule: tell that to the corporate intranet web developer
[22:18:36] busterarm: why not do the CSV upload on the client?
[22:18:55] busterarm: there's a javascript client
[22:19:06] Procule: and then stream it to the server ?
[22:19:26] yfeldblum: has joined #RubyOnRails
[22:20:24] Procule: well, the questions I had when I came here was about handling streaming from the server to the client
[22:20:38] busterarm: do you absolutely need to save everything in the CSV?
[22:20:49] Procule: do I really want to handle streaming from the client to the server ?
[22:21:06] tejasmanohar: has joined #RubyOnRails
[22:21:08] Procule: yes, it's a one time job each month
[22:21:34] Procule: I'm developing something to help the finance girl for her report she was doing in Excel
[22:21:52] Procule: which is taking about 2 days right now
[22:22:06] Procule: with 1 day and a half of waiting for processing
[22:22:07] Hates_: Why do they care if they know that it's still processing or not
[22:22:29] busterarm: Hates_: you don't want them to close the browser before it's sent the server the request
[22:22:32] TheNet: has joined #RubyOnRails
[22:22:38] Procule: Hates_, first, I don't want to hit the timeout
[22:22:42] Hates_: busterarm: but that' sjust a file upload issue
[22:22:54] TheNet: What's recommended way to modify the devise controllers?
[22:22:56] Procule: no, the file is uploaded file
[22:23:00] busterarm: oh..._YEAHA_
[22:23:02] Hates_: once it's uploaded they don;t need to know what's happening
[22:23:10] busterarm: Hates is exactly right
[22:23:32] busterarm: you just start a background job and if they try and come back to the page just tell them it's not done processing yet
[22:23:33] Procule: you are thinking like people like me, not like an accountant
[22:23:34] Hates_: they can go about their business then at some point the new results will show up in search
[22:24:01] Hates_: Procule: you just display "Your file is now processing. It can take up to X hours for results to appear"
[22:24:09] busterarm: well, it's taking the accountant 3 and a half days right now
[22:24:19] Procule: I understand Hates_
[22:24:27] busterarm: if you tell them they need to wait an hour, they'll be thrilled
[22:24:51] Procule: but she needs to post-process the data right after the file is processed by elasticsearch
[22:24:52] Hates_: Just start with the easiest solution first. No point developing the best thing if it turns out a flash message was enough.
[22:24:59] busterarm: if you tell them they need to wait an hour and it _actually_ takes 5 minutes, they'll be ecstatic
[22:25:05] Procule: she's supposed to do it in 4 hours
[22:25:18] Hates_: Procule: yeah, so then in your other job that kicsk off importing it just emails her when it's done
[22:25:32] Hates_: Procule: no one is going to sit with their browser open for a few hours
[22:25:33] Procule: well, Hates_
[22:25:46] Procule: never thought of that but it's a good idea
[22:26:16] Procule: process the data.... send a link by email with the pdf when it's done
[22:26:24] Procule: looks good
[22:27:18] Procule: I think I'm being too "user friendly"
[22:27:32] Craiga_: has joined #RubyOnRails
[22:28:46] Procule: wow, actually that's exactly what's i'm going to do.
[22:29:04] Procule: maybe with the progress on the page with the delayed_job
[22:29:11] Procule: thanks a lot Hates_
[22:29:18] Radar: people still use delayed job?
[22:29:36] drale2k_: when i use format.csv in a respond_to block ,i get an "ActionController::UnknownFormat" error. Is this no longer supported ?
[22:29:38] Procule: I shouldn't ?
[22:29:43] Radar: I'm joking ;) My company only switched to Sidekiq last week.
[22:29:46] Radar: Procule: It can be slow at times.
[22:30:14] Procule: Sidekiq is in Rails 4
[22:30:41] Procule: I'm at page 65 of "The Rails 4 Way"
[22:31:06] Radar: Sidekiq isn't tied to Rails at all.
[22:31:12] Procule: i'm made a lot of ruby scripts but never with a framework
[22:31:23] Procule: well one app with Sinatro
[22:31:26] busterarm: in all honesty, emailing them when the job is done is actually a much better user experience than them sitting in front of their browser waiting for a few minutes
[22:31:32] busterarm: even if their current process is taking 4 days
[22:32:31] Procule: just for the show, (sinatra hint), busterarm, do you know Excel can't handle more than 2^31 rows ?
[22:33:20] Procule: she has to separate the file in multiples .csv
[22:33:23] doodlehaus: has joined #RubyOnRails
[22:33:39] Procule: and handle them separetly with her formulas
[22:33:47] busterarm: do you know that just putting a single character into cell IV65536 puts the page count up to 38,019?
[22:33:57] theery: has joined #RubyOnRails
[22:34:07] Procule: hahaha, no
[22:34:23] Procule: but i'm not surprised
[22:34:55] busterarm: In Excel 2007 - the bottom right cell reference is XFD1048576 - equates to 17,179,869,184 cells per sheet
[22:34:58] busterarm: (about 2.5 times the number of people on the earth) (6,767,908,320 being approximately the number of people on the earth)
[22:35:00] busterarm: Printing the whole sheet at 100% would use 38,190,012 pages (not sure how many toner cartridges that would be!!)y
[22:35:09] Procule: so when the accountant asked us for a better way to handle her data, I was like "of course, there are better ways !"
[22:36:12] Procule: and well, I'm really into ruby for server scripts so I decided that the "rails way" would be appropriate
[22:40:16] jfarmer: has joined #RubyOnRails
[22:40:31] fgo: has joined #RubyOnRails
[22:42:07] Procule: Hates_, what about Sidekiq instead of delayed_job ?
[22:42:26] Hates_: Procule: Sidekiq is good :)
[22:42:36] Procule: would it do what I want ?
[22:43:06] Hates_: Procule: yeah, it does background jobs. Sidekiq and Resque are both Redis based, where as delayed_job uses your existing database
[22:43:43] Procule: well, that's the 'thing', I don't use a database
[22:43:50] Procule: related to ActiveRecord
[22:44:48] workmad3: busterarm: approx 10,000 toner cartridges for b&w laser printing
[22:45:20] wethu: has joined #RubyOnRails
[22:45:30] Procule: if someone does that at the office....
[22:45:47] workmad3: Procule: I'd love to see the stationary expenses report for that :D
[22:46:57] workmad3: "Why did we spend half a million on laser toner cartridges this month?"
[22:48:12] Procule: my question would be "Who the hell replaced for a half a million laser toner cartridges this month?"
[22:48:41] Rubie: has joined #RubyOnRails
[22:48:56] workmad3: Procule: oh wait... that cost could be spread over the almost 4 years it would take to print that at 20ppm :D
[22:48:58] weaksauce: how much processing does this excel spreadsheet need Procule
[22:49:02] TheNet: has joined #RubyOnRails
[22:49:36] JeramyRR: has joined #RubyOnRails
[22:49:46] sinkensabe: has joined #RubyOnRails
[22:49:50] Procule: weaksauce, not a lot. I only have to insert each lines into the Elasticsearch node
[22:50:12] Procule: create a class, create a json output and voila
[22:51:28] Procule: after that, I can call Elasticsearch for the queries I need and it's instanteous
[22:51:30] weaksauce: nice they were doing it by hand before?
[22:52:34] Procule: with Excel and they have to separate the csv's so that not more than 2^31 lines is imported
[22:52:51] Procule: about 2 millions
[22:53:26] sarink: has joined #RubyOnRails
[22:54:52] leesharma: has joined #RubyOnRails
[22:55:07] calleerlandsson: has joined #RubyOnRails
[22:58:45] diegoviola: I've created a blog, I want to add a feature for following users and receive notifications, etc, how do I go into doing that? :P
[22:58:57] sankaber: has joined #RubyOnRails
[22:59:29] workmad3: diegoviola: by writing code...
[23:01:38] diegoviola: right, I'll leave that for later
[23:01:42] diegoviola: that feature
[23:02:12] imkj: has joined #RubyOnRails
[23:02:30] diegoviola: I can't think of how I'd wrote that atm
[23:02:38] Radar: Receiving notifications for hwat?
[23:04:02] SteenJobs: has joined #RubyOnRails
[23:04:03] arBmind1: has joined #RubyOnRails
[23:04:31] diegoviola: Radar: when a user follows another user
[23:04:33] SteenJobs: does calling head :ok count as a render?
[23:05:07] workmad3: SteenJobs: yes
[23:05:15] SteenJobs: that would explain things. thanks.
[23:05:28] workmad3: SteenJobs: anything that sends a response back to the browser counts as a 'render'
[23:05:50] SteenJobs: workmad3: yea i was getting render being called multiple times error and couldn???t locate where that would logically occur, but if head does then that makes sense
[23:06:11] tuelz: has joined #RubyOnRails
[23:07:17] NodeNagant: has joined #RubyOnRails
[23:09:06] leesharma: has joined #RubyOnRails
[23:11:44] n1lo: has joined #RubyOnRails
[23:12:10] pontiki: has joined #RubyOnRails
[23:12:26] IceyEC: has joined #RubyOnRails
[23:12:26] djbkd: has joined #RubyOnRails
[23:14:46] pontiki: has joined #RubyOnRails
[23:15:25] p8m: has joined #RubyOnRails
[23:15:31] Lightsword: has joined #RubyOnRails
[23:15:41] deavidsedice: has joined #RubyOnRails
[23:17:06] Mendenhall: has joined #RubyOnRails
[23:17:18] pontiki: has joined #RubyOnRails
[23:18:52] baweaver: has joined #RubyOnRails
[23:20:14] sinkensabe: has joined #RubyOnRails
[23:21:14] pontiki_: has left #RubyOnRails: ()
[23:21:29] dustinm`: has joined #RubyOnRails
[23:26:34] GreatDanton: has joined #RubyOnRails
[23:28:11] yfeldblum: has joined #RubyOnRails
[23:28:40] diegoviola: has joined #RubyOnRails
[23:30:12] fryguy: has joined #RubyOnRails
[23:31:40] renegadeandy: has joined #RubyOnRails
[23:32:00] renegadeandy: Hi everyone - when i deploy to heroku and run rake db:seed I am getting : NameError: uninitialized constant Integer::MAX -- but it doesnt happen locally? Why?
[23:32:22] christiandsg: has joined #RubyOnRails
[23:34:48] JeramyRR: has joined #RubyOnRails
[23:35:35] zpe: has joined #RubyOnRails
[23:35:37] CanTonic: renegadeandy: where is Integer::MAX defined? I assume it is from a gem that you are requiring in development or test mode.
[23:35:55] CanTonic: and since your heroku deployment is in production mode, it cannot find it
[23:35:58] Radar: renegadeandy: stacktrace or ban
[23:36:03] Radar: oops sorry I meant "kittens" typo sorry
[23:36:23] thsig: has joined #RubyOnRails
[23:37:21] fighella: has joined #RubyOnRails
[23:37:51] renegadeandy: https://gist.github.com/renegadeandy/2429458ca459a39583ed
[23:38:45] Radar: What is the maximum integer?
[23:39:12] renegadeandy: What do you mean?
[23:39:18] renegadeandy: its a constant..
[23:39:28] Radar: What is the biggest number you can think of?
[23:39:51] Radar: My real guess is that you're using a different version of Ruby locally to what Heroku is using.
[23:40:03] Radar: And that you should probably just set maximum_age to be something sensible like 150.
[23:40:34] thsig_: has joined #RubyOnRails
[23:40:38] renegadeandy: Radar: thats a different solution! I am fairly certain the ruby versions should be the same
[23:40:47] renegadeandy: 2.2.2 locally
[23:40:51] thsig_: has joined #RubyOnRails
[23:41:00] renegadeandy: ruby "2.2.2" is in my gemfile
[23:41:19] Radar: Then I am out of ideas that aren't "don't use Integer::MAX"
[23:41:29] CanTonic: where is Integer::MAX defined?
[23:41:42] Radar: https://bugs.ruby-lang.org/issues/7517
[23:41:53] Radar: It's supposed to be a feature in Ruby but it doesn't work in my Ruby 2.2.2.
[23:42:54] RegulationD: has joined #RubyOnRails
[23:43:38] VeryBewitching: Doesn't work in my 2.2.2 either.
[23:43:44] CanTonic: I am running 2.2.0 and also don't have it
[23:43:45] renegadeandy: then how is it working locally :/
[23:43:52] Radar: renegadeandy: ruby -v plz
[23:44:02] Radar: renegadeandy: also: steps to reproduce it working
[23:44:07] VeryBewitching: Also: which ruby
[23:45:36] IceyEC: has joined #RubyOnRails
[23:46:09] renegadeandy: nope it is indeed not working for me locally. Interesting. I am amazed that a max int constant does not work in ruby. wth. Ill use a sensible alternative, but that isnt really a solution...why has it taken so long to get that fixed :/
[23:46:35] Radar: Get what fixed?
[23:46:38] Aeyrix: > asked one simple question
[23:46:44] Aeyrix: > ignored it and typed a paragraph
[23:46:47] Aeyrix: troll in the dungeons
[23:47:01] Radar: ACTION whacks Aeyrix 
[23:47:15] Aeyrix: Remember like
[23:47:16] Aeyrix: last week
[23:47:18] Radar: If he can't reproduce it then ruby -v is useless.
[23:47:24] Aeyrix: when you were pissed as fuck at people not following simple instructions?
[23:47:32] _lexjm: has joined #RubyOnRails
[23:47:36] Radar: Aeyrix: Yeah but this is a new week and I just had a whole weekend to calm down
[23:47:38] Aeyrix: Today it's my turn. <_<
[23:47:45] Aeyrix: Yeah I didn't. I was travelling.
[23:47:53] Radar: Aeyrix: I thought you were taking today off anyway?
[23:48:00] Aeyrix: I'll explain that shortly
[23:48:42] renegadeandy: Radar: fix the fact that Integer::MAX does not work..
[23:49:00] Radar: renegadeandy: What do you expect it to return?
[23:49:13] Radar: 3054936363499604682051979393213617699789402740572326663893613909281291626524720457?
[23:49:25] Radar: But that's not the max
[23:49:32] Radar: and neither is that +1
[23:49:41] Radar: So use a sensible default like 150.
[23:49:49] Aeyrix: To clarify
[23:49:56] Aeyrix: Fixnun::MAX was removed in about 2.0.
[23:50:08] renegadeandy: well other languages have a value....whatever that value is, its the max value an int object can represent, its ludicrous that it doesnt here
[23:50:19] yifengzhao: has joined #RubyOnRails
[23:50:24] Radar: renegadeandy: Totally ludicrous that you expect Ruby to be like other languages!
[23:51:05] yifengzhao: has left #RubyOnRails: ()
[23:51:18] renegadeandy: Radar: I am amazed. Obviously you are right i am wrong and it makes no sense for a language to have a maxint value. jesus.
[23:51:49] Radar: renegadeandy: I don't understand how you don't see it's more sensible to store a *real* number there rather than an imaginary one
[23:52:02] Radar: You could even store `nil` and have no maximum and instead just verify that the age is over a particular number
[23:52:21] Radar: I've given two solutions which I think are more sensible than Integer::MAX.
[23:52:54] VeryBewitching: http://stackoverflow.com/questions/535721/ruby-max-integer
[23:53:17] renegadeandy: Radar: and they are more sensible. My problem is that i find it crazy that there is no way to find the maximum value that can be stored in an int object in ruby, as a constant!
[23:53:50] Radar: http://stackoverflow.com/questions/535721/ruby-max-integer
[23:54:04] Radar: oh VeryBewitching wins
[23:54:22] Aeyrix: I could've told you this lmao
[23:54:31] Aeyrix: I was under the assumption it was common sense
[23:54:47] VeryBewitching: One Google search
[23:54:53] Radar: Aeyrix: No, not common apparently. Other languages do it and for Ruby to not do it is sacrilege.
[23:55:20] michael_mbp: has joined #RubyOnRails
[23:55:29] Radar: Just like how Ruby is a mutable language. FP purists love to get up in arms about that.
[23:55:40] Radar: And don't start them on the type checking.
[23:55:48] VeryBewitching: Ruby should have some kind of abstraction that calculates the min/max value addressable by it's numeric types at runtime.
[23:55:51] Aeyrix: being an Elixir fanboi
[23:56:02] VeryBewitching: But.. it doesn't seem to, so, life goes on
[23:56:08] Radar: Aeyrix: Elixir is the least worst functional programming language I've tried.
[23:56:15] renegadeandy: VeryBewitching: I am happy with that conclusion
[23:56:23] renegadeandy: Radar: sensible alternative adopted - thank you
[23:56:30] Radar: Thanks renegadeandy
[23:56:50] fgo: has joined #RubyOnRails
[23:57:52] SteenJobs: has joined #RubyOnRails
[23:59:55] doodlehaus: has joined #RubyOnRails