« Back to channel list

#RubyOnRails - 18 July 2015

« Back 1 day Forward 1 day »
[00:01:43] duncannz: has joined #RubyOnRails
[00:02:52] htmldrum: has joined #RubyOnRails
[00:05:36] shoutsid06: has joined #RubyOnRails
[00:08:13] Guam: has joined #RubyOnRails
[00:08:39] timh: has joined #RubyOnRails
[00:10:31] matcouto: Hey guys, quick question.. wasn't *render json: beers* supposed to add a root key *beers* to the hash? e.g.: beers: [{ id: 1, ... }] In my case it's returning an array with a hash in it rather than a hash with a key and an array as its value. e.g.: { beers: [ {id: 1}, {id: 2} ]}
[00:10:41] matcouto: or maybe I need to build the hash myself?
[00:10:56] Guam: has joined #RubyOnRails
[00:12:40] bricker: matcouto: see here for documentation: http://api.rubyonrails.org/classes/ActiveModel/Serializers/JSON.html#method-i-as_json
[00:12:43] _utah_: has joined #RubyOnRails
[00:15:09] hazelux: has joined #RubyOnRails
[00:16:17] jenrzzz: has joined #RubyOnRails
[00:18:09] timdotrb: has joined #RubyOnRails
[00:20:42] theery: has joined #RubyOnRails
[00:24:19] charliesome: has joined #RubyOnRails
[00:25:50] chrisarcand: has joined #RubyOnRails
[00:26:15] matcouto: bricker I'm using a Serializer class instead of calling #as_json. e.g.: render json: @beers, serialize_each: BeerSerializer
[00:26:29] OS-14813: has joined #RubyOnRails
[00:27:31] bricker: matcouto: what is serialize_each from?
[00:28:59] _utah_: has joined #RubyOnRails
[00:29:44] matcouto: bricker Ops, ignore serialize_each. I meant each_serializer
[00:29:52] Pupeno: has joined #RubyOnRails
[00:30:59] edwinvdgraaf: has joined #RubyOnRails
[00:31:08] hfp_work: has joined #RubyOnRails
[00:31:38] hfp: has joined #RubyOnRails
[00:32:24] bricker: matcouto: https://github.com/rails-api/active_model_serializers Ctrl+F "root key"
[00:32:45] bricker: matcouto: basically you need to change the adapter that the gem uses from "flatten JSON" to just "json"
[00:33:01] bricker: https://github.com/rails-api/active_model_serializers#built-in-adapters
[00:33:09] bricker: I've never used AM::Serializers
[00:33:16] bricker: well I did once for 12 seconds and didn't like it
[00:34:06] matcouto: 12 seconds lol
[00:35:08] matcouto: bricker which approach would you suggest instead?
[00:35:21] bricker: matcouto: I like building my own serializers
[00:35:24] bricker: it's easy and you get 100% control
[00:35:29] volsus: has joined #RubyOnRails
[00:40:57] fighella: has joined #RubyOnRails
[00:41:14] siemprefresco: has joined #RubyOnRails
[00:42:49] matcouto: This would be ideal: render json: @beers, each_serializer: BeerSerializer, root: true I'll change the adapter for now, and think of a better approach for that
[00:42:56] matcouto: bricker thanks mate
[00:48:28] x-light: has joined #RubyOnRails
[00:49:16] _utah_: has joined #RubyOnRails
[00:49:39] zeknox: has joined #RubyOnRails
[00:50:25] zeknox: rabl vs jbuilder, is one preffered over another?
[00:50:36] ndrei: has joined #RubyOnRails
[00:50:42] bricker: zeknox: jbuilder
[00:50:44] ndrei_: has joined #RubyOnRails
[00:51:03] eggoez: has joined #RubyOnRails
[00:51:03] zeknox: bricker: can you give me the 101 on why?
[00:51:19] bricker: zeknox: because it's built and maintained by the Rails team
[00:51:26] bricker: and it more idiomatic rails
[00:51:29] bricker: and ruby, frankly
[00:51:39] zeknox: bricker: ty sir, good enough for me!
[00:51:40] bricker: you don't really have to learn anything new
[00:51:43] bricker: rabl is a whole DSL
[00:51:46] baweaver: has joined #RubyOnRails
[00:52:02] zeknox: bricker: im an easy sell because i dont know one over the other
[00:52:40] allcentury: has joined #RubyOnRails
[00:53:32] _utah_: has joined #RubyOnRails
[00:56:00] Noizept: has joined #RubyOnRails
[01:02:59] fighella: has joined #RubyOnRails
[01:03:01] Pupeno_: has joined #RubyOnRails
[01:10:42] hololeap: has joined #RubyOnRails
[01:13:22] _utah_: has joined #RubyOnRails
[01:16:00] DoctorMonocular: has joined #RubyOnRails
[01:19:19] one_zero: has joined #RubyOnRails
[01:21:21] htmldrum: has joined #RubyOnRails
[01:27:22] jonee: has joined #RubyOnRails
[01:28:02] ur5us: has joined #RubyOnRails
[01:29:49] OS-14813: has joined #RubyOnRails
[01:34:05] mikecmpbll: has joined #RubyOnRails
[01:38:39] nickenchuggets: has joined #RubyOnRails
[01:38:39] nickenchuggets: has joined #RubyOnRails
[01:38:46] cornerma1: has joined #RubyOnRails
[01:41:50] bobbobbins: has joined #RubyOnRails
[01:44:55] Ch40sc0d3: has joined #RubyOnRails
[01:44:55] Maletor: has joined #RubyOnRails
[01:44:59] Ch40sc0d3: has left #RubyOnRails: ()
[01:46:28] lele: has joined #RubyOnRails
[01:50:35] jonee: has joined #RubyOnRails
[01:51:26] Encapsulation: has joined #RubyOnRails
[02:00:30] one_zero_u: has joined #RubyOnRails
[02:00:39] erich: has joined #RubyOnRails
[02:01:40] dopie: has joined #RubyOnRails
[02:04:03] skkeeper: has joined #RubyOnRails
[02:06:28] duncannz: has joined #RubyOnRails
[02:07:32] duderonomy: has joined #RubyOnRails
[02:10:28] jonee: has joined #RubyOnRails
[02:17:41] bruno-: has joined #RubyOnRails
[02:18:50] timh: has joined #RubyOnRails
[02:19:30] asdfoo: has joined #RubyOnRails
[02:28:09] shyshy: has joined #RubyOnRails
[02:28:43] robbyoconnor: has joined #RubyOnRails
[02:29:15] BenMorganIO: has joined #RubyOnRails
[02:29:49] charliesome: has joined #RubyOnRails
[02:29:58] willywos: has joined #RubyOnRails
[02:34:10] jonee: has joined #RubyOnRails
[02:34:15] Guam: has joined #RubyOnRails
[02:34:36] sankaber: has joined #RubyOnRails
[02:34:49] hololeap: has joined #RubyOnRails
[02:35:50] quarters: has joined #RubyOnRails
[02:37:34] quarters: hello. I was wondering if there's a primer for setting up an app to log onto a rails app via JSON (eg required header fields, how to implement the sessions controller, etc). This would be without the use of devise, by the way
[02:44:37] Guam: has joined #RubyOnRails
[02:45:07] brianpWins: has joined #RubyOnRails
[02:45:23] charliesome: has joined #RubyOnRails
[02:49:55] madebymarkca: has joined #RubyOnRails
[02:50:27] BenMorganIO: Hey, I'm trying to send an email with action mailer and it has some helpers. When I use `#deliver_now` it sends, but when I use `#deliver_later` it says the helper methods are undefined.
[02:50:42] cytoskeletor: has joined #RubyOnRails
[02:55:01] Pupeno: has joined #RubyOnRails
[02:55:39] TinkerTyper: has joined #RubyOnRails
[03:03:37] brianpWins_: has joined #RubyOnRails
[03:06:45] quarters1: has joined #RubyOnRails
[03:07:40] quarters: I believe it involves having a separate render json line and render html line if accessing via web
[03:09:20] braincrash: has joined #RubyOnRails
[03:12:25] blackhuey: has joined #RubyOnRails
[03:14:28] quarters: my sessions controller is here: https://bitbucket.org/zebralight/sample_app/src/1b13cf9a403af9a0a8f6d8263b81c7a2b5b9b8a9/app/controllers/sessions_controller.rb?at=master and my json is formatted as user:{email: user@example.com,password: aaaaaa, remember_me: 1}, which is shown in the cmd line as : Parameters: {"user:{email: user@example.com,password: aaaaaa, remember_me: 1}"=>"[FILTERED]"}
[03:17:57] edwinvdgraaf: has joined #RubyOnRails
[03:18:19] delsol: has joined #RubyOnRails
[03:18:43] jenrzzz: has joined #RubyOnRails
[03:19:23] jonee: has joined #RubyOnRails
[03:19:25] delsol: Anyone have a few minutes that can answer some active record questions?
[03:19:28] timh: has joined #RubyOnRails
[03:26:52] Maletor: has joined #RubyOnRails
[03:28:31] djbkd: has joined #RubyOnRails
[03:31:07] matcouto: has joined #RubyOnRails
[03:34:05] nya: has joined #RubyOnRails
[03:36:06] bungoman: has joined #RubyOnRails
[03:38:29] bronson: has joined #RubyOnRails
[03:40:21] jonee: has joined #RubyOnRails
[03:42:20] hololeap: wtf: http://api.rubyonrails.org/classes/ActiveRecord/NoTouching.html
[03:43:26] framling: has joined #RubyOnRails
[03:45:13] eggoez: has joined #RubyOnRails
[03:46:00] hololeap: ok, now it makes sense: http://apidock.com/rails/ActiveRecord/Timestamp/touch
[03:46:20] Guam: has joined #RubyOnRails
[03:47:39] hazelux: has joined #RubyOnRails
[03:52:02] Obfuscate: has joined #RubyOnRails
[03:52:07] xkickflip: has joined #RubyOnRails
[03:58:48] eggoez: has joined #RubyOnRails
[03:58:49] baweaver: has joined #RubyOnRails
[04:06:28] sevenseacat: has joined #RubyOnRails
[04:08:22] djbkd: has joined #RubyOnRails
[04:08:35] djbkd: has joined #RubyOnRails
[04:08:51] djbkd: has joined #RubyOnRails
[04:11:01] volsus: has joined #RubyOnRails
[04:11:48] DoctorMonocular: has joined #RubyOnRails
[04:12:29] djbkd: has joined #RubyOnRails
[04:13:42] jenrzzz: has joined #RubyOnRails
[04:14:19] mois3x: has joined #RubyOnRails
[04:16:27] kkeuning: has joined #RubyOnRails
[04:19:50] jonee: has joined #RubyOnRails
[04:23:21] Coldblackice: has joined #RubyOnRails
[04:23:43] seank_: has joined #RubyOnRails
[04:23:51] crdpink2: has joined #RubyOnRails
[04:27:12] bungoman: has joined #RubyOnRails
[04:28:17] crdpink: has joined #RubyOnRails
[04:33:32] mois3x: has joined #RubyOnRails
[04:33:53] ecksit: has joined #RubyOnRails
[04:35:01] ecksit: hey, i'm looking to use a view inside of `lib/<dir>/views`. what is the best way to do this?
[04:37:33] ValicekB: has joined #RubyOnRails
[04:38:03] slash_nick: ecksit: have you tried this? http://stackoverflow.com/questions/6861022/render-view-from-code-in-lib
[04:38:54] ecksit: is that the optimal way to do it?
[04:39:43] arooni-mobile: has joined #RubyOnRails
[04:40:20] ecksit: i have my code inside of 'lib' and that code will be using the partials but I just want to do it the most rails like way
[04:42:37] quarters: has joined #RubyOnRails
[04:43:07] melonstorm: has joined #RubyOnRails
[04:43:26] quarters: hi. I was wondering how to find out the format my JSON needs to take to interact with my Rails app's session controller.
[04:44:19] bronson: has joined #RubyOnRails
[04:44:21] quarters: the controller is found here: https://bitbucket.org/zebralight/sample_app/src/1b13cf9a403af9a0a8f6d8263b81c7a2b5b9b8a9/app/controllers/sessions_controller.rb?at=master
[04:44:38] quarters: I'm not sure if the controller itself gives away the format that my JSON file must take
[04:45:03] bronson: has joined #RubyOnRails
[04:45:56] slash_nick: ecksit: what's this code in lib responsible for? rendering views?...
[04:46:31] arup_r: has joined #RubyOnRails
[04:47:03] ecksit: slash_nick: passing data to views
[04:47:04] fighella: has joined #RubyOnRails
[04:47:47] slash_nick: ecksit: can you call the lib code from the view?... from a helper, maybe?...
[04:48:23] ecksit: not really.
[04:48:33] ecksit: i want to pass the view the object and go from there
[04:50:37] arup_: has joined #RubyOnRails
[04:50:51] ayonkhan: has joined #RubyOnRails
[04:51:13] slash_nick: right, gather the data then render it... lib code is just gathering data, no?
[04:51:49] baweaver_: has joined #RubyOnRails
[04:52:17] ecksit: yes slash_nick. but i want to bundle my views with my lib code (just in a sub directory)
[04:52:21] jonee: has joined #RubyOnRails
[04:54:32] tjbiddle: has joined #RubyOnRails
[04:56:30] slash_nick: ecksit: your lib code... sounds like it needs to contain some logic that can be exercised by controllers as well as its own views... have you considered wrapping it up as a rails engine?
[04:56:47] ecksit: perhaps that is what i need to look at
[04:57:18] slash_nick: maybe... you'd move it from your_app/lib/ to your_lib/... add gem "your_lib" to your Gemfile...
[04:58:10] christiandsg: has joined #RubyOnRails
[04:58:16] slash_nick: should be plenty to read on rails engines out there
[05:03:19] jenrzzz: has joined #RubyOnRails
[05:04:21] tercenya: has joined #RubyOnRails
[05:04:32] x-light: has joined #RubyOnRails
[05:04:35] slash_nick: ecksit: I kind of followed the "i dont want to use an engine" train of though... found this answer: http://stackoverflow.com/a/4541271/1152759 ... then found the more recent answer by 3 years
[05:05:16] Creeves: has joined #RubyOnRails
[05:06:00] ayonkhan: has joined #RubyOnRails
[05:14:00] dideler: has joined #RubyOnRails
[05:15:29] DoctorMonocular: has joined #RubyOnRails
[05:19:18] dcunit3d: has joined #RubyOnRails
[05:20:23] timh: has joined #RubyOnRails
[05:21:39] arup_r: has joined #RubyOnRails
[05:25:19] totimkopf: has joined #RubyOnRails
[05:26:50] tuelz: has joined #RubyOnRails
[05:26:53] tjbiddle: has joined #RubyOnRails
[05:27:48] DoctorMonocular: has joined #RubyOnRails
[05:28:06] arup_r: has joined #RubyOnRails
[05:30:41] fighella: has joined #RubyOnRails
[05:38:20] rickmasta: has joined #RubyOnRails
[05:38:40] benlieb: has joined #RubyOnRails
[05:39:05] _utah_: has joined #RubyOnRails
[05:40:16] riotjones: has joined #RubyOnRails
[05:44:47] charliesome: has joined #RubyOnRails
[05:44:53] quarters: has joined #RubyOnRails
[05:46:06] richipargo: has joined #RubyOnRails
[05:46:47] bronson: has joined #RubyOnRails
[05:47:24] Rubie: has joined #RubyOnRails
[05:47:34] quarters: hello. Is there a method in Rails that'll allow me to take "'session':{'email': 'user@example.com','password': 'aaaaaa', 'remember_me': '1' }" and parse it into a proper hash like so: 'session':{'email': 'user@example.com','password': 'aaaaaa', 'remember_me': '1' }
[05:47:53] _djbkd: has joined #RubyOnRails
[05:48:17] quarters: from a string to a hash basically
[05:50:59] sevenseacat: if the string is valid json, you could use JSON.parse
[05:55:13] jenrzzz: has joined #RubyOnRails
[05:56:10] fighella: has joined #RubyOnRails
[05:56:16] culturelabs: has joined #RubyOnRails
[05:57:39] alphaatom: has joined #RubyOnRails
[05:58:20] mjc_: has joined #RubyOnRails
[06:00:08] seank__: has joined #RubyOnRails
[06:02:15] DoubleMalt: has joined #RubyOnRails
[06:03:52] duncannz: has joined #RubyOnRails
[06:06:38] edwinvdgraaf: has joined #RubyOnRails
[06:09:13] abuzze: has joined #RubyOnRails
[06:09:13] arup_r: has joined #RubyOnRails
[06:15:43] tjbiddle: has joined #RubyOnRails
[06:17:12] JohnBat26: has joined #RubyOnRails
[06:17:44] fighella: has joined #RubyOnRails
[06:19:03] theery: has joined #RubyOnRails
[06:19:15] bruno-: has joined #RubyOnRails
[06:20:47] rushed: has joined #RubyOnRails
[06:22:51] timh: has joined #RubyOnRails
[06:24:37] El3ktra: has joined #RubyOnRails
[06:28:08] baweaver: has joined #RubyOnRails
[06:30:49] cha1tanya: has joined #RubyOnRails
[06:31:13] hazelux: has joined #RubyOnRails
[06:36:36] BenMorganIO: has joined #RubyOnRails
[06:37:55] Maletor: has joined #RubyOnRails
[06:40:19] vigasdeep: has joined #RubyOnRails
[06:41:02] riotjones: has joined #RubyOnRails
[06:47:57] CalvinnHobbes: has joined #RubyOnRails
[06:50:06] krz: has joined #RubyOnRails
[07:01:52] krz: is app/queries/ reserved or something?
[07:03:18] krz: i creted item_query.rb (with class ItemQuery) in app/queries/. in rails console. ItemQuery returns: NameError: uninitialized constant ItemQuery
[07:03:46] sevenseacat: did you restart your server/spring/console/etc. after creating the queries folder
[07:04:30] sevenseacat: did you really?
[07:05:18] krz: sevenseacat: yea really really
[07:05:30] sevenseacat: ok, then double check your filename and your class name
[07:06:57] krz: https://gist.github.com/55b3687f67d862ec4584
[07:07:23] Mia: has joined #RubyOnRails
[07:07:23] Mia: has joined #RubyOnRails
[07:07:35] krz: i updated
[07:07:55] sevenseacat: k, now whats api?
[07:07:58] krz: thats the name project root. disregard api. i updated the gist
[07:08:07] krz: thats the project root
[07:08:55] sevenseacat: just tested it in my app and it worked perfectly.
[07:09:29] sevenseacat: suggest quitting console, stopping spring/any app preloaders, and restarting console.
[07:09:34] krz: updated gist again
[07:09:44] krz: with ItemPolicy. it works
[07:09:50] sevenseacat: seems irrelevant
[07:09:53] krz: the same with my services
[07:09:58] sevenseacat: also irrelevant
[07:10:05] krz: just not with anything in app/queries
[07:10:24] x-light: has joined #RubyOnRails
[07:10:51] krz: sevenseacat: what rails version are you running?
[07:10:56] srinidhi: has joined #RubyOnRails
[07:11:03] sevenseacat: queries is not a reserved folder. in any version of rails.
[07:11:09] sevenseacat: the rails version is irrelevant.
[07:12:23] krz: damn this driving me nuts
[07:12:55] sevenseacat: have you tried what I suggested?
[07:13:07] krz: i cleaned my laptop keyboard recently. maybe a bit of water got through into the motherboard. and its messing up rails app preloaders?
[07:13:14] sevenseacat: .....the fuck?
[07:13:31] krz: sevenseacat: sorry i wanted to make your day
[07:13:39] sevenseacat: krz: by being stupid?
[07:14:08] krz: joking aside. let me reboot!
[07:16:13] krz: has joined #RubyOnRails
[07:16:19] roolo: has joined #RubyOnRails
[07:17:09] krz: really odd indeed. restared unicorn. rails c. didnt work. rebooted. and now ItemQuery in rails c resolves
[07:17:39] krz: what trickery is this
[07:17:41] sevenseacat: well I told you what the problem was. app preloaders.
[07:17:46] sevenseacat: you chose to ignore me.
[07:18:22] krz: sevenseacat: but shouldnt reload! in rails c, restart rails c, or restart unicorn refresh the preloaders?
[07:18:32] sevenseacat: no to all of the above.
[07:19:05] sevenseacat: thats why I gave explicit instructions.
[07:19:48] krz: kk, ty for that
[07:24:02] srinidhi: has joined #RubyOnRails
[07:24:34] arup_r: has joined #RubyOnRails
[07:26:35] krz: sevenseacat: how is your day going?
[07:26:51] sevenseacat: not bad. proofreading the final MEAP of r4ia.
[07:29:52] krz: sevenseacat: oh sweet. got me a copy a few months ago. are you rebecca?
[07:30:09] krz: only knew you as karpah
[07:30:16] Doddlin: has joined #RubyOnRails
[07:30:17] sevenseacat: I answer to that too.
[07:30:27] Doddlin: Mornin all!
[07:30:33] sevenseacat: afternoon Doddlin
[07:31:10] Doddlin: I just left my bed in Sweden
[07:31:28] Doddlin: not necessarily a guarantee for it to be morning though ^^
[07:31:46] hazelux: has joined #RubyOnRails
[07:34:09] markholmes: has joined #RubyOnRails
[07:36:57] alphaatom: has joined #RubyOnRails
[07:37:05] Doddlin: someone who can assist with some heroku db-handling?
[07:37:22] Doddlin: I need a pg_dump but I can???t seem to get it downloaded..
[07:39:29] rushed: Doddlin: https://devcenter.heroku.com/articles/heroku-postgres-import-export
[07:41:08] Doddlin: rushed, yeah but that only gets it as psql, sorry, sould have said that, I want to get it to SQL so I can upload it to a MySQL-db
[07:41:30] rushed: Doddlin: that's not a thing you want to do
[07:41:40] Doddlin: rushed, why?
[07:41:47] rushed: Doddlin: you why
[07:42:31] Doddlin: rushed, haha, because I have a host with full uptime, and the last weeks I???ve had emails dropping in 4-6 times a day stating that my site is down due to a db-down-error
[07:42:52] blindMoe: has joined #RubyOnRails
[07:42:54] Doddlin: so I want to migrate to my host with full uptime
[07:43:09] krz: Doddlin: "full uptime" seems dubious
[07:43:28] Doddlin: krz, well yeah, but very much better than what it is atm
[07:43:59] sevenseacat: you want to convert psql to mysql? erm
[07:44:00] krz: Doddlin: ive had good results with heroku postgres in the past. could it be something internal thats causing the db instance to crash?
[07:44:17] shinnya: has joined #RubyOnRails
[07:44:30] krz: i.e. high cpu? connection pooling, etc
[07:44:37] Doddlin: sevenseacat, well I think so
[07:44:45] Doddlin: krz, I???m getting some PQ-error
[07:44:52] Doddlin: hang on, I???ll get it pasted
[07:44:59] mike___1234: has joined #RubyOnRails
[07:45:24] Doddlin: krz, PG::ConnectionBad: PQconsumeInput() SSL connection has been closed unexpectedly
[07:45:29] krz: Doddlin: if its a hardware issue. heroku pg can switch you to a different db altogether. but if its something internal (i.e. in the app). might be worth checkign on
[07:45:52] krz: Doddlin: what db type are you using?
[07:46:11] Doddlin: krz, hobby-dev
[07:46:48] sevenseacat: i doubt its a hardwar eissue, given its aws
[07:47:21] krz: sevenseacat: nothing too wrong with aws
[07:47:31] sevenseacat: never said there was
[07:47:58] krz: Doddlin: how often are your drops occurring?
[07:48:09] sevenseacat: http://geoff.evason.name/2015/01/18/postgres-ssl-connection-has-been-closed-unexpectedly
[07:48:19] Doddlin: krz, too often
[07:48:26] krz: i know aws rds has a maintainence window. where the db goes down for a few minutes per day
[07:48:44] sevenseacat: https://discussion.heroku.com/t/intermittent-postgres-connection-issues-from-rails/865
[07:48:45] Doddlin: krz, yeah, that is my biggest issue
[07:48:47] krz: but that can be address by switching your db to multi-AZ
[07:48:53] sevenseacat: tldr - dont use a hobby plan.
[07:48:53] krz: addressed
[07:48:57] sevenseacat: if you arent a hobby site.
[07:49:05] Doddlin: since 15/7
[07:49:13] krz: Doddlin: https://devcenter.heroku.com/articles/heroku-postgres-plans
[07:49:21] Doddlin: I???ve had the error-msg given a LOT of times
[07:49:25] madebymarkca: has joined #RubyOnRails
[07:49:27] krz: there are downtimes per month
[07:49:43] Doddlin: at least 150 lines of errors
[07:49:50] blindMoe: What do I need to do to pass in the session object into a model's before_save? I thought I was doing it right but apparently not: https://gist.github.com/blindMoe/90904f99ed30019c77db
[07:50:01] lurking: has joined #RubyOnRails
[07:50:14] rushed: blindMoe: why are you trying to do that?
[07:50:29] blindMoe: want to set a field in the db based off something that is stored in session
[07:50:41] rushed: blindMoe: what something?
[07:50:43] krz: Doddlin: maybe switch to a higher plan?
[07:50:47] Doddlin: maybe we should give standard-plan a try...
[07:50:57] sevenseacat: blindMoe: you cant pass arguments to a before_save filter like that
[07:51:05] Doddlin: krz, sevenseacat, yeah, we???ll try standard
[07:51:07] sevenseacat: and you shouldnt be accessing the session in a model
[07:51:09] krz: Doddlin: also consider using new relic, to determine bottlenecks. which might indicate why/where the db is dropping
[07:51:24] blindMoe: rushed: an ID of something that is set by a gem
[07:51:29] iooner: has joined #RubyOnRails
[07:51:47] rushed: blindMoe: an ID of what something?
[07:51:51] blindMoe: sevenseacat: any pointers on how I could do that? Doesn't seem like session object is available w/o passing it in somehow
[07:52:04] krz: Doddlin: if all fails. ask heroku for a multi-az plan. 0 downtime when db is being maintained/upgraded (http://aws.amazon.com/rds/details/ - search page for multi-az)
[07:52:05] Doddlin: krz, I have it installed, I???ll check it out :)
[07:52:18] Doddlin: thanks! :D
[07:52:33] blindMoe: rushed: a store id from a different table that is set by the shopify_app gem
[07:52:48] sevenseacat: blindMoe: you dont pass it in. if you want to set it, you do it from whatever controller action you're running
[07:53:02] krz: Doddlin: and if all fails, still. try aws rds postgres :D. but dont switch to mysql
[07:53:22] Doddlin: hahaha, OK you have talked me out of it ;)
[07:53:23] blindMoe: sevenseacat: so basically I just wouldn't use before_save at all and just do it in the controller?
[07:53:56] sevenseacat: blindMoe: I don't know enough context about what you want to do or why. but you cannot pass arguments to a before_save callback, and you should not access the session from a model.
[07:54:15] blindMoe: sevenseacat: ok that answers my question.. thank you very much
[07:54:28] krz: blindMoe: sounds like you need a query object?
[07:54:30] sevenseacat: at least I only needed to say it twice!
[07:54:49] krz: either do the query in the controller with the session. or use a query object to abstract this kind of logic
[07:55:21] krz: blindMoe: http://blog.codeclimate.com/blog/2012/10/17/7-ways-to-decompose-fat-activerecord-models/ #4
[07:55:36] blindMoe: krz: I think I can just do it in the controller ... I prefer to do things like this in before_save ( in other ORMs ) so I only have to do it in one place
[07:55:57] blindMoe: I understand why it would make sense to not have logic like that in the model though
[07:56:09] krz: do it in the controller. if you eventually see a need to slim down your controller and reuse the same queries again. consider the query object pattern
[07:56:32] Axilla: has joined #RubyOnRails
[07:56:44] blindMoe: krz: i'll read about the query object pattern now. Thanks for the pointer
[07:58:03] krz: blindMoe: Rails Anti-Patterns if you want to get more into conventional patterns http://www.amazon.com/Rails-AntiPatterns-Refactoring-Addison-Wesley-Professional/dp/0321604814
[08:00:56] blindMoe: i'll check that out as well :)
[08:01:17] seank_: has joined #RubyOnRails
[08:01:37] nya: has joined #RubyOnRails
[08:01:45] quazimodo: has joined #RubyOnRails
[08:04:07] GeissT_: has joined #RubyOnRails
[08:04:15] darutoko: has joined #RubyOnRails
[08:05:35] willywos: has joined #RubyOnRails
[08:07:08] krz: has joined #RubyOnRails
[08:09:42] lxsameer: has joined #RubyOnRails
[08:14:02] _utah_: has joined #RubyOnRails
[08:14:26] relix: has joined #RubyOnRails
[08:15:07] GeissT: has joined #RubyOnRails
[08:15:47] closer: has joined #RubyOnRails
[08:16:34] nya: has joined #RubyOnRails
[08:16:37] Sylario: has joined #RubyOnRails
[08:17:10] nya: has joined #RubyOnRails
[08:23:43] timh: has joined #RubyOnRails
[08:24:11] tercenya_: has joined #RubyOnRails
[08:26:51] schaerli: has joined #RubyOnRails
[08:29:09] Guam: has joined #RubyOnRails
[08:29:15] Creeves: has joined #RubyOnRails
[08:29:16] _utah_: has joined #RubyOnRails
[08:31:34] nya: has joined #RubyOnRails
[08:31:44] Moeh: has joined #RubyOnRails
[08:32:11] nya: has joined #RubyOnRails
[08:32:31] hazelux: has joined #RubyOnRails
[08:32:39] Guam: has joined #RubyOnRails
[08:32:43] srinidhi: has joined #RubyOnRails
[08:34:37] Moeh: I want to use "sequel" to create a new table on the fly (http://pastie.org/10299512). However, the name of the table and the fields depend on the input. What would be the recommended way to generate the code that generates the table. Right now I am using eval() but that does not feel "right".
[08:35:10] _utah_: has joined #RubyOnRails
[08:36:22] Rubie: has joined #RubyOnRails
[08:36:53] Guest63816: has joined #RubyOnRails
[08:37:27] michael_mbp: has joined #RubyOnRails
[08:38:33] marr: has joined #RubyOnRails
[08:40:09] marr: has joined #RubyOnRails
[08:41:08] fighella: has joined #RubyOnRails
[08:41:10] sinkensabe: has joined #RubyOnRails
[08:43:02] alphaatom: has joined #RubyOnRails
[08:43:48] armyriad: has joined #RubyOnRails
[08:44:14] Lightsword: has joined #RubyOnRails
[08:46:18] livathinos: has joined #RubyOnRails
[08:46:35] nya: has joined #RubyOnRails
[08:47:56] bronson: has joined #RubyOnRails
[08:48:00] x-light: has joined #RubyOnRails
[08:48:32] krz: moeh: create a table on runtime?
[08:48:36] Guest63816: has joined #RubyOnRails
[08:48:48] krz: moeh: sounds nasty....
[08:49:15] krz: why not have a table already present. and then just add records to it. each record represents a "table"
[08:50:13] Moeh: Because the data provided will have a different structure. I would like to enable the user to store data from different sources and query it.
[08:50:21] rushed: has left #RubyOnRails: ()
[08:50:22] krz: if fields are dynamic. see if sequel supports hash properties. if not, sounds like nosql db might be a better candidate
[08:50:26] _blizzy_: has joined #RubyOnRails
[08:50:32] lurking: has left #RubyOnRails: ()
[08:50:33] arBmind: has joined #RubyOnRails
[08:50:53] krz: if nosql. i recommend rethinkdb
[08:50:56] _blizzy_: I'm trying to do something like 'Message.where(:content.include? 'foo')', however, that is illegal syntax in rails.
[08:51:11] _blizzy_: if you're going nosql, you could try mongo. v:
[08:51:28] krz: errr mongo
[08:51:54] _blizzy_: I haven't had problems with mongo with what I used it for.
[08:52:21] krz: _blizzy_: which adapter are you using? im curious
[08:52:57] _blizzy_: the question I asked is using Postgres.
[08:53:31] krz: _blizzy_: http://stackoverflow.com/questions/13529804/how-to-use-wildcards-in-an-active-record-where-clause-while-protecting-against-s
[08:54:07] krz: _blizzy_: sorry. i meant whihc adapter were you using with mongo
[08:55:11] _blizzy_: krz, thanks for the help with my question :) also, I should of specified that I used mongo with node.
[08:55:17] krz: moeh: postgres for example supports hstore properties. http://www.postgresql.org/docs/9.0/static/hstore.html but only one level deep. if you need something more complex. a nosql document store might fit your needs better. but dont create tables on the fly
[08:56:11] madebymarkca: has joined #RubyOnRails
[08:56:14] Guam: has joined #RubyOnRails
[08:56:55] max_v: has joined #RubyOnRails
[08:59:00] Moeh: krz: I don't really get what the problem with this approach is.
[09:00:36] krz: moeh: do you intend on creating new models and controllers on the fly as well?
[09:01:02] chinmay_dd: has joined #RubyOnRails
[09:01:16] krz: moeh: second. some resources will not be aware of these new migrations, unless you restart rails server
[09:01:35] nya: has joined #RubyOnRails
[09:02:07] Moeh: I am thinking about it, yes. I would like to enable users to store large amounts of structured data and query it afterwards. I don't really see a better solution for this than creating a second db and create / delete the tables on the fly.
[09:02:28] Moeh: And I don't know the structure of the data beforehand.
[09:02:45] krz: moeh: have you considered a nosql solution?
[09:03:22] krz: once the tables are created on the fly. does your rails application need to access them?
[09:03:56] chinmay_dd: has joined #RubyOnRails
[09:05:08] Moeh: Yes, I thought about it. However I thought that this will create problems with analytics.
[09:05:18] Moeh: Yes, it would need to run sql queries against the tables.
[09:05:42] bruno-: has joined #RubyOnRails
[09:07:13] krz: moeh: run sql queries in the same rails application?
[09:07:41] krz: so everytime you create a new table on the fly. you dont mind rebooting your rails app?
[09:07:44] krz: :shrugs:
[09:08:00] krz: which means unecessary downtime
[09:08:26] Moeh: Because it would need to load the new models?
[09:08:33] Moeh: Or why the restart?
[09:08:41] BenMorganIO: has joined #RubyOnRails
[09:08:54] krz: yea new models. basically everything in /app
[09:09:20] krz: if you have workers (i.e. at app/workers/, etc) they need to be aware of these "new" resources
[09:10:02] krz: moeh: sounds like a lot of meta programming. so to get this right. every new table. means, you need to dynamically create a route, model, controller, view?, etc etc?
[09:10:06] krz: good luck with that
[09:10:29] fighella: has joined #RubyOnRails
[09:12:39] Moeh: How would you do it? RethinkDB?
[09:12:40] yardenbar: has joined #RubyOnRails
[09:13:24] mosez: has joined #RubyOnRails
[09:14:44] _utah_: has joined #RubyOnRails
[09:15:57] krz: moeh: try to do it first with sequel
[09:16:10] krz: basically a table with predefined generic columns
[09:16:33] krz: if your db supports some kind of dynamic structure like hstore and arrays. leverage that too
[09:16:37] nya: has joined #RubyOnRails
[09:17:02] krz: if you see the your sql db is a no fit. then venture out into a document store nosql solution
[09:20:52] fighella: has joined #RubyOnRails
[09:21:16] alexhartley: has joined #RubyOnRails
[09:21:17] fighella: has joined #RubyOnRails
[09:22:11] eGGsha: has joined #RubyOnRails
[09:22:54] DEA7TH: has joined #RubyOnRails
[09:24:30] Lightsword: has joined #RubyOnRails
[09:25:11] Lightsword: has joined #RubyOnRails
[09:25:37] krz: *if you still see your sql*
[09:27:14] ur5us: has joined #RubyOnRails
[09:27:58] fighella: has joined #RubyOnRails
[09:29:18] krz: where is a good place to bunch up a set of helper methods?
[09:29:42] krz: right now sitting in application controller. module? or is there a better place?
[09:30:49] alphaatom: has joined #RubyOnRails
[09:31:34] nya: has joined #RubyOnRails
[09:31:55] krz: sevenseacat wake up ^^
[09:32:13] max_v: has joined #RubyOnRails
[09:37:54] alphaatom: has joined #RubyOnRails
[09:39:26] krz: k, will meta program this stuff in application controller
[09:42:16] arup_r: has joined #RubyOnRails
[09:44:09] max: has joined #RubyOnRails
[09:44:38] DEA7TH_: has joined #RubyOnRails
[09:45:11] masscrx: has left #RubyOnRails: ()
[09:45:56] masscrx: has joined #RubyOnRails
[09:46:34] nya: has joined #RubyOnRails
[09:46:42] masscrx: can anybody help me with this rspec test ? https://gist.github.com/masscrx/d7256c3cc9dfc4fe8f60
[09:47:07] seank_: has joined #RubyOnRails
[09:47:11] nya: has joined #RubyOnRails
[09:49:45] fighella: has joined #RubyOnRails
[09:50:40] eminencehc_: has joined #RubyOnRails
[09:53:30] _utah_: has joined #RubyOnRails
[09:56:08] MaDErroR123: has joined #RubyOnRails
[09:56:17] fighella: has joined #RubyOnRails
[09:56:40] MaDErroR123: has joined #RubyOnRails
[10:00:29] duncannz: has joined #RubyOnRails
[10:01:34] nya: has joined #RubyOnRails
[10:02:21] Doddlin: has joined #RubyOnRails
[10:05:06] DLSteve: has joined #RubyOnRails
[10:05:21] DLSteve: has joined #RubyOnRails
[10:05:44] mikecmpbll: has joined #RubyOnRails
[10:08:27] Pupeno: has joined #RubyOnRails
[10:08:27] Pupeno: has joined #RubyOnRails
[10:14:38] fighella: has joined #RubyOnRails
[10:16:35] nya: has joined #RubyOnRails
[10:17:10] nya: has joined #RubyOnRails
[10:17:38] AnoHito_: has joined #RubyOnRails
[10:19:01] isale-eko: has joined #RubyOnRails
[10:20:40] _utah_: has joined #RubyOnRails
[10:21:16] hazelux: has joined #RubyOnRails
[10:24:41] timh: has joined #RubyOnRails
[10:26:22] fighella: has joined #RubyOnRails
[10:26:39] mike___1234: has joined #RubyOnRails
[10:32:01] krz: has joined #RubyOnRails
[10:32:10] nya: has joined #RubyOnRails
[10:33:57] GeissT: has joined #RubyOnRails
[10:34:34] MaDErroR123: has joined #RubyOnRails
[10:35:13] _utah_: has joined #RubyOnRails
[10:37:47] mostlybadfly: has joined #RubyOnRails
[10:38:15] Spami: has joined #RubyOnRails
[10:46:24] nfk: has joined #RubyOnRails
[10:49:43] Spami_: has joined #RubyOnRails
[10:49:53] BenMorganIO: has joined #RubyOnRails
[10:51:05] erich: has joined #RubyOnRails
[10:51:40] n1875574: has joined #RubyOnRails
[10:52:07] cac: has joined #RubyOnRails
[10:53:07] Papierkorb: has joined #RubyOnRails
[10:53:08] FernandoBasso: has joined #RubyOnRails
[10:55:22] aiman_: has joined #RubyOnRails
[10:56:30] Coldblackice: has joined #RubyOnRails
[11:01:35] nya: has joined #RubyOnRails
[11:01:45] Coldblackice: has joined #RubyOnRails
[11:01:49] zorak8: has joined #RubyOnRails
[11:02:10] nya: has joined #RubyOnRails
[11:02:52] wethu: has joined #RubyOnRails
[11:03:05] bruno-: has joined #RubyOnRails
[11:08:08] StanLee: has joined #RubyOnRails
[11:08:16] drale2k: has joined #RubyOnRails
[11:08:39] tobacco_joe: has joined #RubyOnRails
[11:09:46] lucha: has joined #RubyOnRails
[11:16:35] nya: has joined #RubyOnRails
[11:18:51] DEA7TH_: has joined #RubyOnRails
[11:18:56] xkickflip_: has joined #RubyOnRails
[11:19:17] malcolmva: has joined #RubyOnRails
[11:27:00] heyts: has joined #RubyOnRails
[11:29:11] nfk: has joined #RubyOnRails
[11:30:46] doodlehaus: has joined #RubyOnRails
[11:31:36] nya: has joined #RubyOnRails
[11:31:50] drale2k: has joined #RubyOnRails
[11:32:10] nya: has joined #RubyOnRails
[11:39:16] Pupeno: has joined #RubyOnRails
[11:39:16] Pupeno: has joined #RubyOnRails
[11:40:29] seank_: has joined #RubyOnRails
[11:43:01] wethu: has joined #RubyOnRails
[11:45:02] schaerli: has joined #RubyOnRails
[11:46:34] nya: has joined #RubyOnRails
[11:46:34] isale-eko: has joined #RubyOnRails
[11:47:10] nya: has joined #RubyOnRails
[11:47:16] Spami_: has joined #RubyOnRails
[11:47:27] nfk: has joined #RubyOnRails
[11:55:48] doodlehaus: has joined #RubyOnRails
[12:02:10] nya: has joined #RubyOnRails
[12:04:47] centrx: has joined #RubyOnRails
[12:04:56] artto: has joined #RubyOnRails
[12:06:10] cac: has joined #RubyOnRails
[12:10:00] hazelux: has joined #RubyOnRails
[12:12:28] Rubie: has joined #RubyOnRails
[12:15:30] lxsameer: has joined #RubyOnRails
[12:17:02] arup_r: has joined #RubyOnRails
[12:18:16] Dbugger: has joined #RubyOnRails
[12:19:06] Dbugger: Hello guys. I was following this instructions ( https://gorails.com/setup/ubuntu/15.04 ) to install rails, but I noticed the Chris Lea repo for installing nodejs doesnt work anymore for Ubuntu 15.04. What should I do now to proceed on that step?
[12:23:46] centrx: You don't really need nodejs
[12:23:47] Denarii: dbugger: https://github.com/creationix/nvm
[12:24:32] Dbugger: Then why do the instructions ask me to install it?
[12:25:00] Dbugger: It does say I need nodejs to compile coffeescript
[12:25:20] centrx: You need a JavaScript runtime if you want to use the asset pipeline or coffeescript
[12:25:31] centrx: nodejs is one such runtime you can use
[12:25:36] timh: has joined #RubyOnRails
[12:25:43] centrx: and it's not necessary at the beginning, or if you don't want to use those features
[12:26:04] Dbugger: But if I want to use them... I will need it
[12:26:53] Denarii: or some other javascript runtime
[12:27:27] artto: has joined #RubyOnRails
[12:27:53] centrx: It doesn't need to be installed via apt-get, you can get a gem for therubyracer or evaljs or one of those
[12:27:59] centrx: just from your Gemfile/bundle
[12:28:56] Spami_: has joined #RubyOnRails
[12:31:34] nya: has joined #RubyOnRails
[12:31:49] exadeci: has joined #RubyOnRails
[12:34:57] rlomax: has joined #RubyOnRails
[12:35:26] Pupeno: has joined #RubyOnRails
[12:36:28] Fire-Dragon-DoL: mhhh any suggestion on how to test a ruby factory in isolation (like without requiring the classes that it instanciates) ?
[12:42:27] darrencauthon: has joined #RubyOnRails
[12:44:17] darrenca_: has joined #RubyOnRails
[12:45:25] Fire-Dragon-DoL: nevermind, found the solution
[12:46:34] nya: has joined #RubyOnRails
[12:47:10] nya: has joined #RubyOnRails
[12:49:21] srinidhi: has joined #RubyOnRails
[12:50:19] PlasmaStar: has joined #RubyOnRails
[12:50:26] shyshy: has joined #RubyOnRails
[12:50:57] victortyau: has joined #RubyOnRails
[12:52:37] poli: has joined #RubyOnRails
[12:52:52] romdi: has joined #RubyOnRails
[12:53:16] wethu: has joined #RubyOnRails
[12:53:38] htmldrum: has joined #RubyOnRails
[12:55:36] hazelux: has joined #RubyOnRails
[12:57:41] Lightsword: has joined #RubyOnRails
[13:00:50] loocash: has joined #RubyOnRails
[13:14:52] cac_: has joined #RubyOnRails
[13:17:26] erich: has joined #RubyOnRails
[13:18:28] sarink: has joined #RubyOnRails
[13:20:15] erich: has joined #RubyOnRails
[13:23:54] superlou: has joined #RubyOnRails
[13:24:11] eggoez: has joined #RubyOnRails
[13:26:16] Rubie: has joined #RubyOnRails
[13:27:54] shoutsid06: has joined #RubyOnRails
[13:27:57] cac: has joined #RubyOnRails
[13:29:44] cac: has joined #RubyOnRails
[13:30:52] t0rn: has joined #RubyOnRails
[13:31:09] shoutsid06: has joined #RubyOnRails
[13:31:35] nya: has joined #RubyOnRails
[13:31:45] t0rn: has left #RubyOnRails: ()
[13:32:10] nya: has joined #RubyOnRails
[13:32:32] lxsameer: has joined #RubyOnRails
[13:33:05] benhuda: has joined #RubyOnRails
[13:41:16] sankaber: has joined #RubyOnRails
[13:42:13] sinkensabe: has joined #RubyOnRails
[13:45:48] DEA7TH_: has joined #RubyOnRails
[13:50:33] funnymanva: has joined #RubyOnRails
[13:52:15] sarink: has joined #RubyOnRails
[13:55:32] chridal: I want to decrement all the records in a table by 1 every day, and I was thinking I would do this with a job that is executed by a rake task every day.
[13:56:14] chridal: What I want to run is basically `UPDATE hashtags SET expires=expires-1`
[13:56:22] hazelux: has joined #RubyOnRails
[13:56:26] chridal: Is there a rails way of doing this?
[13:58:35] Papierkorb: chridal: I'd let the DB do that if you don't need to be notified if the expires hits 0 or w/e. But it looks like a TTL mechanism, wouldn't it be easier to set a expires_at datetime and then maybe DELETE all where expires_at < NOW() ?
[13:59:23] DoubleMalt: has joined #RubyOnRails
[14:00:39] Papierkorb: I'm more on the end of letting the database do what it can do well, and that's managing itself. Especially if you have a ton of rows in 'hashtags', for a simple procedure like decrementing some value on each row, fetching the row, decrementing the value in the ruby object, and then doing another request to the DB to set the object sounds like a huge round-trip cost.
[14:00:42] nya: has joined #RubyOnRails
[14:01:01] chridal: Papierkorb: I don't need to know when it happens. When a hashtag is created its expires is set to 7, and then decremented once each day. Once it hits 0 it is deleted. If a hashtag is used in the meantime after creation, it is bumped back up to 7.
[14:01:19] chridal: Yes, indeed.
[14:01:20] Papierkorb: chridal: You can of course do something like: Hashtag.all.each{|hashtag| hashtag.expires -= 1; hashtag.save! } but yeah, then there's the roundtrip for something the DB can do right away
[14:01:57] chridal: How does one do this with the database?
[14:02:17] chridal: I'm using PGSQL and I have never really done anything with the database except through Rails/PHP etc.
[14:02:46] Papierkorb: chridal: well, your SQL code up there looks correct to me.
[14:02:59] chridal: Ah. that's not what I meant. I know SQL.
[14:03:03] chridal: It's just running jobs every 24h etc.
[14:03:05] Papierkorb: you can grab a open connection through ActiveRecord::Base.connection
[14:03:22] chridal: Ah! Because you still mean I should do it through rails.
[14:03:39] Papierkorb: Ah. that. Yeah, issuing the command through rails looks fine to me
[14:03:41] chridal: I thought you meant that those queries should be maintained and run by PGSQL itself.
[14:05:29] Papierkorb: Maybe that's possible, I don't know, I'd prefer to do it where all your code lies so you can see where the UPDATE happens, else it's yet another magic database paradigma..
[14:06:24] Papierkorb: chridal: ActiveRecord::Base.connection.execute "Your SQL statement" # s.a. http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/DatabaseStatements.html#method-i-execute
[14:06:57] Lightsword: has joined #RubyOnRails
[14:07:11] Papierkorb: as soon your rails app is booted you have a database connection and everything if you worry about that
[14:07:36] Creeves: has joined #RubyOnRails
[14:07:43] Papierkorb: So as long your rake tasks boots your app, you should be able to fire the statement right away
[14:08:20] chridal: Yeapp. I'll go for that solution. Thanks!
[14:08:39] chridal: Can you think of any reason to use a expires_at vs. an integer field btw?
[14:08:54] chridal: Since you recommended using that
[14:09:31] srinidhi: has joined #RubyOnRails
[14:09:50] Papierkorb: For me: 1) it's less magic. expires_at is clear, for a TTL field I don't know directly when it happens 2) No further DB magic required. A simple "DELETE FROM hashtags WHERE expires_at < NOW()" suffices.
[14:10:10] paulcsmith: has joined #RubyOnRails
[14:10:19] Papierkorb: 3) if your daily script fails, a expires_at field will recover by itself, a expires TTL field will not
[14:11:06] Papierkorb: recover in the sense that all hashtags older than, say, 7 days are removed. If your script fails to update the TTL, then hashtags may live way longer.
[14:11:33] chridal: Right. That last one is a good argument.
[14:11:34] Papierkorb: 4) It's less load on the database. no daily UPDATE on each row, only individual DELETEs
[14:11:43] chridal: good point *
[14:12:28] chridal: Yea, I should probably just do it like that.
[14:12:31] Papierkorb: If you get a ton of rows in there, you could even add an index to the expires_at field and make the DELETE not having to do a full table scan either
[14:13:01] chridal: That would still be true if I used a TTL column
[14:13:33] Papierkorb: Well, the index is not much worth on the TTL column. you still have to update *each* row, invalidating it each day
[14:13:41] Papierkorb: So it's more of a waste of disk space at that point
[14:13:47] chridal: Right. Didn't think about that.
[14:13:57] chridal: Ok. I'll change the solution. Cheers.
[14:14:37] stantonnet: has joined #RubyOnRails
[14:15:43] Papierkorb: Happy to help. Maybe you can use the freed CPU cycles to reduce your costs or add some other goodie ;)
[14:16:07] Papierkorb: (well, reduce costs for maybe 4 seconds of saved processing time may be a bit over the top hah)
[14:17:11] cornerma1: has joined #RubyOnRails
[14:17:26] chridal: :-D I know I love shaving those seconds.
[14:18:03] chridal: It's sort of like that it is more fun earnign the money, than spending it.
[14:18:24] chridal: Which in turn is sort of like it is more fun anticipating the weekend, than having the weekend.
[14:18:35] arup_r: No idea why getting error RuntimeError (Circular dependency detected while autoloading constant
[14:18:41] arup_r: https://gist.github.com/aruprakshit/25ced45a400b5300cf3e
[14:19:38] Papierkorb: arup_r: https://gist.github.com/aruprakshit/25ced45a400b5300cf3e#file-response-rb-L4 requires Captured, Captured requires Response
[14:19:49] doodlehaus: has joined #RubyOnRails
[14:21:48] arup_r: Papierkorb, well how to fix it ?
[14:22:14] Casty: has joined #RubyOnRails
[14:23:41] Papierkorb: arup_r: move the structure on lines 3-10 to a file which requires all of the classes you reference in the structure.
[14:24:25] Guam: has joined #RubyOnRails
[14:24:59] arup_r: didn't get you :/
[14:25:28] Papierkorb: arup_r: well. So, your code has quite a few circular dependencies. Do you know what a "circular dependency" is?
[14:26:29] timh: has joined #RubyOnRails
[14:27:07] alexhartley: has joined #RubyOnRails
[14:27:25] scatterscript: has joined #RubyOnRails
[14:27:38] Papierkorb: That's fine. I just need to know what I have to explain and what not, else we still sit here tomorrow ;)
[14:29:35] Papierkorb: So, a circular dependency is when you have two structures, which depend on each other. Say you have classes A and B, where A directly accesses B and B directly accesses A. In your case, A and B live in different files. So, now rails tries to autoload A, sees it requires B, so it autoloads B, but this one requires A and now we've gone full circle and it has no clue anymore what to load
[14:30:50] Papierkorb: You need to untangle that so you have a tree structure without these 'circles'. Your example now is interesting in that it actually has A, B and C, which all somehow depend on each.
[14:32:01] arup_r: ok.. got it
[14:32:37] Papierkorb: A = Captured, B = Response, C = RESPONSE_CODE_HANDLERS. You see that A depends on B ("class A < B"). That's fine itself. But now what's up with C? C needs A and thus B while sitting in the file of B. Meh
[14:32:40] krz: has joined #RubyOnRails
[14:32:44] FernandoBasso: has joined #RubyOnRails
[14:33:24] Papierkorb: It gets even better (Read: More complicated) because B requires C (because of def Response::create)
[14:34:14] bruno-: has joined #RubyOnRails
[14:34:25] Papierkorb: A solution would be moving C and Response::create into a new class in its own file
[14:34:56] Papierkorb: Then this new file depends on A and B, but A and B don't need C, and thus we have a nice tree-esque structure again and everyone's happy
[14:35:03] Papierkorb: (Yes, that's called a 'Factory')
[14:35:56] arup_r: ok,, You mean I need to create a factory class you mean.. and I understand it clearly
[14:35:57] Papierkorb: Another solution could be to remove the dependency of A to B, but I guess you had something in mind with that and thus we should leave that be
[14:36:43] Papierkorb: Or if you can get around that, I'd do the latter solution, I'm myself not a huge fan of Factory classes
[14:37:11] arup_r: well what's the second approach ? I didn't get it..
[14:37:37] Papierkorb: arup_r: The second would be having the class Captured, but make it not depend on Response
[14:37:38] arup_r: ok you mean not to use Inheritance ?
[14:37:58] Papierkorb: that would be the second approach, yes. As I said, maybe not the best solution in your case though
[14:38:10] srinidhi: has joined #RubyOnRails
[14:38:24] Papierkorb: I'd start with a Factory class as that's pretty much just moving a bunch of code lines to a new file
[14:38:50] arup_r: Um.. let me go with the first solution. as removal of Inheritance now is lots of code to move around
[14:38:50] Guam: has joined #RubyOnRails
[14:39:16] arup_r: I thought I will use factory method as I have now.. but it hits me hard as we all see :)
[14:39:37] arup_r: It is great learning here for today!
[14:39:53] Papierkorb: well the idea itself was good afterall, it's just the execution that lacked a bit :)
[14:39:57] arup_r: thanks Papierkorb, let me try the first approach
[14:41:41] devdazed: has joined #RubyOnRails
[14:43:55] arup_r: Papierkorb, I am creating a new file lib/knet/transaction/response_factory.rb and putting the code https://gist.github.com/aruprakshit/25ced45a400b5300cf3e#comment-1495717
[14:44:03] arup_r: hope I am following you..
[14:44:18] Papierkorb: Yeah something like that should do
[14:44:28] arup_r: let me try
[14:45:41] arup_r: Papierkorb, most importantly I saved the chat.. as it is very neat explanation.. https://gist.github.com/aruprakshit/25ced45a400b5300cf3e :)
[14:45:55] arup_r: https://gist.github.com/aruprakshit/25ced45a400b5300cf3e#comment-1495719
[14:46:21] Aswebb_: has joined #RubyOnRails
[14:48:40] arup_r: Papierkorb, that's removed.. and it worked
[14:49:04] arup_r: Now I have separate problem.. not realted with this one..
[14:49:18] arup_r: I'll show you
[14:49:28] arup_r: I'm with that since 1 hour..
[14:51:22] deevil: has joined #RubyOnRails
[14:53:09] yardenbar: has joined #RubyOnRails
[14:55:31] arup_r: I am making a gist
[14:55:44] krzkrz: has joined #RubyOnRails
[15:00:14] benhuda: has joined #RubyOnRails
[15:02:06] DoubleMalt: has joined #RubyOnRails
[15:04:19] sinkensabe: has joined #RubyOnRails
[15:05:48] jdayvie: has joined #RubyOnRails
[15:06:08] arup_r: when I am not having the response method, I am redirecting to the third party payment url.. but while I am putting the response method it is not redirecting the the payment url.. how is it happening I have no idea..
[15:06:38] arup_r: any idea what could go wrong ? https://gist.github.com/aruprakshit/0a3a1fe1807560563c6d
[15:08:52] Meerdervoort: has joined #RubyOnRails
[15:11:32] gheegh: has joined #RubyOnRails
[15:11:45] Papierkorb: anything can go wrong
[15:12:10] hazelux: has joined #RubyOnRails
[15:12:42] gheegh: hey all.. i'm trying to authenticate with Google using OAuth2 and i'm gettig invalid credentials error using omniauth and omniauth-google-oauth2.. anyone hit this problem and have suggestions? SO coming up empty..
[15:13:06] Papierkorb: I don't really understand the issue I guess ("not having the response method"?), but I also don't want to wade through hundreds of lines of someone elses code either, especially if it's not open source software
[15:13:44] arup_r: after putting the response method it is not directing to the payment url..
[15:14:01] arup_r: that's what something wired ... I am not able to figure out..
[15:14:15] lindii_: has joined #RubyOnRails
[15:15:28] Papierkorb: byebug to the rescue
[15:15:43] Papierkorb: well, or "raise 'oh shit'" if you prefer to use a webconsole with better_errors
[15:16:03] arup_r: let me try
[15:16:33] arup_r: The thing is when I have response method, I am not seeing the redirection in the log as per this lin https://github.com/narhamah/gobgob-ror/blob/master/app/controllers/payments_controller.rb#L30
[15:16:47] arup_r: it should be there..
[15:16:53] Papierkorb: to be quite honest, I do have to cringe a bit because it seems to be such basic errors (Which'd be fine), but you're handling money in there
[15:17:02] Papierkorb: and that's a 404
[15:17:39] DLSteve: has joined #RubyOnRails
[15:18:36] Papierkorb: Oh and please never ever store nor calculate with money as floating point numbers. That just begs for issues on the long run. It's money. If it were to come down to that, you have the money to pay for maybe 4 bytes more to store it as cents or hundreths of a cent or something
[15:20:36] arup_r: The idea is #create method will redirect to the payment url and then there will be the gateway screen where I'll put information.. and then it will POST to my response url ..
[15:20:39] ariarijp: has joined #RubyOnRails
[15:21:21] arup_r: but with #response inplace the redirection not happening.. and it is coming to the response method.. and all this things are absent in log
[15:21:23] Doddlin: has joined #RubyOnRails
[15:21:26] arup_r: which is surprised to me
[15:21:51] arup_r: but if I don't have response method I am reaching to the payment gateway as expected
[15:22:05] arup_r: let me use byebug now
[15:22:17] arup_r: don't know what to check although really..
[15:24:50] iooner: has joined #RubyOnRails
[15:26:28] r4pha: has joined #RubyOnRails
[15:26:40] Maletor: has joined #RubyOnRails
[15:27:25] cajone: has joined #RubyOnRails
[15:28:04] jdayvie: Hey there - I'm currently working on a project to have admin edit user information if needed. I've been using Devise, have admin as a boolean value within the user model. I setup an admin to be able to delete users but I seem to have issues with making edit work. I have no real code for it yet because I am overall confused. Not looking to code for
[15:28:04] jdayvie: it just an idea how to go about it...because I am lost =( Thanks! =P
[15:28:20] mary5030: has joined #RubyOnRails
[15:29:05] FrankD__: has joined #RubyOnRails
[15:30:34] cajone: has left #RubyOnRails: ()
[15:30:53] arup_r: why we need sometimes `redirect_to tickets_path(@order) and return` for example..?
[15:31:03] arup_r: what return is doing there ?
[15:31:15] mary5030: has joined #RubyOnRails
[15:32:07] chinmay_dd: has joined #RubyOnRails
[15:32:30] balr0g: has joined #RubyOnRails
[15:34:10] suffice: has joined #RubyOnRails
[15:36:45] nickenchuggets: has joined #RubyOnRails
[15:36:45] nickenchuggets: has joined #RubyOnRails
[15:37:51] arup_r: Papierkorb, I used `raise 1.inspect` just before the redirect_to line.. and it raised.. so it is going there
[15:37:54] Rubie: has joined #RubyOnRails
[15:38:03] arup_r: but something happened which is hidden after that
[15:38:16] arup_r: btw, why the log is not showing this ?
[15:40:48] arup_r: I checked in the browser Network tab .. no redirect url is there..
[15:41:25] dopie: has joined #RubyOnRails
[15:50:13] seank_: has joined #RubyOnRails
[15:53:02] Papierkorb: you're looking at the wrong logs and you're on the wrong server
[15:54:38] flori: has joined #RubyOnRails
[15:54:40] Guam: has joined #RubyOnRails
[15:55:33] darrik: has joined #RubyOnRails
[15:57:35] _fortis: has joined #RubyOnRails
[15:58:34] lalalaaa: has joined #RubyOnRails
[15:58:58] krz: has joined #RubyOnRails
[16:00:20] htmldrum: has joined #RubyOnRails
[16:01:53] jhack32: has joined #RubyOnRails
[16:06:42] charliesome: has joined #RubyOnRails
[16:06:51] dcope: has joined #RubyOnRails
[16:07:31] htmldrum: has joined #RubyOnRails
[16:09:48] tuelz: has joined #RubyOnRails
[16:10:52] arup_r: Papierkorb, i got the reason
[16:11:11] arup_r: I am on the correct server..
[16:12:03] arup_r: Guys for all of you... NEVER define a action `response` inside your controller.. it will give you TROUBLE!
[16:12:36] arup_r: Papierkorb, I changed the action name to `payment_response` ... all is working..
[16:12:44] givanse: has joined #RubyOnRails
[16:12:54] Papierkorb: Ah. The fun of meta programming.
[16:13:06] Papierkorb: Sometimes magic, and other times magically blows up
[16:16:59] JeramyRR: has joined #RubyOnRails
[16:19:53] arup_r: humm Papierkorb
[16:20:04] arup_r: that logs was giving me this hint
[16:20:23] arup_r: so I though lets change the name and see
[16:20:29] arup_r: and it worked
[16:21:59] benhuda: has joined #RubyOnRails
[16:27:05] mary5030: has joined #RubyOnRails
[16:27:09] htmldrum: has joined #RubyOnRails
[16:27:14] nfk: has joined #RubyOnRails
[16:27:29] timh: has joined #RubyOnRails
[16:28:16] mary5030: has joined #RubyOnRails
[16:31:41] Guam: has joined #RubyOnRails
[16:32:26] dopie: has joined #RubyOnRails
[16:33:50] Lightsword: has joined #RubyOnRails
[16:34:17] htmldrum: has joined #RubyOnRails
[16:34:23] chinmay_dd: has joined #RubyOnRails
[16:35:34] relix: has joined #RubyOnRails
[16:37:28] bronson: has joined #RubyOnRails
[16:38:05] Guam: has joined #RubyOnRails
[16:41:45] workmad3: has joined #RubyOnRails
[16:41:52] Guam: has joined #RubyOnRails
[16:45:03] Meerdervoort: has left #RubyOnRails: ("Ik ga weg")
[16:47:14] jhack32: has joined #RubyOnRails
[16:49:57] smathy: jdayvie, how is the solution not just doing the same for edit/update that you did for delete?
[16:51:15] Maletor: has joined #RubyOnRails
[16:52:20] Anakat: has joined #RubyOnRails
[16:52:42] smathy: "NEVER define a action `response` inside your controller" - LOL :) `params` is another method name you should avoid.
[16:52:48] hfp: has joined #RubyOnRails
[16:53:18] hfp_work: has joined #RubyOnRails
[16:53:36] jdayvie: smathy: Because I would need access to that edit page of a particular id/use and then not require a password if the admin is editing the information. I suppose its the same general idea but the routing and path are what confuses me the most.
[16:54:23] workmad3: has joined #RubyOnRails
[16:54:44] nfk: has joined #RubyOnRails
[16:55:39] jdayvie: I had it working at one point where the URL changed with the ID; however, it only brought up my own edit. Although I now realize I may just have to allow current user and admin for edit and update purposes.
[16:58:11] deevil: jdayvie: have you considered somehting like using a javascript library to edit each individual field.. I like using x-editable for things like an admin page that allows editing users..
[16:58:39] sinkensabe: has joined #RubyOnRails
[16:58:43] deevil: jdayvie: I make one action in the controller that all the fields post to via ajax
[16:59:12] doodlehaus: has joined #RubyOnRails
[16:59:39] jdayvie: Deevil - No, I have not thought about that. I suppose I could research that a bit too =P
[17:00:37] deevil: jdayvie: it???s pretty straightforward.. a few lines of JS for fields, and then the one controller action that handles updating whichever field is posted..
[17:02:31] tuelz: has joined #RubyOnRails
[17:02:46] jdayvie: Deevil - You are referring to using this method for the admin portion only, correct? Create the inputs and then if admin changes a name from Joe to Mike, that would be relayed to the corresponding user and update it.
[17:04:54] deevil: jdayvie: yes, exactly.. rather than having the admin press ???submit??? and update the entire User object, you post user.id and the name of the field and the value, so you???d send { id: 2, field: ???name???, value: ???Mike??? } via ajax, and the controller action finds the user and then does @user[params[:field]] = params[:name]
[17:07:02] deevil: jdayvie: just make sure to validate the privileges, etc., if you allow users to use a solution like this as well.. I make an array and list which fields are editable, so I can do something like if %w[ name, address1, address2, phone, email ].include?(params[:field]) to ensure that they???re updating fields that are allowed to be updated.. don???t want someone posting admin=1, etc.. ;)
[17:07:18] devdazed: has joined #RubyOnRails
[17:07:42] wydont: has joined #RubyOnRails
[17:07:48] jdayvie: That actually makes sense (and seems much easier) - Problem is, I have zero knowledge of AJAX at the moment.
[17:09:27] jdayvie: deevil: Users would not be allowed this way - That would remain how it is now, but just for admin. Do you know of any site/page that may have more information on this to read up on?
[17:10:05] deevil: jdayvie: are you using jQuery in you project?? it makes it pretty simple to make ajax calls.. and x-editable defaults to submitting over ajax anyways, so really, you???re just making the controller action to process updating the various fields and adding x-editable into the mix.. I can put something up on pastebin if it helps you..
[17:10:29] eggoez: has joined #RubyOnRails
[17:10:31] jdayvie: deevil: Yes, I am currently using jQuery. Not much right now, but in one or two ways yes.
[17:11:21] deevil: jdayvie: cool, let me put a few things into pastebin from one of my projects that uses this approach..
[17:11:28] jdayvie: deevil: x-editable defaults -> No idea what that means. If you do, that would be a great help. I have some understanding of what you are referring to but again, lost with AJAX.
[17:11:39] jdayvie: Deevil: I appreciate it =)
[17:11:57] arup_r: any idea why am I getting this error Can't verify CSRF token authenticity --- https://gist.github.com/aruprakshit/43f0d622399b4d8de799
[17:12:12] deevil: jdayvie: I was just saying that if you used x-editable, by default, it wants to send the changed data to a controller action via ajax.
[17:12:16] qejk: has joined #RubyOnRails
[17:13:17] jdayvie: Just googled x-editable and I see what you mean =P
[17:13:35] seank_: has joined #RubyOnRails
[17:13:46] deevil: arup_r: it???s because your form doesn???t have the hidden field for the CSRF token. use <% form_for ??? %> to have it automatically there.. if posting via ajax, for instance, there are a few ways you can work aroud the CSRF.. I prefer embedding the token in the page as a javascript variable, and then passing it with the form post.
[17:16:09] arup_r: deevil, I forgot to say you.. this is being done by a third party payment gateway... to my app
[17:16:27] arup_r: so no idea how they are doing the POST request
[17:18:39] hashrocket: has joined #RubyOnRails
[17:18:39] deevil: arup_r: oh, then you???ll need to disable it entirely with a before_filter??? skip_before_action :verify_authenticity_token, :only => :your_controller_action
[17:18:57] deevil: arup_r: put that at the beginning of your controller..
[17:19:42] arup_r: if I do it. then nothing is being POST ed and it is sending me to the error url https://gist.github.com/aruprakshit/43f0d622399b4d8de799#file-payments_controller-rb-L24
[17:19:52] arup_r: let me try once again
[17:20:09] jdayvie: deevil - No rush, just let me know when its up. I will be around working on some stuff =) I appreciate it again!
[17:20:41] deevil: jdayvie: almost have it ready for you.. pastebin url inbound shortly. :)
[17:21:54] jdayvie: Thanks again =)
[17:25:53] arup_r: deevil, I did what you said, and no POST request didn't happen.. no log in the console
[17:26:27] toretore: has joined #RubyOnRails
[17:29:00] deevil: arup_r: seems like the remote server didn???t post then..?
[17:29:38] arup_r: and if I remove the line you suggested... then I will it does the POST with the error as I said
[17:30:49] mikeric: has joined #RubyOnRails
[17:31:22] deevil: arup_r: not sure why that would have stopped the post.. you put it before your first ???def ??? end???, right?
[17:32:48] arup_r: deevil, yes https://gist.github.com/aruprakshit/43f0d622399b4d8de799
[17:34:16] qejk: has joined #RubyOnRails
[17:34:49] deevil: arup_r: very weird.. http://api.rubyonrails.org/classes/ActionController/RequestForgeryProtection/ClassMethods.html
[17:35:41] arup_r: yes.. I checked it
[17:38:41] konsolebox: has joined #RubyOnRails
[17:40:01] Arpho: has joined #RubyOnRails
[17:42:22] deevil: arup_r: not sure why it???s not working then..
[17:42:41] crdpink2: has joined #RubyOnRails
[17:45:03] rogue_koder: has joined #RubyOnRails
[17:48:11] arup_r: deevil, you there still?
[17:48:25] deevil: arup_r: yeah, what???s up?
[17:48:52] arup_r: it seems I am missing something.. they said after getting response I need to redirect_to : https://gist.github.com/aruprakshit/43f0d622399b4d8de799#comment-1495805
[17:48:53] workmad3: has joined #RubyOnRails
[17:49:00] arup_r: any idea what it says
[17:49:06] arup_r: just a hints
[17:50:20] arup_r: I updated the comment
[17:50:33] funnymanva: has joined #RubyOnRails
[17:51:55] zorak8: has joined #RubyOnRails
[17:56:22] arooni-mobile: has joined #RubyOnRails
[18:00:46] erihel: has joined #RubyOnRails
[18:01:56] hfp: has joined #RubyOnRails
[18:02:26] hfp_work: has joined #RubyOnRails
[18:03:53] yuuvee: has joined #RubyOnRails
[18:03:57] allcentury: has joined #RubyOnRails
[18:05:07] relix: has joined #RubyOnRails
[18:05:33] funnymanva: has joined #RubyOnRails
[18:06:22] heyts: has joined #RubyOnRails
[18:07:08] arup_r: any body knows php ? I am translating one php project to Rails ... one page not getting what is it doing ?
[18:07:53] arup_r: https://gist.github.com/aruprakshit/71f2eba198178937abd9
[18:08:13] arup_r: is it doing GET request ?
[18:10:39] deevil: arup_r: Those are all POSTed variables in the PHP
[18:11:02] arup_r: ys,, after that ?
[18:11:34] deevil: arup_r: lines 3-14 are setting vars from their POSTed values.. consider them link non-@ vars in ruby.
[18:12:23] mike___1234: has joined #RubyOnRails
[18:12:28] deevil: arup_r: and the $result_params, treat the ???.??? like ???+??? in ruby.. simple code, really..
[18:13:02] krz: in the controller. before_action { |controller| controller.item_param_policy(action_name) }. also in the controller is the item_param_policy method. under private. why is rails complaining with: private method `item_param_policy' called
[18:13:21] krz: is before_action outside the scope of the private methods?
[18:13:32] shyshy: has joined #RubyOnRails
[18:14:38] GeissT_: has joined #RubyOnRails
[18:15:43] arup_r: i m trying to understand https://gist.github.com/aruprakshit/71f2eba198178937abd9#file-result-php-L42 with https://gist.github.com/aruprakshit/43f0d622399b4d8de799#comment-1495805
[18:15:50] arup_r: deevil, ^^
[18:15:56] tlarevo: has joined #RubyOnRails
[18:16:00] deevil: arup_r: looking at them now
[18:16:04] mxrguspxrt: has joined #RubyOnRails
[18:21:51] deevil: arup_r: I posted a comment.. you had a ??????? where there should be a ???&???..?
[18:23:09] crdpink: has joined #RubyOnRails
[18:23:16] arup_r: no.. It will be like that only.. no idea if it is a POST or GET
[18:24:06] arup_r: https://gist.github.com/aruprakshit/71f2eba198178937abd9#file-result-php-L39
[18:25:43] timh: has joined #RubyOnRails
[18:26:20] deevil: arup_r: my bad, I mis-read that. yeah, you???re right.. it looks like result.php is just building up the redirect url and then echoing it out, so whatever called result.php will take it???s output and then either GET or POST the URL
[18:26:59] arup_r: did you work on PhP ever? Myself never
[18:27:36] gambl0re: has joined #RubyOnRails
[18:32:11] deevil: arup_r: Worked on PHP for longer than Rails, and I was using Rails in the beta days. ;)
[18:33:29] hfp: has joined #RubyOnRails
[18:33:45] deevil: arup_r: now I only deal with PHO when I absolutely have to, lol..
[18:33:59] hfp_work: has joined #RubyOnRails
[18:34:15] arup_r: deevil, can i pm you?
[18:34:22] deevil: arup_r: yeah!
[18:34:25] rogue_koder: has joined #RubyOnRails
[18:40:29] jenrzzz: has joined #RubyOnRails
[18:46:04] kadoppe: has joined #RubyOnRails
[18:46:32] arooni-mobile: has joined #RubyOnRails
[18:48:10] PhantomSpank: has joined #RubyOnRails
[18:53:04] Aswebb_: has joined #RubyOnRails
[18:53:48] workmad3: has joined #RubyOnRails
[18:54:27] lethjakman: has joined #RubyOnRails
[18:59:04] ChadyG: has joined #RubyOnRails
[19:00:03] doodlehaus: has joined #RubyOnRails
[19:03:45] BenMorganIO: has joined #RubyOnRails
[19:05:15] RatelDev: has joined #RubyOnRails
[19:07:17] FrankD__: has joined #RubyOnRails
[19:07:23] eminencehc_: has joined #RubyOnRails
[19:11:47] chouhoulis: has joined #RubyOnRails
[19:13:29] FrankD__: hey, could someone point me in the right direction for find_by_* to set global variables that can be later used? gist (I want line 53 to work): https://gist.github.com/fdimitri/d8cdc69f493c96a13d0f
[19:14:45] rhizome: line 53 says "end"
[19:15:16] Anakat: has joined #RubyOnRails
[19:16:33] FrankD__: sorry, line 59
[19:17:12] FrankD__: which calls the function on line 27
[19:17:14] Rubie: has joined #RubyOnRails
[19:17:18] Denarii: FrankD__: your lack of adherence to Ruby naming standards makes me sad
[19:17:32] FrankD__: Denarii, I'm sure :P
[19:18:01] FrankD__: its a language that i speak with a poor accent
[19:18:43] FrankD__: how can I set @directoryEntry in DirectoryEntryHelper when I use DirectoryEntryHelper.find_by
[19:19:08] rhizome: getDirectory only appears once on that page, in the method you're asking for help with
[19:19:51] FrankD__: getDirectory is irrelevant, i wasnt goign to paste a thousand lines of source to go through.. getDirectory only strips the filename out of a directory/filename
[19:20:40] Denarii: Get rid of @directoryEntry and use self?
[19:20:49] rhizome: what is relevant, then? you have one line that calls #rename, and that method is the first thing #rename does
[19:20:57] FrankD__: good call :P
[19:21:02] rhizome: i guess i'm not sure what your question is
[19:21:13] FrankD__: my question was:
[19:21:17] FrankD__: how can I set @directoryEntry in DirectoryEntryHelper when I use DirectoryEntryHelper.find_by
[19:23:31] rhizome: so...fEntry? i think this is all too clever for me
[19:23:45] bronson: has joined #RubyOnRails
[19:23:46] Denarii: You've inherited from DirectoryEntry so when you use find_by on DirectoryEntryHelper you should be able to just use self instead of storing a separate instance of the directory entry in an instance variable.
[19:24:05] FrankD__: Denarii, yup, gotchya, thanks so much
[19:24:51] Pupeno: has joined #RubyOnRails
[19:24:51] Pupeno: has joined #RubyOnRails
[19:25:03] devdazed: has joined #RubyOnRails
[19:26:08] FrankD__: i should have a ruby guy refactor all my code :p
[19:27:22] heyts: has joined #RubyOnRails
[19:28:26] towski_: has joined #RubyOnRails
[19:30:13] Casty: has joined #RubyOnRails
[19:32:03] FrankD__: Denarii, what ruby naming conventions/standards am i violating? :P
[19:34:27] blindMoe: has joined #RubyOnRails
[19:35:18] jfelchner: has joined #RubyOnRails
[19:35:23] blindMoe: Is it possible to read a specific record from a CSV file w/o loading the entire file into memory or stepping through it line by line? I would just read that line in the from the file then parse it as CSV but some of the records are multi-line in the file so it wouldn't be accurate
[19:39:23] jdayvie: has joined #RubyOnRails
[19:42:02] jhass: blindMoe: how would you know the byte offset of the line?
[19:42:35] blindMoe: jhass: good point.. either way it wouldn't work that way so I am guessing I have to loop through all the records until I hit the one I want
[19:49:36] vere: has joined #RubyOnRails
[19:50:01] nickenchuggets: has joined #RubyOnRails
[19:51:39] martinbjeldbak: has joined #RubyOnRails
[19:52:54] Denarii: FrankD__: snake case for variables and methods, pascal case for modules and classes
[19:53:20] Pupeno: has joined #RubyOnRails
[19:53:46] Denarii: well, you've got the latter right
[19:54:48] vere: has joined #RubyOnRails
[19:55:06] bin_005: has joined #RubyOnRails
[19:55:52] platosha: has joined #RubyOnRails
[19:56:28] FrankD__: Denarii, ahh :)
[19:57:18] mculp: has joined #RubyOnRails
[19:57:18] DoctorMonocular: has joined #RubyOnRails
[19:57:35] FernandoBasso: has joined #RubyOnRails
[19:57:56] FrankD__: I'm sure much of my other code is far more disgusting/non-optimal
[19:59:53] nya: has joined #RubyOnRails
[20:02:13] bruno-: has joined #RubyOnRails
[20:02:26] Schalla: has joined #RubyOnRails
[20:02:33] quarters: has joined #RubyOnRails
[20:03:25] Schalla: Good evening! Currently somewhat confused, trying to set a cookie in my Controller with cookies[:token] = "token", now I cannot see him in my browser debugger.
[20:03:28] infoget: has joined #RubyOnRails
[20:03:28] Schalla: Anything I missed?
[20:03:43] Sammie_: has joined #RubyOnRails
[20:04:51] eggoez: has joined #RubyOnRails
[20:04:58] Schalla: https://gist.github.com/DSchalla/be3a07761eade8afe002
[20:05:03] Schalla: ^ to be more precise what I am doing exactly
[20:05:13] Schalla: (the json response is only for debugging purpose)
[20:05:20] bricker: has joined #RubyOnRails
[20:05:26] rhizome: not sure it takes a hash like that
[20:05:55] Schalla: Aw, that's a good idea.
[20:05:56] Schalla: sec trying to_s
[20:07:18] Schalla: nvm, was just my browser extension being dump. Works also without string conversion
[20:07:32] Schalla: Thanks for taking a look, rhizome
[20:09:55] workmad3: has joined #RubyOnRails
[20:14:01] rogue_koder_: has joined #RubyOnRails
[20:18:00] quarters: hello. Does the flow of messages in the command line upon typing 'rails server' have a name?
[20:18:28] quarters: showing the activity of a rails app that is
[20:18:38] l0oky: has joined #RubyOnRails
[20:19:53] martinbjeldbak: has joined #RubyOnRails
[20:20:03] Leef_: has joined #RubyOnRails
[20:20:05] rhizome: quarters: output
[20:20:05] Papierkorb: quarters: it's probably the log
[20:20:20] l0oky: Is it possible to run rails app on apache server?
[20:20:22] Papierkorb: well, if you're using the default webrick server with no mods to silence it
[20:20:33] Papierkorb: l0oky: see passenger
[20:20:37] rhizome: l0oky: yes, with passenger
[20:20:56] idd2d: has joined #RubyOnRails
[20:21:19] l0oky: I saw It but I was wondering If I can do it on some cheap or free shared host like 000webhost.com
[20:21:38] rhizome: never heard of them
[20:22:01] l0oky: Anyways just a simple free apache server.. Is it possible to run rails app on it?
[20:22:18] l0oky: All I have is ftp to it though..
[20:22:19] Papierkorb: if they let you install apache modules (which would be insane), then yes. If they support it out of the box, yes. if you can run your own stuff through a shell session, yes. Else, probably not.
[20:22:20] rhizome: that's a conversation you need to have with them
[20:22:48] l0oky: Papierkorb: Thanks that what I needed to know :)
[20:27:11] giowong: has joined #RubyOnRails
[20:29:00] Anakat_: has joined #RubyOnRails
[20:29:16] infoget: Hi guys, I'm working on activation of an account after registration, is it secure from security point (sqli) when it's directly looking for a token (not hashed) in user model? uri looks like this: example.com/activation/<token> Or is better first look for a email address and then check if token (hashed) is valid?
[20:30:20] l0oky: has joined #RubyOnRails
[20:30:58] yfeldblum: has joined #RubyOnRails
[20:31:56] cac_: has joined #RubyOnRails
[20:32:56] doodlehaus: has joined #RubyOnRails
[20:33:22] Papierkorb: infoget: well, in general, the more (well implemented) checks the better?
[20:33:35] user1138: has joined #RubyOnRails
[20:34:47] user1138: What is the best resource to begin learning RoR with no prior programming knowledge?
[20:35:00] GnuYawk: has joined #RubyOnRails
[20:37:59] rhizome: infoget: this might cover some of your concerns, not directly activation tho:
[20:38:02] rhizome: http://sakurity.com/blog/2015/03/27/slack_or_reset_token_hashing.html
[20:39:20] Papierkorb: "Attackers can reset victim???s password, fetch the reset_token value from database they have read access to" wait, if they have this kind of access, I'd say you're already fucked
[20:41:50] rhizome: in the way that being subject to a vuln, known or not, makes you already fucked
[20:41:58] Aswebb_: has joined #RubyOnRails
[20:44:09] l0oky: !language
[20:44:42] rhizome: here in #rubyonrails we are "edgy" and "with-it"
[20:45:00] Papierkorb: rhizome: he already left :(
[20:45:21] Papierkorb: can't save everyone I guess
[20:45:30] rhizome: no guessing necessary
[20:46:59] infoget: ok, but when I set time period, let's say 2hrs, then it should to be secure, right?
[20:47:33] jenrzzz: has joined #RubyOnRails
[20:47:39] quarters: I was wondering why I get the error message about there being a template missing when I include a respond_to block in the create method implementation
[20:47:50] quarters: I have the file and message here: https://bitbucket.org/snippets/zebralight/Roo64
[20:49:22] rhizome: you have to remove that respond_to block
[20:49:42] quarters: how to format it so that I can have it handle json requests?
[20:49:45] rhizome: i think you may think it does something different than what it does
[20:50:00] quarters: while also handling html requests
[20:50:08] rhizome: look up respond_with
[20:50:13] quarters: if accessed through the browser
[20:51:07] SegFaultAX: has joined #RubyOnRails
[20:51:27] infoget: rhizome: I mean, when user's password_reset_token is generated, then the token will be valid only 2hrs, after this time attacker can't change password
[20:52:15] rhizome: setting a time limit is more secure than not i guess, sure
[20:52:19] shyshy: has joined #RubyOnRails
[20:53:10] johntrails: has joined #RubyOnRails
[20:53:51] ur5us: has joined #RubyOnRails
[20:54:35] _solomon: has joined #RubyOnRails
[20:56:05] yfeldblum: has joined #RubyOnRails
[20:56:19] VeryBewitching: has joined #RubyOnRails
[20:56:55] Pupeno: has joined #RubyOnRails
[21:01:20] framling: has joined #RubyOnRails
[21:04:27] ruurd: has joined #RubyOnRails
[21:05:24] htmldrum: has joined #RubyOnRails
[21:08:04] sinkensabe: has joined #RubyOnRails
[21:10:26] htmldrum: has joined #RubyOnRails
[21:12:42] Freebird: has joined #RubyOnRails
[21:13:06] Freebird: has left #RubyOnRails: ()
[21:14:45] xkickflip_: has joined #RubyOnRails
[21:16:36] El3ktra: has joined #RubyOnRails
[21:16:36] El3ktra: has joined #RubyOnRails
[21:18:56] Rubie: has joined #RubyOnRails
[21:23:16] quarters: is there a site that allows you to view http requests posted as json?
[21:27:13] idd2d: has joined #RubyOnRails
[21:28:18] Papierkorb: quarters: what do you mean?
[21:28:29] MaDErroR123: has joined #RubyOnRails
[21:30:09] MrBeardy: has joined #RubyOnRails
[21:30:52] max: has joined #RubyOnRails
[21:32:12] vickleton: has joined #RubyOnRails
[21:34:07] rhizome: none of your business
[21:35:46] eminencehc_: has joined #RubyOnRails
[21:40:36] aaronr: has joined #RubyOnRails
[21:40:54] zorak8: has joined #RubyOnRails
[21:43:34] tekk: has joined #RubyOnRails
[21:49:42] quarters: Papierkorb: I don't think I know what I'm talkign about
[21:50:23] quarters: I've been puzzling over working with a session controller to accept json http requests but for some reason, it's being a total PITA
[21:50:26] Papierkorb: quarters: ??\_(???)_/??
[21:50:45] quarters: Rails isn't parsing the string as it should
[21:50:48] Papierkorb: So you mean the POST data being JSON I guess
[21:51:23] Papierkorb: quarters: afaik that's done by a middleware, which is enabled by default (at least was for me with a new project in Rails4.2)
[21:52:01] quarters: I posted a thread about it here: http://stackoverflow.com/questions/31495323/json-post-request-for-rails-4-0-app-gives-response-code-500
[21:52:24] quarters: I must've spent hours if not at least a full day on this
[21:52:33] quarters: I feel like it should be something super simple
[21:53:06] quarters: there are at least 10 tutorials on how to make this work, but none of them have worked for me
[21:53:08] centrx: has joined #RubyOnRails
[21:53:32] Papierkorb: Your login view won't use JSON, it'll use urlencoded data or multiform encoded data
[21:54:21] quarters: right. but I have a app that wants to talk with my Rails app using JSON
[21:54:39] quarters: and so I'd like to maintain browser login functionality while allowing this other app to talk to my Rails server
[21:54:52] Papierkorb: quarters: as one of the commenters said, did you send the appropriate content type header?
[21:55:04] Papierkorb: ah there it is
[21:55:27] Papierkorb: quarters: could you invoke that curl line with "-v" and pastie.net the result?
[21:55:27] Maletor: has joined #RubyOnRails
[21:55:50] quarters: I didn't paste the result, but I can pastie it now
[21:55:54] quarters: this is for the passing test
[21:56:45] LiquidInsect: has joined #RubyOnRails
[21:57:07] quarters: http://pastie.org/10300228
[21:57:54] Papierkorb: quarters: where can I see what exactly the request headers, request body, response headers and response bodies were?
[21:58:05] deevil: has joined #RubyOnRails
[21:58:06] blindMoe: anyone know if there is a way to grab just the header row w/ SmarterCSV?
[22:00:39] ruurd: has joined #RubyOnRails
[22:00:44] quarters: Papierkorb: oh. I just realized that it this was after I reenabled CSRF authorization
[22:00:48] quarters: let me do it again
[22:01:17] quarters: Papierkorb: http://pastie.org/10300233
[22:01:27] quarters: this is all that showed up int the log/outpu
[22:01:45] Papierkorb: quarters: please give me the output from a curl proper request including headers (-v switch)
[22:01:57] Papierkorb: Apart from that, it looks fine
[22:02:04] Papierkorb: What's the issue now?
[22:03:14] stantonnet: has joined #RubyOnRails
[22:04:26] user1138: has joined #RubyOnRails
[22:07:15] quarters: Papierkorb: https://bitbucket.org/snippets/zebralight/z9964
[22:07:26] quarters: pastie wouldn't accept it :)
[22:07:44] JoshL: has joined #RubyOnRails
[22:07:44] quarters: I've never used curl until this thread
[22:07:45] Papierkorb: and where's now the -v part visible?
[22:08:26] quarters: Papierkorb: I don't think I follow
[22:08:30] Papierkorb: $ curl -v -H "Content-Type: application/json" -X POST -d '{"session":{"email":"user@example.com", "password":"yourpass", "remember_me":"0"}}' http://localhost:3000/login
[22:08:46] quarters: I didn't include what I typed it
[22:08:46] Papierkorb: you didn't pass '-v'
[22:08:51] quarters: just the output
[22:09:06] Papierkorb: else it would've also written the reply and response headers
[22:09:47] quarters: curl -H -v "Content-Type: application/json" -X POST -d '{"session":{"email":"user@example.com", "password":"aaaaaa", "remember_me":"0"}}' http://localhost:3000/login
[22:09:56] quarters: that's how I passed -v
[22:10:05] quarters: should've I put it in front of the -H?
[22:10:15] user1138: has joined #RubyOnRails
[22:10:36] Papierkorb: -H expects its value after itself. it's interesting that curl even did something and didn't bail out
[22:11:39] quarters: oh yeah, this is much smaller: http://pastie.org/10300237
[22:12:31] user1138: has joined #RubyOnRails
[22:12:45] Papierkorb: what does the route look like for /login ?
[22:13:18] quarters: post 'login' => 'sessions#create'
[22:13:32] Papierkorb: other than that, your request looks fine doesn't it? on success, you have redirect_to user, and curl shows a redirect to /users/1
[22:13:53] Papierkorb: Else it would have shown a 200 OK reply
[22:14:13] Papierkorb: So rails did parse the JSON for you and you did successfully log in
[22:14:26] quarters: when using curl
[22:14:35] quarters: but not from the other app
[22:14:49] Papierkorb: Yes, but that shows that the issue is in that Objective-C bikeshed and not in rails ;)
[22:15:07] Papierkorb: Obj-C really does look like frankenstein drove a car against the wall
[22:15:07] rhizome: compare the log lines for each, params, etc.
[22:15:17] Papierkorb: quarters: it most likely is the missing Content-Type header
[22:15:17] quarters: I thought that I can address this in Rails alone
[22:15:36] quarters: I included 'application/json"
[22:16:05] quarters: I guess that's why I was looking for a website to target with my Obj-C app
[22:16:20] quarters: so that i can see what the http request looks like
[22:16:24] Papierkorb: quarters: well, tell me the value you're setting for the Content-Type request header inside Obj-C
[22:16:25] quarters: if that's even possible
[22:16:36] thang: has joined #RubyOnRails
[22:16:41] deevil: has joined #RubyOnRails
[22:16:48] quarters: 'application/x-www-form-urlencoded'
[22:17:00] Papierkorb: quarters: And what should it be instead?
[22:17:16] quarters: oh, it shouldn't be that?
[22:17:22] quarters: *getting excited*
[22:17:27] Papierkorb: quarters: I mean you can also use that, if you send urlencoded data. but judging from your variable names, you're sending JSON data
[22:18:06] Papierkorb: quarters: look at that header where I just told you it's wrong. Now look hard at the curl command. Now look back
[22:18:13] Papierkorb: I'm sitting on a horse, durr
[22:18:28] Papierkorb: Christ I shouldn't be here during saturday night I suppose
[22:18:41] quarters1: has joined #RubyOnRails
[22:19:20] centrx: If you're on a horse
[22:19:43] Papierkorb: quarters_: [00:18] <Papierkorb> quarters: look at that header where I just told you it's wrong. Now look hard at the curl command. Now look back
[22:20:11] Papierkorb: quarters_: Maybe that too [00:17] <Papierkorb> quarters: I mean you can also use that, if you send urlencoded data. but judging from your variable names, you're sending JSON data
[22:21:39] Pupeno: has joined #RubyOnRails
[22:23:05] quarters1: has left #RubyOnRails: ()
[22:23:17] quarters: has joined #RubyOnRails
[22:23:39] quarters: timed out at just the right time :P
[22:24:10] quarters: Papierkorb: thank you
[22:24:28] quarters: I feel like I'm getting closer now. Ichanged the content-type to 'application/json' too
[22:24:59] bronson: has joined #RubyOnRails
[22:25:33] duncannz: has joined #RubyOnRails
[22:25:46] quarters: I'm now getting this error: http://pastie.org/10300250
[22:30:36] stantonnet: has joined #RubyOnRails
[22:30:49] Aswebb_: has joined #RubyOnRails
[22:33:33] Pupeno: has joined #RubyOnRails
[22:33:45] Pupeno: has joined #RubyOnRails
[22:34:48] doodlehaus: has joined #RubyOnRails
[22:35:43] infoget: has joined #RubyOnRails
[22:42:29] Pupeno: has joined #RubyOnRails
[22:43:18] Lytol: has joined #RubyOnRails
[22:46:01] quarters: has joined #RubyOnRails
[22:46:54] Rubie: has joined #RubyOnRails
[22:48:02] quarters: is there a way to have the redirect_to bit and render a page through html but not do anything in json?
[22:50:28] Papierkorb: quarters: render nothing: true
[22:50:35] Lytol: has joined #RubyOnRails
[22:50:48] Papierkorb: quarters: or e.g.: head status: 200
[22:51:14] fighella: has joined #RubyOnRails
[22:51:28] sinkensabe: has joined #RubyOnRails
[22:51:29] Papierkorb: quarters: afaik JSON demands double-quotes, and not single-quotes, to be used in the document
[22:51:39] Papierkorb: if that issue is still there
[22:52:41] quarters: Papierkorb: I found a way to submit a hash/dictionary from objective c instead of a string. There was another thread that suggested doing it using a hash, but that one didn't work for me
[22:52:50] quarters: I think I'm getting really close now
[22:52:52] quarters: thank you so much
[22:53:18] quarters: this was a real nightmare and a half
[22:53:37] quarters: but you just attacked it head on
[22:53:42] Papierkorb: Well it's Obj-C, what did you expect?
[22:54:01] quarters: true true :)
[22:54:04] Papierkorb: I'd use K&R C over that
[22:54:35] quarters: it's pretty bloated
[22:55:24] Papierkorb: [:[this would] give me nightmares]
[22:55:49] Papierkorb: it's not a array! It's neither a call! It's a .. array call thingy!
[22:56:05] Lytol: has joined #RubyOnRails
[22:56:50] quarters: what language is that?
[22:56:56] dopie: has joined #RubyOnRails
[22:57:16] Papierkorb: that's what Obj-C is to me
[22:57:46] Papierkorb: apart from "lol you better use it or your work is for the trash" apple.
[22:58:25] Sammie___: has joined #RubyOnRails
[22:58:25] centrx: Swift 2 looks good
[22:58:25] zeitue: has joined #RubyOnRails
[23:00:04] quarters: Papierkorb: if I add "render nothing: true" upon log in, can redirect_to still work via html?
[23:00:44] Papierkorb: quarters: as long only one of them is hit, yes. also, you should use "head status: :ok" to make it clearer what's going on
[23:01:01] Papierkorb: quarters: e.g. by using a respond_to block
[23:01:36] arBmind: has joined #RubyOnRails
[23:01:52] Pupeno: has joined #RubyOnRails
[23:05:50] Exuma: has joined #RubyOnRails
[23:11:20] _utah_: has joined #RubyOnRails
[23:14:15] mxrguspx_: has joined #RubyOnRails
[23:14:51] fighella: has joined #RubyOnRails
[23:15:08] htmldrum: has joined #RubyOnRails
[23:17:53] momomomomo: has joined #RubyOnRails
[23:21:22] _utah_: has joined #RubyOnRails
[23:21:23] relix: has joined #RubyOnRails
[23:22:01] mike___1234: has joined #RubyOnRails
[23:22:49] cac_: has joined #RubyOnRails
[23:23:29] charliesome: has joined #RubyOnRails
[23:25:53] ss_much: has joined #RubyOnRails
[23:28:03] CheckYourSix: has joined #RubyOnRails
[23:36:32] totimkopf: has joined #RubyOnRails
[23:37:30] arooni-mobile: has joined #RubyOnRails
[23:39:00] GeissT: has joined #RubyOnRails
[23:40:49] totimkopf: is there an advantage of using pry over byebug and vice versa for debugging?
[23:41:15] jhass: it's not an either or, byebug integrates nicely into pry, see pry-byebug
[23:41:48] kies^: has joined #RubyOnRails
[23:42:46] jhass: pry-rescue and pry-stack_explorer make further great additions
[23:52:30] sinkensabe: has joined #RubyOnRails
[23:55:43] quarters: I noticed that when I login with faulty information, I still get a status code 200, indicating success. What usually sticks out as the main culprits for this behavior? The project itself can be found here: https://bitbucket.org/zebralight/sample_app/src and the output here: http://pastie.org/10300314
[23:56:44] quarters: I guess what happens is the sign in screen gets re-rendered successfully
[23:57:05] quarters: but then there's no completed ___ code for it having faulty info at all
[23:57:55] mxrguspxrt: has joined #RubyOnRails