« Back to channel list

#RubyOnRails - 28 June 2016

« Back 1 day Forward 1 day »
[00:00:12] xall: has joined #RubyOnRails
[00:06:48] DoctorMonocular: has joined #RubyOnRails
[00:09:53] alfiemax: has joined #RubyOnRails
[00:11:23] wilsonc91: has joined #RubyOnRails
[00:13:59] AmiMoench: has joined #RubyOnRails
[00:16:57] asheinfeld: has joined #RubyOnRails
[00:19:10] AndroidLoverInSF: has joined #RubyOnRails
[00:19:39] DoctorMonocular: has joined #RubyOnRails
[00:21:22] xall: has joined #RubyOnRails
[00:21:53] superlou: has joined #RubyOnRails
[00:24:05] timdotrb: has joined #RubyOnRails
[00:24:34] hahuang61: has joined #RubyOnRails
[00:24:48] rickmasta: has joined #RubyOnRails
[00:25:02] mikecmpbll: has joined #RubyOnRails
[00:28:28] rickmasta: has joined #RubyOnRails
[00:31:17] rickmasta: has joined #RubyOnRails
[00:31:32] dc2: has joined #RubyOnRails
[00:33:40] rickmasta: has joined #RubyOnRails
[00:34:24] pawnbox: has joined #RubyOnRails
[00:38:15] Hobogrammer: has joined #RubyOnRails
[00:42:15] quazimodo: has joined #RubyOnRails
[00:46:02] crystal77: has joined #RubyOnRails
[00:48:28] Ropeney: has joined #RubyOnRails
[00:52:48] xlegoman: has joined #RubyOnRails
[00:53:03] workmad3_: has joined #RubyOnRails
[00:58:02] workmad3: has joined #RubyOnRails
[00:59:11] dminuoso: has joined #RubyOnRails
[00:59:38] douglascorrea: has joined #RubyOnRails
[01:02:12] jowiar: has joined #RubyOnRails
[01:04:35] oystersauce8: has joined #RubyOnRails
[01:06:13] joaumg: has joined #RubyOnRails
[01:06:28] arBmind1: has joined #RubyOnRails
[01:07:51] joaumg: This might be a RTFM question, but how do I use the `params.fetch(:client, {})` instead of the `params.require(:client).permit(...)` ? I didn't find any example of the differences between both.
[01:09:13] baweaver: Params isn't a hash, it just acts like one
[01:09:17] baweaver: Read into Strong Params
[01:09:21] joaumg: Nevermind, found this beauty: https://github.com/rails/strong_parameters
[01:09:55] moeabdol: has joined #RubyOnRails
[01:12:06] one_zero: has joined #RubyOnRails
[01:12:12] asheinfeld: has joined #RubyOnRails
[01:13:53] someish: has joined #RubyOnRails
[01:18:13] alfiemax: has joined #RubyOnRails
[01:19:22] ur5us: has joined #RubyOnRails
[01:19:36] ur5us: has joined #RubyOnRails
[01:20:12] beingjohnm: I'm trying to migrate to using UUIDs and running into a problem. I'm using this gem (https://github.com/kreatio-sw/webdack-uuid_migration) and following the examples so it should work but I'm getting an error with the reference columns.
[01:20:24] beingjohnm: My gist is: https://gist.github.com/willjohnson/8cf421c707795afbb3b0e6facc27b5ec
[01:21:33] beingjohnm: I see a very similar example here: http://slides.com/kundigo/using-uuid-in-active-record-with-postgresql#/4/3
[01:24:46] Cohedrin: has joined #RubyOnRails
[01:25:20] hahuang61: has joined #RubyOnRails
[01:25:39] Cohedrin: is there a good way to "preload" or "includes" relations on a object I already have loaded into memory
[01:25:47] Cohedrin: without making another query for the objecT?
[01:27:04] macsteps: has joined #RubyOnRails
[01:28:09] macsteps: has joined #RubyOnRails
[01:30:23] sevenseacat: has joined #RubyOnRails
[01:31:13] Ropeney: Cohedrin, you mean before you load it into memory?
[01:31:31] Cohedrin: nope, after I have it loaded into memory
[01:31:41] Ropeney: Would it just guess whats in the database now?
[01:31:50] Cohedrin: I don't think I'm being clear
[01:32:04] Cohedrin: if my model were named `game`
[01:32:17] Cohedrin: I have my instance of game loaded into memory as game = Game.last
[01:32:18] jowiar: has joined #RubyOnRails
[01:32:37] Cohedrin: on `game` I need to load all the `players` in the assoication `players`
[01:32:56] rickmasta: has joined #RubyOnRails
[01:33:06] Cohedrin: so the code would be something like `game.includes(:players)`
[01:33:09] Cohedrin: obviously that doesn't work
[01:33:12] Cohedrin: but thats the idea
[01:33:22] Ropeney: why not load when assigning to game?
[01:34:51] Cohedrin: because it doesn't fit well into the structure of the model
[01:35:06] Radar: Game.includes(:players).last
[01:35:11] Cohedrin: Radar right
[01:35:13] Ropeney: Well, you can't just have it magically know the players without querying the database again then
[01:35:16] Cohedrin: I know I can do that
[01:35:25] Cohedrin: Again, not trying to avoid querying the database
[01:35:35] Radar: [11:25:47] <Cohedrin> without making another query for the objecT?
[01:35:39] Ropeney: [10:55:49] Cohedrin: without making another query for the objecT?
[01:36:01] Cohedrin: I see where the confusion is coming from
[01:36:26] lessless: has joined #RubyOnRails
[01:36:44] Cohedrin: what I meant was is there a way to do that without doing something like `Game.includes(:players).where(id: game.id)`
[01:38:37] Ropeney: I'm lost what you want, goodluck :D
[01:39:57] Radar: [11:35:35] <Radar> No.
[01:40:06] workmad3: has joined #RubyOnRails
[01:40:11] Radar: Cohedrin: Hi. I'm the guy who wrote the AR querying guide.
[01:40:20] Radar: Cohedrin: What you're asking for is not possible.
[01:41:47] Cohedrin: great, all I needed to know
[01:45:07] workmad3: has joined #RubyOnRails
[01:45:27] beingjohnm: anybody have any ideas for my issue? If not I'll try asking again tomorrow.
[01:48:55] blackmesa: has joined #RubyOnRails
[01:50:59] d0nn1e: has joined #RubyOnRails
[01:51:56] benlieb: has joined #RubyOnRails
[01:55:32] beingjohnm: could a specific record be causing this error "ActiveRecord::StatementInvalid: PG::DatatypeMismatch: ERROR: foreign key constraint "fk_rails_01f020e267" cannot be implemented
[01:55:54] beingjohnm: DETAIL: Key columns "account_id" and "id" are of incompatible types: integer and uuid
[01:56:02] sevenseacat: no, it's the column types.
[01:56:16] sevenseacat: as the second line of the error states clearly.
[01:57:20] beingjohnm: sevenseacat: that is what I figured but this gem is supposed to change the column types from integer to uuid and it (or I) am obviously failing at that
[01:57:54] sevenseacat: so what is 'this gem' and what code are you running and whats the context behind the error message?
[01:58:22] beingjohnm: sevenseacat: My gist is: https://gist.github.com/willjohnson/8cf421c707795afbb3b0e6facc27b5ec
[01:58:57] beingjohnm: sevenseacat: the gem is https://github.com/kreatio-sw/webdack-uuid_migration
[01:59:00] jeromelanteri: jhass, ok, i try with letsencrypt starttls keys (and check it on this site: http://www.checktls.com/perl/TestReceiver.pl). Server connection and mailing working, but still have the same error from email send from devise via rails-4.2.6: OpenSSL::SSL::SSLError in Devise::RegistrationsController#update
[01:59:05] sevenseacat: so you can't change a column to uuid when it has a FK to a table that has an integer
[01:59:28] jhass: jeromelanteri: what's the full error again?
[01:59:41] jeromelanteri: but also, i test this for look at my postfix/dovecot server mail visibility: http://www.mail-tester.com/web-bK3NBi&reloaded=1
[02:00:13] sevenseacat: ohhhh you're that person that wanted to change their app from integers to uuids and we warned you against it
[02:00:19] sevenseacat: right, i see now
[02:00:22] beingjohnm: sevenseacat: that is what it seems but all of the examples seem to indicate that this should work. I figured it would somehow temporarily remove the constraint.
[02:00:38] beingjohnm: sevenseacat: I don't think so
[02:00:42] sevenseacat: thats not how it works
[02:00:55] sevenseacat: oh, two people wanted to do this kind of weird in the same week? nice
[02:01:12] dminuoso: has joined #RubyOnRails
[02:01:41] beingjohnm: sevenseacat: what was the warning against it?
[02:03:01] SteenJobs: has joined #RubyOnRails
[02:07:18] snafu_: has joined #RubyOnRails
[02:07:46] jeromelanteri: jhass, after restart nginx and try again, i have a new error: https://gist.github.com/jerome-diver/7343edeb80b8cc9e718bce6b4ee545d8
[02:08:15] jhass: jeromelanteri: well that looks like progress
[02:08:58] jeromelanteri: jhass, i don't know why this email send has been rejected... but seems like rails can send mail (so connection is OK...)
[02:09:02] jhass: jeromelanteri: did you adjust devise's default sender address?
[02:09:10] jhass: it should be in your devise initializer
[02:09:32] jeromelanteri: jhass, how... ok, long time i not touch devise, i'm going to check this. THank you jhass.
[02:12:43] arthurl: has joined #RubyOnRails
[02:13:10] pawnbox: has joined #RubyOnRails
[02:25:54] wethu: has joined #RubyOnRails
[02:26:04] hahuang61: has joined #RubyOnRails
[02:28:24] Ropeney: has joined #RubyOnRails
[02:32:59] Rodya_: has joined #RubyOnRails
[02:41:14] Leepoff: has joined #RubyOnRails
[02:43:59] jenrzzz: has joined #RubyOnRails
[02:43:59] jenrzzz: has joined #RubyOnRails
[02:44:21] Rodya_: has joined #RubyOnRails
[02:44:26] benlieb: has joined #RubyOnRails
[02:46:11] AmiMoench: has joined #RubyOnRails
[02:47:06] mrkhlm: has joined #RubyOnRails
[02:51:25] blackmesa: has joined #RubyOnRails
[02:53:47] benlieb: has joined #RubyOnRails
[02:54:38] xlegoman: has joined #RubyOnRails
[03:01:54] douglascorrea: has joined #RubyOnRails
[03:02:07] lessless: has joined #RubyOnRails
[03:02:09] xall: has joined #RubyOnRails
[03:02:58] Rodya_: has joined #RubyOnRails
[03:05:26] nettoweb: has joined #RubyOnRails
[03:05:43] lessless: is it possible to insert json in the HAML template?
[03:07:05] pontiki: has joined #RubyOnRails
[03:09:09] sypheren: has joined #RubyOnRails
[03:12:08] braincrash: has joined #RubyOnRails
[03:12:39] benlieb: has joined #RubyOnRails
[03:13:26] crystal77: has joined #RubyOnRails
[03:16:21] ensyde: has joined #RubyOnRails
[03:17:08] Coldblackice: has joined #RubyOnRails
[03:18:45] rickmasta: has joined #RubyOnRails
[03:18:48] DoctorMonocular: has joined #RubyOnRails
[03:19:29] ekinmur: has joined #RubyOnRails
[03:21:07] k3rn31: has joined #RubyOnRails
[03:23:08] Radar: lessless: Why would you want to do that>?
[03:23:33] rickmasta: has joined #RubyOnRails
[03:23:33] lessless: Radar provide initial state to JS app
[03:26:49] hahuang61: has joined #RubyOnRails
[03:29:14] sebstrax: has joined #RubyOnRails
[03:35:28] roamingdog: has joined #RubyOnRails
[03:37:03] jenrzzz: has joined #RubyOnRails
[03:42:26] eserror: has joined #RubyOnRails
[03:44:29] sypheren: has joined #RubyOnRails
[03:53:27] blackmesa: has joined #RubyOnRails
[03:54:07] DoctorMonocular: has joined #RubyOnRails
[03:54:35] jenrzzz: has joined #RubyOnRails
[03:54:35] jenrzzz: has joined #RubyOnRails
[03:56:39] benlieb: has joined #RubyOnRails
[03:57:02] dminuoso: has joined #RubyOnRails
[03:58:09] ekinmur: has joined #RubyOnRails
[03:58:51] PotatoChipz: has joined #RubyOnRails
[04:00:41] blackhuey: has joined #RubyOnRails
[04:01:23] M-shine: has joined #RubyOnRails
[04:06:34] Psyko: has joined #RubyOnRails
[04:07:17] xall: has joined #RubyOnRails
[04:07:40] rafaelfranca: has joined #RubyOnRails
[04:07:53] Psyko: Hi which gem is better devise or omniauth? i just need something to speed up making the authentication basic login and out
[04:09:01] Radar: Psyko: omniauth and devise provide different features.
[04:09:14] sevenseacat: they are not substitutes for each other
[04:12:20] duncannz: has joined #RubyOnRails
[04:15:12] jgt3: has joined #RubyOnRails
[04:17:20] drupald: has joined #RubyOnRails
[04:27:11] rafaelfranca: has joined #RubyOnRails
[04:27:34] hahuang61: has joined #RubyOnRails
[04:29:25] Devalo: has joined #RubyOnRails
[04:31:47] mytrile: has joined #RubyOnRails
[04:35:05] hirvi: has joined #RubyOnRails
[04:35:35] k3rn31: has joined #RubyOnRails
[04:36:57] matthias_: has joined #RubyOnRails
[04:40:14] hahuang61: has joined #RubyOnRails
[04:41:22] hirvi: has joined #RubyOnRails
[04:47:43] pawnbox: has joined #RubyOnRails
[04:53:13] PotatoChipz: has joined #RubyOnRails
[04:53:17] quazimodo: has joined #RubyOnRails
[04:54:12] blackmesa: has joined #RubyOnRails
[04:59:58] dminuoso: has joined #RubyOnRails
[05:00:45] moeabdol: has joined #RubyOnRails
[05:02:18] jas02: has joined #RubyOnRails
[05:09:34] eserror: has joined #RubyOnRails
[05:10:55] swap_a_b: has joined #RubyOnRails
[05:15:08] Hyuk: has joined #RubyOnRails
[05:15:27] dminuoso: has joined #RubyOnRails
[05:18:27] matthias_: has joined #RubyOnRails
[05:19:56] AdamOnRails: has joined #RubyOnRails
[05:20:27] AdamOnRails: So I have: Site habtm Product and vice versa.
[05:20:52] AdamOnRails: How do I delete the association between product & site without destroying the product record?
[05:20:53] PotatoChipz: if I use nested with_locks .... which lock releases the lock if something is encountered in the inner lock? Is it safe to have nested with_lock?
[05:21:27] AdamOnRails: so I want to destroy the entry in the join table but not the model records themselves
[05:22:01] sevenseacat: AdamOnRails: http://guides.rubyonrails.org/association_basics.html#has-and-belongs-to-many-association-reference see delete and destrouy
[05:23:02] AdamOnRails: Ahh, "delete" is what I needed. Was using destroy haha.
[05:23:06] AdamOnRails: Muchas gracias :)
[05:23:46] sevenseacat: well both do similar things, just one runs callbacks and one doesnt
[05:23:56] sevenseacat: neither will delete the actual record, just remove it from the collection
[05:26:15] AdamOnRails: Hmmm then howcome my records in my db have been deleted haha
[05:26:46] AdamOnRails: I used @site.products.find_by_id(params[:product_id]).destroy
[05:27:12] sevenseacat: right, thats not what the guide says to do
[05:27:21] sevenseacat: if you call destroy on the object, of course it is destroyed
[05:27:38] AdamOnRails: Haha, yeah. I'll keep reading.
[05:27:59] quazimodo: has joined #RubyOnRails
[05:28:34] ahtik: has joined #RubyOnRails
[05:28:38] AdamOnRails: Ahh I see. #collection. Got it. #derp
[05:28:39] srgupta: has joined #RubyOnRails
[05:32:06] timdotrb: has joined #RubyOnRails
[05:35:14] dminuoso: has joined #RubyOnRails
[05:39:54] rvanlieshout: has joined #RubyOnRails
[05:42:26] xall: has joined #RubyOnRails
[05:43:01] Leepoff: has joined #RubyOnRails
[05:51:28] netzfisch: has joined #RubyOnRails
[05:54:35] tildes: has joined #RubyOnRails
[05:55:14] blackmesa: has joined #RubyOnRails
[05:58:45] pawnbox: has joined #RubyOnRails
[05:58:53] artto: has joined #RubyOnRails
[06:00:06] AdamOnRails: Ok, so I am changing my Site habtm Products association to a Site has_many Products :through => Shortlist
[06:00:19] swap_a_b: has joined #RubyOnRails
[06:00:43] AdamOnRails: But before I start, I am wondering if I use the same attribute names in Shortlist as Product, will it conflict in anyway?
[06:01:34] AdamOnRails: So the Product attribute "cost" would be the default cost, but in the shortlist "cost" would be the site-customised cost.
[06:02:18] AdamOnRails: So not sure if I should call the Shortlist "cost" attribute something other than "cost" in case it conflicts with Product "cost" attribute?
[06:02:38] swap_a_b: has left #RubyOnRails: ()
[06:04:16] boogeyman: has joined #RubyOnRails
[06:04:41] srinidhi: has joined #RubyOnRails
[06:04:48] Dimik: has joined #RubyOnRails
[06:05:41] netzfisch: has joined #RubyOnRails
[06:05:46] boogeyman: has joined #RubyOnRails
[06:07:16] boogeyman: has joined #RubyOnRails
[06:07:30] pawnbox: has joined #RubyOnRails
[06:08:10] alfiemax: has joined #RubyOnRails
[06:08:46] boogeyman: has joined #RubyOnRails
[06:09:20] boogeyman: has joined #RubyOnRails
[06:09:39] boogeyman: has left #RubyOnRails: ()
[06:10:52] tildes: has joined #RubyOnRails
[06:17:41] sandelius: has joined #RubyOnRails
[06:19:56] fujinuma: has joined #RubyOnRails
[06:20:03] jgt3: has joined #RubyOnRails
[06:20:23] artto: has joined #RubyOnRails
[06:22:33] artto_: has joined #RubyOnRails
[06:23:07] conta: has joined #RubyOnRails
[06:25:31] k3rn31: has joined #RubyOnRails
[06:27:13] roamingdog: has joined #RubyOnRails
[06:29:14] DoubleMalt: has joined #RubyOnRails
[06:31:02] rodfersou: has joined #RubyOnRails
[06:38:10] emiltin: has joined #RubyOnRails
[06:40:57] arBmind: has joined #RubyOnRails
[06:41:28] artto: has joined #RubyOnRails
[06:43:00] mark_66: has joined #RubyOnRails
[06:43:22] artto: has joined #RubyOnRails
[06:44:09] Pumukel: has joined #RubyOnRails
[06:48:02] banjara: has joined #RubyOnRails
[06:48:17] ur5us: has joined #RubyOnRails
[06:48:49] moeabdol: has joined #RubyOnRails
[06:48:56] ur5us: has joined #RubyOnRails
[06:49:35] patrick_star_3: has joined #RubyOnRails
[06:53:13] britter: has joined #RubyOnRails
[06:53:58] Copperfield: has joined #RubyOnRails
[06:54:15] dc2: has joined #RubyOnRails
[06:56:02] blackmesa: has joined #RubyOnRails
[07:00:01] yfeldblum: has joined #RubyOnRails
[07:01:37] yfeldblum: has joined #RubyOnRails
[07:04:27] douglascorrea: has joined #RubyOnRails
[07:10:37] solars: has joined #RubyOnRails
[07:11:21] quazimodo: has joined #RubyOnRails
[07:14:44] User458764: has joined #RubyOnRails
[07:20:05] antgel: has joined #RubyOnRails
[07:21:21] rails45: has joined #RubyOnRails
[07:21:55] rails45: how can i push local database records to heroku?
[07:22:07] ur5us: has joined #RubyOnRails
[07:22:18] rails45: for instance, i want the user data in the local server to be the same as in the heroku app
[07:24:21] rvanlieshout: rails45: full db or only those records?
[07:25:09] rails45: full db includes the records too right? so yeah, the full db preferably
[07:25:30] tildes: has joined #RubyOnRails
[07:25:33] rvanlieshout: then you'll have to make a dump of your db and import that on heroku
[07:25:48] rvanlieshout: https://devcenter.heroku.com/articles/heroku-postgres-import-export
[07:26:00] rvanlieshout: note that this also includes non-user data
[07:26:04] rvanlieshout: it's _all_ data in your db
[07:26:13] rvanlieshout: so any data on production is discarded
[07:27:53] rails45: neat! thanks!
[07:28:02] roamingdog: has joined #RubyOnRails
[07:28:06] rails45: so i'll have to make a dump every time i change a record locally?
[07:28:41] rvanlieshout: it's not common to have a workflow like this
[07:28:52] rvanlieshout: cause users might be able to mutate data in the production environment
[07:29:32] rails45: yep that's what i was thinking. i was just looking for a way to sync data between production and development
[07:29:37] dminuoso: rails45: If you have some need for some unified user management, you might want to think about some form of delegation. The simplest would be to use a separate but shared source.
[07:29:52] rvanlieshout: rails45: in what scenario's would you want to push data from dev to production?
[07:30:03] PotatoChipz: has joined #RubyOnRails
[07:30:45] dminuoso: rails45: I for example authenticate my users against an LDAP server in both development and production.
[07:32:50] sevenseacat: I think this is a bad road to be going down (keeping dev and production dta in sync)
[07:33:11] rvanlieshout: and ok if you need to grab prodution data from time to time
[07:33:17] rvanlieshout: but the other way around is strange
[07:34:51] aganov: has joined #RubyOnRails
[07:35:45] Pazician: has joined #RubyOnRails
[07:39:27] Niham: has joined #RubyOnRails
[07:43:57] blackmesa: has joined #RubyOnRails
[07:44:45] finnnnnnnnnnn: has joined #RubyOnRails
[07:44:57] yfeldblum: has joined #RubyOnRails
[07:47:04] mikecmpbll: has joined #RubyOnRails
[07:50:13] jgt3: has joined #RubyOnRails
[07:53:18] benlieb: has joined #RubyOnRails
[07:56:12] artto: has joined #RubyOnRails
[07:57:38] tildes: has joined #RubyOnRails
[08:01:30] PotatoChipz: hello. Is it bad to use nested with_lock ?
[08:03:32] Silthias: has joined #RubyOnRails
[08:06:20] Silthias1: has joined #RubyOnRails
[08:07:08] adre: has joined #RubyOnRails
[08:10:13] Pazician_: has joined #RubyOnRails
[08:10:13] Pazician_: has joined #RubyOnRails
[08:10:22] rvanlieshout: potatochipz: it's not bad if you need it
[08:12:01] PotatoChipz: rvanlieshout well...it just so happen that an inner service locks the same instance. but i need to lock it outside as well.
[08:12:02] jgt3: has joined #RubyOnRails
[08:12:12] PotatoChipz: i'm just worried about the releasing of locks.
[08:12:30] PotatoChipz: if an error is encountered within the inner lock, will it release both locks?
[08:12:38] nofxx: has joined #RubyOnRails
[08:14:24] Psyko: hello i have a question is my usage for f.text_field correct?
[08:14:24] snowy: has joined #RubyOnRails
[08:14:25] Psyko: https://gist.github.com/anonymous/8de93cec7c963c3ffc2685b3396b0cb8
[08:15:04] snowy: has left #RubyOnRails: ()
[08:15:41] defsdoor: has joined #RubyOnRails
[08:16:23] sevenseacat: Psyko: does it work?
[08:16:51] sevenseacat: given you haven't defined 'correct'
[08:24:34] darutoko: has joined #RubyOnRails
[08:27:27] artto_: has joined #RubyOnRails
[08:28:44] roamingdog: has joined #RubyOnRails
[08:31:00] jenrzzz: has joined #RubyOnRails
[08:35:07] quazimodo: has joined #RubyOnRails
[08:35:39] moeabdol: has joined #RubyOnRails
[08:36:52] solars: has joined #RubyOnRails
[08:37:43] braincrash: has joined #RubyOnRails
[08:41:41] _underscore_: has joined #RubyOnRails
[08:42:22] dminca: has joined #RubyOnRails
[08:42:34] rikkipitt: has joined #RubyOnRails
[08:46:28] jsrn: has joined #RubyOnRails
[08:49:55] Cervajz: has joined #RubyOnRails
[08:55:23] marr: has joined #RubyOnRails
[08:55:54] pawnbox: has joined #RubyOnRails
[08:57:12] AimlessRAven: has joined #RubyOnRails
[08:57:32] AimlessRAven: how to set this datetime_select("article", "written_on", prompt: {day: 'Choose day', month: 'Choose month', year: 'Choose year'}
[08:57:36] Niham: has joined #RubyOnRails
[08:57:42] AimlessRAven: to my form input for example f.input :starts_at..
[08:58:54] DaniG2k: has joined #RubyOnRails
[08:59:30] Ergo: has joined #RubyOnRails
[09:01:17] dc2: has joined #RubyOnRails
[09:02:06] JesseH: has joined #RubyOnRails
[09:03:56] rikkipitt: has joined #RubyOnRails
[09:05:50] antgel: has joined #RubyOnRails
[09:05:58] lxsameer: has joined #RubyOnRails
[09:11:01] bonswouar: has joined #RubyOnRails
[09:11:08] kitsuneyo: has joined #RubyOnRails
[09:21:30] moeabdol: has joined #RubyOnRails
[09:22:02] rikkipitt: has joined #RubyOnRails
[09:22:53] arifba: has joined #RubyOnRails
[09:23:43] arifba: can someone help me on this? https://gist.github.com/anonymous/1daa36a614e9c4281b669777e82c9180
[09:25:05] universa1: it is a link to a gist.
[09:25:27] arifba: yep the code is there
[09:25:41] rbr: has joined #RubyOnRails
[09:25:47] universa1: what is this? what is your problem? ...
[09:26:45] arifba: I'm getting a "$ is not defined; please fix or add /*global $*/" error whenever I type in a line with $ in a javascript file
[09:28:05] AzaToth: has joined #RubyOnRails
[09:28:56] arifba: the file works, however
[09:29:03] arifba: i'm just curious what this error means
[09:29:30] universa1: where do you get that error? browser? rails console? ...
[09:29:47] SirOliver: has joined #RubyOnRails
[09:30:59] arifba: i just get this error in the IDE beside any line with $, but everything else works fine. so i'm guessing it's more of a warning than an error
[09:32:43] universa1: knowing that the error comes from some ide might have been helpful...
[09:33:16] artto: has joined #RubyOnRails
[09:33:26] emilkarl: has joined #RubyOnRails
[09:34:35] emilkarl: In Devise. Is it possible to disable all old session for a user on login. So when on sign in the user will be signed out in all other places.
[09:37:25] artto_: has joined #RubyOnRails
[09:40:13] pawnbox: has joined #RubyOnRails
[09:40:53] andywww: has joined #RubyOnRails
[09:41:54] snoobydoo: has joined #RubyOnRails
[09:45:15] braincrash: has joined #RubyOnRails
[09:48:09] rikkipitt: has joined #RubyOnRails
[09:49:15] artto: has joined #RubyOnRails
[09:49:18] arBmind: has joined #RubyOnRails
[09:50:17] benlieb: has joined #RubyOnRails
[09:51:20] spiman: has joined #RubyOnRails
[09:54:27] rickmasta: has joined #RubyOnRails
[09:57:46] KevinSjoberg: has joined #RubyOnRails
[09:57:58] GodFather: has joined #RubyOnRails
[10:00:09] blackmesa: has joined #RubyOnRails
[10:00:20] ur5us: has joined #RubyOnRails
[10:00:42] c355E3B: has joined #RubyOnRails
[10:01:10] emiltin: has joined #RubyOnRails
[10:01:43] kitsuneyo: does this look like the right way to add a self-join foreign key? -- add_foreign_key :companies, :companies, column: :parent_id
[10:01:49] Shidash: has left #RubyOnRails: ()
[10:02:47] kitsuneyo: do you even need to create a foreign key since it's the same table?
[10:03:15] fox_mulder_cp: i have a super qa - how to recognize my current path to mark it in nav bar as active
[10:03:37] GodFather: has joined #RubyOnRails
[10:04:03] fox_mulder_cp: may be we have a true way, than if'ing for my all loong roourte liist ))
[10:06:38] dionysus69: has joined #RubyOnRails
[10:07:28] AmiMoench: has joined #RubyOnRails
[10:08:07] nettoweb: has joined #RubyOnRails
[10:08:15] binaryplease1: has joined #RubyOnRails
[10:10:04] moeabdol: has joined #RubyOnRails
[10:11:42] sandelius: fox_mulder_cp match either current_page?(page) or use request.path
[10:13:24] GodFather: has joined #RubyOnRails
[10:14:05] braincrash: has joined #RubyOnRails
[10:14:34] User458764: has joined #RubyOnRails
[10:15:04] roamingdog: has joined #RubyOnRails
[10:17:02] alfiemax: has joined #RubyOnRails
[10:20:46] emiltin: has joined #RubyOnRails
[10:30:55] Mia: has joined #RubyOnRails
[10:33:01] blackmesa: has joined #RubyOnRails
[10:33:06] rikkipitt: has joined #RubyOnRails
[10:33:39] braincrash: has joined #RubyOnRails
[10:39:05] SirOliver: has joined #RubyOnRails
[10:39:59] spiman_: has joined #RubyOnRails
[10:40:09] artto: has joined #RubyOnRails
[10:40:37] davidblko: has joined #RubyOnRails
[10:41:43] artto: has joined #RubyOnRails
[10:44:10] blackmesa: has joined #RubyOnRails
[10:44:23] jokke: i have a very weird problem with the asset pipeline: i'm using a minified javascript lib in vendor/assets. it works perfectly in development. It doesn't in production. It does locally when started with RAILS_ENV=production and serve_static_files = true. It appears in the minified application.js
[10:44:42] jokke: any ideas what the problem might be? :/
[10:45:19] Leepoff: has joined #RubyOnRails
[10:45:31] jokke: yes, i've precompiled assets
[10:46:51] braincrash: has joined #RubyOnRails
[10:48:45] Moeh: has joined #RubyOnRails
[10:49:13] Moeh: Can anyone tell me if pundit / CanCanCommunity is compatible with Rails 5?
[10:50:22] hefest: has joined #RubyOnRails
[10:50:40] hefest: hey guys. Any of you using docker for local rails development environment?
[10:51:36] jokke: hefest: yup
[10:52:35] hefest: jokke: are you mounting external folder with rails app inside the docker container, or are you rebuilding container each time you make changes?
[10:52:49] jokke: the former
[10:53:01] jokke: i can paste an example docker-compose.yml
[10:53:08] nettoweb: has joined #RubyOnRails
[10:53:10] hefest: jokke: so how do you run migrations, bundle install and stuff like that. with docker-compose aswell?
[10:53:23] hefest: jokke: yeah, that would be great. I'm just looking into the possible implementations.
[10:53:24] jokke: just docker-compose run rails bash
[10:53:33] jokke: https://p.jreinert.com/gDJja/
[10:53:44] SirOliver: has joined #RubyOnRails
[10:53:49] jokke: the ssh stuff is needed for capistrano deployments
[10:55:00] jokke: also it's import i
[10:55:14] jokke: *important, that you install gems in a volume
[10:55:16] Detch: has joined #RubyOnRails
[10:55:19] hefest: jokke: im going to run 3 rails projects interconnecting to each other
[10:55:30] Kedare: has joined #RubyOnRails
[10:55:36] jokke: in my case it's in ./vendor/bundle inside the project dir
[10:55:52] hefest: jokke: why in a volume?
[10:56:26] jokke: because otherwise it won't persist bundle install
[10:56:37] hefest: hmm tru dat
[10:56:49] Ergo^: has joined #RubyOnRails
[10:56:55] hefest: jokke: ok, thanks
[10:57:03] hefest: jokke: ill run postgresql in container aswell
[10:57:16] hefest: jokke: redis and memcached
[10:57:17] Ergo__: has joined #RubyOnRails
[10:57:21] jokke: no problem
[10:57:32] jokke: i've run a 11 node mongodb cluster
[10:57:37] jokke: with node problems
[10:58:00] hefest: yea, im running kubernetes in production with rails, works like a charm so far
[10:58:31] hefest: jokke: checkout docker 1.12 and docker-swarm. they've built-in orchestration
[10:58:50] braincrash: has joined #RubyOnRails
[10:59:46] jokke: nice, will do
[11:01:22] tildes: has joined #RubyOnRails
[11:01:33] SirOliver: has joined #RubyOnRails
[11:02:28] morfin: has joined #RubyOnRails
[11:03:54] someish: has joined #RubyOnRails
[11:04:46] morfin: i am thinking to make project without ActiveAdmin(it's not enough) and wondering - most sane way to implement CRUD and extend it is using just something like AdminController then inherit from that?
[11:06:20] dannyguk: has joined #RubyOnRails
[11:08:07] dannyguk: Hi, I was wondering if anyone could help me with some caching issues I'm having.
[11:09:12] dannyguk: I'm using memcached as my store, but i've tried redis as well and came up against the same issue.
[11:09:18] braincrash: has joined #RubyOnRails
[11:10:58] emilkarl: has joined #RubyOnRails
[11:13:08] universa1: dannyguk: if you don't tell us what issue you have, we can not! (disclaimer: i have no clue about caching)
[11:13:20] dannyguk: if I store an integer as raw e.g. Rails.cache.fetch("test/key/1", raw: true) do; 10; end => 10 then an integer is returned, but then when i fetch again I get a string Rails.cache.fetch("test/key/1", raw: true) => "10"
[11:13:42] dannyguk: universa1: sorry was just trying to work out how best to explain it
[11:13:54] arnonhongklay: has joined #RubyOnRails
[11:14:50] universa1: dannyguk: no worries :-) just saw that some time had passed ;)
[11:15:37] sevenseacat: looks like a serialization issue
[11:15:47] conta: has joined #RubyOnRails
[11:15:56] dannyguk: Which means i can call Rails.cache.increment and Rails.cache.decrement, but when i try to call comparison operators on the method that I'm using the cache in, I get an exception due to the value being a string.
[11:16:36] Axilla: has joined #RubyOnRails
[11:16:49] dannyguk: sevenseacat: if the raw option is passed shouldn't the value just be stored as it whatever type it is?
[11:17:02] sevenseacat: caches are key/value stores
[11:17:06] sevenseacat: they don't store types
[11:19:53] dannyguk: sevenseacat: I was under the impression the value stored in the key could be an integer or string, possibly this is specific to memcached though..
[11:20:39] rikkipitt: has joined #RubyOnRails
[11:22:11] sevenseacat: i dont know of that being the case
[11:24:00] douglascorrea: has joined #RubyOnRails
[11:24:44] AimlessRAven: how to set gitignore to remove my public folder files
[11:24:50] AimlessRAven: when i commit something
[11:25:07] mdw: has joined #RubyOnRails
[11:25:25] morfin: i do not like *Admin gems any more because they try to combine MVC in one file)
[11:28:44] braincrash: has joined #RubyOnRails
[11:28:52] douglascorrea: has joined #RubyOnRails
[11:29:28] emiltin: has joined #RubyOnRails
[11:32:30] dvinciguerra_: has joined #RubyOnRails
[11:33:04] d08z: has joined #RubyOnRails
[11:34:35] d08z: hi, how can i ensure that my belongs_to association exists in the databas? validates_presence_of does not work (you could put a newly created object plus there is no guarantee the object is still in the database when saving)
[11:35:08] universa1: d08z: implement some check in your database.
[11:35:31] universa1: no clue if you can set restrictions on the foreign key
[11:35:56] d08z: universa1: isnt there a "validates_existence_in_db" kind of validator?
[11:36:15] universa1: d08z: well, there is an old gem, but it still has race condition problems.
[11:36:25] d08z: so how can i "enforce" referential integrity BEFORE saving
[11:36:34] universa1: if you want a consistent check, do it in the db.
[11:36:50] nennes: has joined #RubyOnRails
[11:37:05] sevenseacat: you have to do it in the db, otherwise you'll hit the same race conditions that uniqueness validations do
[11:37:30] universa1: d08z: https://wiki.postgresql.org/wiki/Referential_Integrity_Tutorial_%26_Hacking_the_Referential_Integrity_tables -- for postgres
[11:37:56] d08z: has anyone ever used the "validates_existence" gem?
[11:38:15] mdw: has joined #RubyOnRails
[11:38:15] universa1: d08z: yes. but it still doesn't solve your race condition problem.
[11:39:06] d08z: ok, lets say nothing can be deleted...
[11:39:18] sevenseacat: well this is fun
[11:39:35] sevenseacat: let's say your database is made of pineapples.
[11:40:18] d08z: either im doing something really wrong or i dont understand because i thought it would be a very simple common and task to validate the existence :(
[11:41:01] universa1: d08z: if you look at the wiki link from postgres you see it is a simple task.
[11:41:34] universa1: and if nothing can be deleted, presence validation is good enough.
[11:41:58] sevenseacat: so what's wrong with a foreign key?
[11:42:14] Fernando-Basso: has joined #RubyOnRails
[11:42:37] d08z: exemple: City.country = Country.new <-- validate_presence_of will return true
[11:42:56] sevenseacat: depends what you're validating the presence of
[11:42:58] d08z: but the country is not in the database
[11:43:33] pawnbox: has joined #RubyOnRails
[11:43:36] universa1: d08z: so: validate :country_is_not_new_record; def country_is_not_new_record; errors.add :country, :foo unless country.persisted?
[11:43:49] sevenseacat: or validates_presence_of :country_id
[11:44:02] d08z: validates_presence_of does not work either
[11:44:07] d08z: i could put a fake id
[11:44:12] Axilla: has joined #RubyOnRails
[11:44:17] sevenseacat: [19:41:57] sevenseacat: so what's wrong with a foreign key?
[11:44:37] Shai_C: has joined #RubyOnRails
[11:44:44] Shai_C: has left #RubyOnRails: ("Leaving")
[11:45:06] d08z: ok so what you guys are telling me is "there is no way to validate that an objects exists in the database before saving it"
[11:45:16] sevenseacat: not without race conditions
[11:45:21] User458764: has joined #RubyOnRails
[11:45:49] d08z: so hit the database and wait for an exception
[11:45:53] universa1: not at application level... ...you might get it done with locking... ...but HELLO FOREIGN KEY!
[11:46:10] sevenseacat: if you want the features of a foreign key, use a foreign key
[11:46:35] sevenseacat: otherwise, write a custom validation but be aware that they are subject to race conditions
[11:46:51] d08z: so, save the object and wait for a foreign key error
[11:49:37] d08z: im trying my best to ask my question but im not sure how to correctly ask it :(
[11:50:03] d08z: seems so trivial
[11:50:09] sevenseacat: you're overcomplicating it
[11:50:48] d08z: ok lets say i have a Country and a City model, country has_many cities and City belongs_to country
[11:51:16] srinidhi: has joined #RubyOnRails
[11:51:28] d08z: how can i validate (IN RAILS) that the associated country (city.country) exists in the database when saving
[11:51:53] sevenseacat: write a validation
[11:52:13] d08z: yes thats what i did but i thought there would be a "rails way"
[11:52:27] sevenseacat: rails comes with support for custom validations built in.
[11:52:39] universa1: country.cities.create ...
[11:52:41] sevenseacat: seems like a "rails way"
[11:53:08] d08z: the equivalent of foreign_key() in django
[11:53:54] sevenseacat: I don;t know what that does internally, so
[11:54:39] d08z: ensures the relation is not null, has an id, is not new and hits the database with model.exists(foreign_key_id) before saving
[11:55:23] sevenseacat: so it's also subject to race conditions
[11:55:44] norfumpit: has joined #RubyOnRails
[11:56:07] d08z: well then how can you intercept the error
[11:56:41] sevenseacat: same way you'd catch any other error
[11:56:58] sevenseacat: rescue it, if it raises an exception
[11:56:58] d08z: ok well thanks for your help
[11:59:43] workmad3: has joined #RubyOnRails
[12:02:36] artto_: has joined #RubyOnRails
[12:05:05] artto: has joined #RubyOnRails
[12:05:58] rikkipitt: has joined #RubyOnRails
[12:08:36] tvw: has joined #RubyOnRails
[12:08:56] artto: has joined #RubyOnRails
[12:11:15] kitsuneyo: has joined #RubyOnRails
[12:11:23] Guest14: has joined #RubyOnRails
[12:11:26] blackmesa: has joined #RubyOnRails
[12:14:10] artto: has joined #RubyOnRails
[12:18:45] AimlessRAven: has joined #RubyOnRails
[12:19:06] AimlessRAven: hi all, in my ransack sort link %th= sort_link(@q, :first_name, :last_name) how to set %th to display "Name" not first_name
[12:21:45] universa1: AimlessRaven: never used ransack, but did you check the docs for ransack and for sort_link specifically?
[12:21:54] dminuoso: I am willing to bet AimlessRaven did not.
[12:22:12] sevenseacat: its a fair assumption.
[12:27:50] jyraff: has joined #RubyOnRails
[12:30:49] finnnnnnnnnnn: has joined #RubyOnRails
[12:33:46] fmcgeough: has joined #RubyOnRails
[12:35:20] GodFather: has joined #RubyOnRails
[12:36:20] douglascorrea: has joined #RubyOnRails
[12:36:27] pawnbox: has joined #RubyOnRails
[12:39:19] dopie: sevenseacat, rvanlieshout you should checkout spacemacs
[12:39:58] universa1: because space and macs
[12:40:09] umdstu: has joined #RubyOnRails
[12:40:58] dopie: It merges Emacs and Vim together
[12:41:20] dopie: universa1, yes that was great
[12:41:46] dminuoso: dopie: Do I get one vim pane and one emacs pane? That would be a great waste of 50% screen space...
[12:41:53] sevenseacat: i don't use either, so
[12:42:15] universa1: dminuoso: only 50%? ;)
[12:42:46] ych: has joined #RubyOnRails
[12:42:47] dopie: great dumb ass responses :) good job dminuoso !
[12:43:37] dopie: sevenseacat, speaking to dminuoso
[12:44:01] dminuoso: dopie: You can't seriously bring up the editor topic and not expect to either start a flame war or humerous responses.
[12:44:22] dopie: It wasn't really a topic, just said to check it out
[12:44:35] pawnbox: has joined #RubyOnRails
[12:44:35] dopie: I forgot its #rubyonrails
[12:45:04] dopie: where people who got picked on in younger years retaliate online ... haha
[12:45:35] sevenseacat: dopie: please stop it.
[12:46:34] ngw: has joined #RubyOnRails
[12:47:21] emilkarl: has joined #RubyOnRails
[12:49:56] artto_: has joined #RubyOnRails
[12:50:17] aegis3121: has joined #RubyOnRails
[12:51:56] sergio_101: has joined #RubyOnRails
[12:52:59] ezebe: has joined #RubyOnRails
[12:53:29] dopie: has left #RubyOnRails: ("Leaving")
[12:54:46] ezebe: hi - sorry if this is a really newb question, but I have v little experience with frontend stuff. does the code in my application.js file have access to variables in my rails backend, and how often are they updated or cached in the client browser?
[12:55:06] universa1: Ezebe: it does not have access.
[12:55:18] rvanlieshout: cause it's executed on a diffrenet moment
[12:55:19] dminuoso: Ezebe: Not directly. The proper way is to either have actions that respond to json (that you can call from JavaScript) or you attach data to data attributes in your views.
[12:55:49] dannyguk: has joined #RubyOnRails
[12:56:17] ezebe: i have some nested resources in my routes.rb, and I want to give the javascript the route that corresponds to the nested resource owner's user_id, so i have to put it somewhere in the view, from where the javascript can pick it up?
[12:56:38] dminuoso: Ezebe: The javascript asset directly, or in a data attribute.
[12:58:08] dminuoso: Ezebe: Using data attributes is probably the easier method since it does not require much additional work.
[12:58:21] dminuoso: But it also is much less clean.
[12:58:54] morfin: why there is race conditions in validations?
[12:59:18] dminuoso: morfin: Please explain what problem you are having, instead of assuming you know the issue.
[12:59:24] ezebe: clean in what sense? it sounds like it would be slower for the client to have to run an action to get the server to give the data back in json, rather than having it pre-available as a data attribute in the view
[13:00:16] morfin: i reffered your previous conversation
[13:01:33] dminuoso: morfin: You have to ask sevenseacat what she meant by that.
[13:02:13] sevenseacat: morfin: because the validation is done using a separate query to the database, and there is time for the database to change in between the validation being done, and the record being saved
[13:02:44] dminuoso: sevenseacat: Is it not wrapped inside a transaction?
[13:02:45] ezebe: thanks for your help on this, dminuoso (and others) i think i have nailed down where my misconception is derailing things - could you give me an example of the code to put in the view to leave a data attribute that the javascript can access?
[13:02:52] sevenseacat: its the same for the uniqueness validations built into Rails.
[13:02:58] sevenseacat: a transaction doesnt affect the issue
[13:02:59] ramortegui: has joined #RubyOnRails
[13:03:24] dminuoso: Ezebe: data attributes are like any html attributes, except they start with "data-"
[13:03:38] dminuoso: They are not special other than the fact that this is what they are designated for.
[13:03:44] sevenseacat: database locking might, but it would be rather inefficient at the scale where you're likely to run into the condition
[13:03:58] ezebe: and i just put that in a <% blah blah %> tag?
[13:05:07] dminuoso: Ezebe: Let say you have to dynamically give a <div> element a html class, based on a variable @color, how would you do that?
[13:06:44] ezebe: lol, i'm afraid i'm still having to think about simple things - I am confident I could do it, but I'd have to work it out
[13:07:07] emilkarl: What can be different when I get columns definitions in schema.rb like this "t.string "title", limit: 255" and on another machine the limit part is removed. They use the same version of ruby and rails, both on Postgres.
[13:07:08] ezebe: i'd imagine it would be surrounded by an <%if @color == whatever %>
[13:07:12] wilsonc91: has joined #RubyOnRails
[13:07:16] op84: has joined #RubyOnRails
[13:07:23] Akuma: has joined #RubyOnRails
[13:07:26] morfin: hmm, but record is being saved when you call save
[13:07:27] ezebe: <% end %>
[13:07:29] dminuoso: Ezebe: I'll give you a hint: http://api.rubyonrails.org/classes/ActionView/Helpers/TagHelper.html
[13:07:41] quazimodo: has joined #RubyOnRails
[13:07:50] dblessing: has joined #RubyOnRails
[13:07:54] fox_mulder_cp: emilkarl: with limiting pf properties u must control this limits via validations
[13:08:04] dminuoso: Ezebe: If you were using HAML or SLIM you could use a more elegant way, but this will do fine too.
[13:08:04] op84: hi guys - a routing like this: get ‘/*path/:gender’ is not possible right? do i have to prefix the gender?
[13:08:20] pawnbox: has joined #RubyOnRails
[13:09:25] ezebe: thanks, dminuoso, i'll have a look through your suggestions - i'm still very much on the steep part of the curve with most stuff!
[13:09:52] dminuoso: Ezebe: Take your time. You are already on a great start by using unobstrusive JavaScript. :)
[13:10:04] morfin: we use HAML in our projects, it's pretty nice
[13:10:14] ezebe: so that's what I'm doing... :)
[13:10:15] emilkarl: fox_mulder_cp: yep, what I wonder is why schema.rb differes between two rake db:migrates of the same app?
[13:10:23] emilkarl: one adds the limit and the other doesnt
[13:10:45] morfin: so, validation and save process are running as concurrent?
[13:10:57] ezebe: i'll be sure to have a look at HAML, morfin
[13:11:07] emilkarl: The limit is not set in the migration.
[13:11:09] itsmeduncan: has joined #RubyOnRails
[13:11:34] dminuoso: Ezebe: If you start fresh, I recommend you look straight at slim.
[13:11:45] dminuoso: Ezebe: It is very similar but has even less overhead.
[13:12:51] roamingdog: has joined #RubyOnRails
[13:13:33] ezebe: i think the main problem is that i'm trying to hatchet-job a gem (FullcalendarEngine) into my application - i'm more confident with the backend stuff as it's more like "traditional programming" and I built an app in an early version of rails 10 years ago while i was at uni - but javascript is all curly brackets to me...
[13:13:51] blackmesa: has joined #RubyOnRails
[13:14:32] kitsuneyo: has joined #RubyOnRails
[13:15:17] dminuoso: Ezebe: Use CoffeeScript if you don't like the curly brackets!
[13:15:41] dminuoso: On a serious note, you get used to the asynchronous programming styles with heavy focus on events in JavaScript after a bit of practice.
[13:16:17] ezebe: so in some ways its good to have a working bit of code to understand and adapt to my aims, but it also means i'm stuck with what is already there. i think building it from scratch is too big an ask right now.
[13:16:20] sevenseacat: I dislike slim immensely. I miss haml, and hamlit is a speedy version of haml (if the compilation speed is what bothers you)
[13:16:31] ezebe: i am gradually getting my head round it - thanks for the advice, people!
[13:16:40] dminuoso: sevenseacat: I am genuinely curious by your opinion on slim.
[13:16:45] dminuoso: curious about.
[13:18:15] sevenseacat: I've been using it in my project for the last 6 months or so, had never used it before that
[13:18:35] sevenseacat: I still have to look up the documentation almost daily because things I expect to work... just don't
[13:18:51] dminuoso: For how long have you been using HAML before that?
[13:18:57] sevenseacat: oh, a long time
[13:19:13] dminuoso: Ah, I suppose that might also be a factor then. :)
[13:19:30] sevenseacat: it just has a lot of silly quirks, like the first element is the tag, unless you're inside a | block
[13:19:42] sevenseacat: which no syntax highlighter will pick up correctly because it makes no sense
[13:20:23] sevenseacat: https://gist.github.com/sevenseacat/e803d0b44280902ca59c10473a2670f3
[13:20:26] dminuoso: My vim plugin seems to handle it just fine.
[13:21:02] dminuoso: sevenseacat: That "silly quirk" is actually one of the core concepts. ;-)
[13:21:12] sevenseacat: its a pain in the ass
[13:21:26] dminuoso: Personally I quite enjoy not having to type % everytime I'm not creating a bootstrap div.
[13:21:29] sevenseacat: and if thats really true then I dislike it even more
[13:21:59] dminuoso: sevenseacat: That gist of yours is mindbaffling though.
[13:22:02] dminuoso: What does it compile to?
[13:22:42] sevenseacat: <div>This is valid slim markup. what?</div>
[13:23:03] dminuoso: Ah nevermind, I was expecting something else.
[13:23:52] dminuoso: sevenseacat: I suppose in a way I have never noticed this to be an issue since I have almost no string literals inside my slim templates at all.
[13:23:53] Tobias|: has joined #RubyOnRails
[13:23:57] dminuoso: It's all fed by i18n.
[13:24:35] dminuoso: (Which is probably why I have not until today wondered how to do multiline string literals in slim)
[13:25:43] sevenseacat: yeah I originally tried to prefix each line with a | which spat out all kinds of errors
[13:26:43] guest56: has joined #RubyOnRails
[13:27:01] aegis3121: has joined #RubyOnRails
[13:27:09] ezebe: dminuoso: so if i put <% tag("div", data: {pathymcpathface: user_bookings_path}) somewhere in the page I want to use it, my application.js will be able to access the contents of "user_bookings_path" as pathymcpathface when it's needed?
[13:28:15] rvanlieshout: <%= tag(:div, id: user_bookings_path, data: { user_bookings_path: user_bookings_path }) %>
[13:28:24] rvanlieshout: $('#user_bookings_path').data('user-bookings-path')
[13:28:26] dminuoso: Ezebe: Give it an ID, then you can use document.getElementById()
[13:28:36] dminuoso: rvanlieshout: People need to stop advertising jquery to get elements by ID.
[13:28:40] workmad3: has joined #RubyOnRails
[13:28:51] rvanlieshout: dminuoso: that works without jquery too in modern browsers :)
[13:29:13] dminuoso: rvanlieshout: That has been working since IE 5.5 and all other browsers since their inception.
[13:30:04] morfin: in modern browsers you can query by selector
[13:30:37] rvanlieshout: oh then you mean the .data-part?
[13:30:48] morfin: document.querySelectorAll('.someclass')
[13:31:02] dminuoso: morfin: and features like querySelector() have been around for ages too.
[13:31:13] morfin: well, not in IE
[13:31:16] rvanlieshout: i wouldn't include anything if you don't have it, but there is no reason not to use jquery if already included
[13:31:21] dminuoso: morfin: IE 8
[13:31:24] ezebe: rvanlieshout: why does the _ become - later in the function?
[13:31:28] morfin: ah i forgot
[13:31:30] sevenseacat: and jquery is already included
[13:31:39] rvanlieshout: Ezebe: rails converts your data attributes to use -
[13:31:43] rvanlieshout: see the html in generates
[13:32:00] ezebe: ok, i'll give it a try - thanks, all!
[13:32:48] morfin: well, jQuery allow you using such things as .data()
[13:33:03] diegoviola: has joined #RubyOnRails
[13:33:07] dminuoso: morfin: The parts that only modern ecma has brought us that was otherwise supplyed by jquery and others was things like direct promises for example.
[13:33:29] morfin: i usually use that to bind elements to each other - as example element creating calendar and calendar itself
[13:33:37] DaniG2k: has joined #RubyOnRails
[13:33:41] Psyko_: has joined #RubyOnRails
[13:33:59] morfin: i heard promises in jQuery are so bad )
[13:34:06] rikkipitt: has joined #RubyOnRails
[13:34:24] artto: has joined #RubyOnRails
[13:34:27] morfin: better use either native or Bluebird(but Bluebird could do more things)
[13:34:57] dminuoso: morfin: The problem is that promises have only come with ecma6
[13:35:18] dminuoso: So for many years you relied on either some own implementation or most commonly jquery.
[13:35:44] morfin: last time i used Bluebird - it allows you map, reduce, all, one etc etc etc
[13:35:45] dminuoso: You still do in fact if you want to support IE.
[13:35:50] dminuoso: Edge has support for them though.
[13:36:49] yellow5: has joined #RubyOnRails
[13:38:37] shinnya: has joined #RubyOnRails
[13:47:16] roelof: has joined #RubyOnRails
[13:47:17] asheinfeld: has joined #RubyOnRails
[13:47:52] roelof: has someone ever played with actioncable on Rails 5 ?
[13:49:51] dstarh: has joined #RubyOnRails
[13:50:17] artto: has joined #RubyOnRails
[13:51:43] dminuoso: if a has_many b, why does a.bs.delete_all just update to set the a_id in all related b records to null?
[13:54:18] alfiemax: has joined #RubyOnRails
[13:54:30] universa1: dminuoso: because you set: dependent: :nullify on the has many association?!
[13:54:46] dminuoso: universa1: I have not.
[13:54:54] universa1: dminuoso: !code
[13:54:54] helpa: dminuoso: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[13:54:59] universa1: gtg though ;)
[13:55:16] pawnbox: has joined #RubyOnRails
[13:55:40] anagha_: has joined #RubyOnRails
[13:55:57] Leepoff: has joined #RubyOnRails
[13:56:56] snowy: has joined #RubyOnRails
[13:57:13] camilasan: has joined #RubyOnRails
[13:57:25] emiltin: has joined #RubyOnRails
[13:58:05] roelof: universa1: do you ever played with action-cable on Rails 5 ?
[14:01:50] antgel: has joined #RubyOnRails
[14:03:04] helpa: has joined #RubyOnRails
[14:03:18] macsteps: has joined #RubyOnRails
[14:04:44] yellow5: has joined #RubyOnRails
[14:07:38] dvinciguerra_: has joined #RubyOnRails
[14:08:09] ych: has joined #RubyOnRails
[14:08:22] emilkarl: has joined #RubyOnRails
[14:08:38] emilkarl: Is it possible to define a route that just answers with a status code and message without controller?
[14:09:14] reckoner: has joined #RubyOnRails
[14:09:20] fox_mulder_cp: emilkarl: in rails 5, as i read for some news..
[14:09:59] finnnnnnnnnnn: has joined #RubyOnRails
[14:10:02] emilkarl: i want to mock up some routes that need to respond.
[14:10:05] emilkarl: i guess i have to add the controller as well then
[14:11:53] fox_mulder_cp: emilkarl: u can create controller such as utils and in routes add your methods linked with methodsnfrom this controller
[14:12:48] fox_mulder_cp: but this drops mvc and crud idea..
[14:13:15] emilkarl: but i just create the controller that should be there and have empty actions, for now
[14:13:31] emilkarl: Now off the the bike shop!
[14:13:50] reckoner: using factory_girl to seed data. yay or nay?
[14:14:36] fox_mulder_cp: reckoner: popular gem )
[14:14:51] blackmesa: has joined #RubyOnRails
[14:15:01] sypheren: has joined #RubyOnRails
[14:15:04] dminuoso: https://gist.github.com/anonymous/5585b1db60b03ba88183c2f167618516
[14:15:12] dminuoso: Why is #delete_all not deleting the record?
[14:15:52] dminuoso: (Using destroy_all properly destroys the loop_pathways)
[14:16:18] fox_mulder_cp: dminuoso: .destroy_all
[14:16:52] fox_mulder_cp: i don't know we need .delete_all
[14:17:02] Psyko__: has joined #RubyOnRails
[14:18:27] dminuoso: fox_mulder_cp: That is not an explanation.
[14:19:19] myworkaccount33: has joined #RubyOnRails
[14:19:41] dminuoso: fox_mulder_cp: And delete_all has different semantics that in some cases can be more useful, for example I do not want dependent associations.
[14:19:55] dminuoso: I do not want to delete dependent associations.
[14:22:00] roamingdog: has joined #RubyOnRails
[14:24:33] fox_mulder_cp: dminuoso: dependent_destroy: false?
[14:25:16] fox_mulder_cp: orhpaned object may large you database queries, selects and backup/restoreing
[14:28:02] rafaelfranca: has joined #RubyOnRails
[14:29:13] arthurl: has joined #RubyOnRails
[14:29:20] ekinmur: has joined #RubyOnRails
[14:33:36] itsmeduncan: has joined #RubyOnRails
[14:33:49] emiltin: has joined #RubyOnRails
[14:35:36] fox_mulder_cp: hmhm. have a qestion: now i have model (ip:inet web_app:references). now it stores internal ip. which can be user in docker container statically for nginx upstream
[14:36:27] fox_mulder_cp: now i see my current sites admin, and see, that i can assign external ip to client, for all it's sites
[14:36:53] fox_mulder_cp: how i can merge it into one model, any ideas?
[14:36:55] snoobydoo: has joined #RubyOnRails
[14:41:08] upsell5: has joined #RubyOnRails
[14:41:47] jowiar: has joined #RubyOnRails
[14:43:20] ramirio: has joined #RubyOnRails
[14:43:35] polishdub: has joined #RubyOnRails
[14:46:23] ramirio: hi, is there a more pratical way to import a gem into rails console than that: http://stackoverflow.com/a/23313726/1405326 ?
[14:47:14] rafaelfranca: has joined #RubyOnRails
[14:47:28] DoctorMonocular: has joined #RubyOnRails
[14:47:53] svkurowski: has joined #RubyOnRails
[14:51:16] rafaelfranca: has joined #RubyOnRails
[14:51:26] finnnnnnnnnnn: has joined #RubyOnRails
[14:51:36] sevenseacat: ramirio: put them in your Gemfile, in a development group.
[14:52:39] adavia: has joined #RubyOnRails
[14:53:19] itsmeduncan: has joined #RubyOnRails
[14:53:34] fox_mulder_cp: and reload rails c )
[14:53:41] fox_mulder_cp: after bundle update
[14:54:43] ramirio: thanks, i forgot the :development group in gemfile :p
[14:54:56] Rodya_: has joined #RubyOnRails
[15:01:23] aegis3121: has joined #RubyOnRails
[15:02:10] pawnbox: has joined #RubyOnRails
[15:02:25] clandry94: has joined #RubyOnRails
[15:02:50] SnowyOwl: has joined #RubyOnRails
[15:03:31] pawnbox_: has joined #RubyOnRails
[15:04:25] prithaj: has joined #RubyOnRails
[15:05:22] clandry94: has joined #RubyOnRails
[15:07:26] workmad3: has joined #RubyOnRails
[15:07:42] fujinuma: how to convert this: `map.connect '/widget/:action/:api_key', :controller => 'widget', :api_key => /.*/` to rails 4 syntax?
[15:08:20] DoctorMonocular: has joined #RubyOnRails
[15:08:28] Mia: has joined #RubyOnRails
[15:09:00] andywww: has joined #RubyOnRails
[15:10:09] asheinfeld: has joined #RubyOnRails
[15:10:41] GodFather: has joined #RubyOnRails
[15:11:52] quazimodo: has joined #RubyOnRails
[15:12:08] yardenbar: has joined #RubyOnRails
[15:13:58] chouhoulis: has joined #RubyOnRails
[15:14:11] jyraff: has joined #RubyOnRails
[15:14:33] Rodya_: has joined #RubyOnRails
[15:16:02] disgrntld: has joined #RubyOnRails
[15:16:04] blackmesa: has joined #RubyOnRails
[15:16:07] chouhoulis: has joined #RubyOnRails
[15:17:57] matthewd: fujinuma: What do you have so far?
[15:18:20] fujinuma: match 'widgets/:action/:secret', to: 'widgets#user_sites', via: :get
[15:21:01] crystal77: has joined #RubyOnRails
[15:24:05] yellow5: has joined #RubyOnRails
[15:24:33] macsteps: has joined #RubyOnRails
[15:25:21] solars: has joined #RubyOnRails
[15:26:04] max1: has joined #RubyOnRails
[15:27:13] max1: has left #RubyOnRails: ()
[15:27:43] Rodya_: has joined #RubyOnRails
[15:27:50] Oliphaunte: has joined #RubyOnRails
[15:28:21] svkurowski: has joined #RubyOnRails
[15:30:29] GodFather: has joined #RubyOnRails
[15:31:13] rails123: has joined #RubyOnRails
[15:32:10] SteenJobs: has joined #RubyOnRails
[15:32:17] rails123: Guys, I'm having trouble adding font-awesome icons to my app. I added the font-awesome.min.css file assets/stylesheets but the icons aren't showing
[15:33:01] rails123: for instance i tried <i class="fa fa-camera-retro"></i>
[15:33:06] rails123: but this doesn't show anything
[15:34:39] Rodya_: has joined #RubyOnRails
[15:35:03] dannyguk_: has joined #RubyOnRails
[15:37:03] fox_mulder_cp: rails123: use gem :))
[15:38:41] tvon: has joined #RubyOnRails
[15:40:00] jhass: fujinuma: http://guides.rubyonrails.org/routing.html#segment-constraints and you might want to restrict it to get or post while at it
[15:40:36] naftilos76: has joined #RubyOnRails
[15:40:56] Hyuk: has joined #RubyOnRails
[15:41:13] Rodya_: has joined #RubyOnRails
[15:43:06] DaniG2k: has joined #RubyOnRails
[15:43:35] tvw: has joined #RubyOnRails
[15:44:00] herberzt: has joined #RubyOnRails
[15:44:54] herberzt: can someone help me with this? http://stackoverflow.com/questions/38080112/update-column-to-decrease-string-limit
[15:45:23] cschneid_: has joined #RubyOnRails
[15:45:25] allcentury: has joined #RubyOnRails
[15:45:42] rafaelfranca: has joined #RubyOnRails
[15:45:57] fox_mulder_cp: herberzt: hm.. raw sql accepted in migratiions tpp
[15:46:15] Rodya_: has joined #RubyOnRails
[15:46:30] herberzt: i don't understand what you mean
[15:47:34] adre: has joined #RubyOnRails
[15:49:40] asheinfeld: has joined #RubyOnRails
[15:50:07] Devalo: has joined #RubyOnRails
[15:50:09] tvon: herberzt: I think you have data in the column that will be truncated by the limit
[15:50:52] herberzt: how would I get around that? This is on a staging environment that will eventually get pushed to production...
[15:51:16] emiltin: has joined #RubyOnRails
[15:51:20] tvon: You need to find what is currently in the table that is 18 chars and make it 17 chars.
[15:51:27] tvon: Or, just shorten it to whatever...
[15:51:47] morfin: yep from right
[15:52:08] morfin: basically MySQL handle that
[15:52:24] fox_mulder_cp: herberzt: may be use booolean for no_sale?
[15:52:59] herberzt: its a label though...its a text field so people can customize what "no_sale" means for their company
[15:53:02] macsteps: has joined #RubyOnRails
[15:53:24] morfin: boolean in MySQl becomes tinyint?
[15:53:40] dionysus69: has joined #RubyOnRails
[15:53:44] mwlang: has joined #RubyOnRails
[15:54:28] tvon: It's fine as a varchar, you just need to deal with the existing data that won't fit in 17 chars.
[15:54:33] mwlang: in Rails 4.2 Active Support conversions, the comments for #to_date show "01/01/2012".to_date # => Sun, 01 Jan 2012 but then shows "12/13/2012".to_date # => ArgumentError: invalid date
[15:54:53] mwlang: why is one valid but the other isn’t?
[15:55:00] tvon: dd/mm/yyyy
[15:55:22] tvon: try "13/12/2012".to_date
[15:55:29] morfin: because depends on locale?
[15:55:34] tvon: I am completely guessing, btw.
[15:55:59] morfin: i guess that could depend on locale and date format defined in it, not sure
[15:56:21] jetpackjoe: has joined #RubyOnRails
[15:56:59] tvon: It just goes to Date.parse
[15:57:07] mwlang: this did start happening when I changed the Date’s default format to “%m/%d/%Y”
[15:57:26] mwlang: I would think to_date would be intelligent enough to use that format cue for parsing.
[15:57:36] morfin: oh noes i need rails c but for some reason on my FreeBSD rails application starts 15 minutes
[15:58:14] mwlang: oh, wait…I changed Time and DateTime formats, not Date’s format.
[15:58:40] mwlang: so I probably need to set Date’s format as well...
[15:59:20] morfin: strptime seems to be able to do that
[15:59:26] morfin: Date.strptime i mean
[16:01:16] morfin: my FreeBSD box does not like format %d.%m.%Y, probably default date format is locale
[16:01:21] clandry94: has joined #RubyOnRails
[16:02:08] mwlang: yeah, I may need to monkey_patch as setting the Date’s default format to “%m/%d/%Y” didn’t work any magic.
[16:02:34] morfin: why not change locale in env?
[16:02:37] morfin: for application
[16:03:10] tubbo: yeah, i think you can change the date format in config/locales
[16:03:17] fox_mulder_cp: export lang='en_US.UTF-8' /opt/app/start_serv.sh
[16:03:49] morfin: as i said my system use default locale and %Y-%m-%d
[16:04:12] morfin: maybe not lang?
[16:04:30] tubbo: yeah no haha
[16:04:52] tubbo: maybe ruby is imposing that using the system locale
[16:05:02] fox_mulder_cp: morfin: default locale for non-us|uk users - lol... i'm use mixed locale
[16:05:26] morfin: i checked - my LANG is ru_RU.UTF-8 and it still use %Y-%m-%d
[16:06:40] morfin: in Rails could use I18n for changing format
[16:06:51] morfin: http://guides.rubyonrails.org/i18n.html#how-to-store-your-custom-translations
[16:07:17] fox_mulder_cp: #LANG="ru_RU.UTF-8"; export LANG
[16:07:17] fox_mulder_cp: #LC_ALL="ru_RU.UTF-8"; export LC_ALL
[16:07:18] morfin: no idea how default proper format for plain Ruby, but i think there should be a way..
[16:07:37] Rodya_: has joined #RubyOnRails
[16:08:12] jowiar: has joined #RubyOnRails
[16:08:15] fox_mulder_cp: morfin: export locale before your app server starts
[16:08:23] clandry94: has joined #RubyOnRails
[16:09:10] fox_mulder_cp: morfin: run locale and see what now is configured
[16:09:14] whathappens: has joined #RubyOnRails
[16:09:23] fox_mulder_cp: and locale -a for installed locales
[16:09:30] morfin: it's all ru_RU.UTF-8
[16:09:59] morfin: i think using I18n is proper variant )
[16:10:13] fox_mulder_cp: morfin: i18n - for localization your app
[16:10:29] fox_mulder_cp: it different from app locale
[16:10:54] tubbo: morfin: yeah, you can definitely do that. but most programming languages in my experience default to whatever the server has set for locale, date formatting, etc.
[16:11:11] morfin: look at this accepted answer: http://stackoverflow.com/questions/17870762/changing-the-default-date-and-time-format-in-rails-4
[16:11:58] fox_mulder_cp: tubbo: my locale on server is different, than running app locale, and user can switch language via default rails i18n
[16:11:59] morfin: I18n not just about languages
[16:12:32] tubbo: fox_mulder_cp: right, because you configure it to be different...right? with `LANG=..`
[16:12:37] fox_mulder_cp: but really, how it translated time to locale, when i try i18n to russian
[16:12:38] Rodya_: has joined #RubyOnRails
[16:12:45] morfin: it's about locales which include currencies formatting, dates, etc etc
[16:13:18] jas02: has joined #RubyOnRails
[16:13:26] workmad3: has joined #RubyOnRails
[16:13:28] fox_mulder_cp: tubbo: yes, because this way - good style, use en_us locale, but change timezone
[16:14:10] tubbo: this is how we changed the date format globally on a spanish-language app we made: https://gist.github.com/tubbo/0cb3451295c7fb179e8d933f3a7e1799
[16:14:27] tubbo: shoutouts to the rails-i18n repo on github
[16:14:29] mwlang: it’s apparently bombing because I’m setting DateTime’s default to a lambda instead of a string
[16:14:57] mwlang: setting DateTime’s :default appears to override Date’s :default, too. :-(
[16:16:49] mwlang: https://gist.github.com/mwlang/6f2f4953ef8b42c101347e2a65c11b29 if anyone is interested.
[16:17:24] tubbo: mwlang: did you see the gist i posted?
[16:18:07] Rodya_: has joined #RubyOnRails
[16:18:15] tubbo: if you're in a rails app (assuming you are), should be a lot easier to use the i18n-derived format strings than using lambdas..
[16:18:37] blackmesa: has joined #RubyOnRails
[16:19:03] mwlang: tubbo: yes, I see that….I actually tried that a few minutes ago to no success because setting DateTime and Time’s :default entry is overriding the Date :default setting in the locale file.
[16:19:39] mwlang: when I raised an inspect on the Date’s formats in rspec, I was seeing this: {:db=>"%Y-%m-%d %H:%M:%S", :number=>"%Y%m%d%H%M%S", :nsec=>"%Y%m%d%H%M%S%9N", :time=>"%H:%M", :short=>"%d %b %H:%M", :long=>"%B %d, %Y %H:%M", :long_ordinal=>#<Proc:0x007ff102470108@/Users/mwlang/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.6/lib/active_support/core_ext/time/conversions.rb:12 (lambda)>,
[16:19:39] mwlang: :rfc822=>#<Proc:0x007ff1024700e0@/Users/mwlang/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.6/lib/active_support/core_ext/time/conversions.rb:16 (lambda)>, :iso8601=>#<Proc:0x007ff1024700b8@/Users/mwlang/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.6/lib/active_support/core_ext/time/conversions.rb:20 (lambda)>, :default=>#<Proc:0x007ff1026c9828@/Users/mwlang/projects/clients/riverside/tracker/4.x/config/initializers/date_formats.rb:9
[16:19:40] mwlang: (lambda)>}
[16:19:50] mwlang: ugh, sorry, that was longer than expected...
[16:19:50] tego101: has joined #RubyOnRails
[16:20:31] asheinfeld: has joined #RubyOnRails
[16:20:38] davidw: has joined #RubyOnRails
[16:20:40] mwlang: anyway, Date::DATE_FORMATS[:default] becomes the Time or DateTime’s lambda when it really should’ve remained “%m/%d/%Y” as set in my en.yml
[16:21:20] jxs_: has joined #RubyOnRails
[16:21:57] Rodya_: has joined #RubyOnRails
[16:22:30] tego101: has joined #RubyOnRails
[16:23:24] elomatreb: has joined #RubyOnRails
[16:23:36] mwlang: tubbo: the limitation I had with i18n derived formats was that I couldn’t intelligently suppress time components of a Time or DateTime when hour, minute, and second were all zero.
[16:23:54] tubbo: mwlang: there's a helper for that i'm pretty sure..
[16:24:13] Oog: has joined #RubyOnRails
[16:24:25] banister: has joined #RubyOnRails
[16:24:28] Oog: in an after_filter is there a way to get the total time spent rendering etc?
[16:24:29] tubbo: mwlang: what is setting DateTime and Time's :default entry?
[16:24:42] Rodya_: has joined #RubyOnRails
[16:25:33] mwlang: tubbo: it’s a lambda now. https://gist.github.com/mwlang/6f2f4953ef8b42c101347e2a65c11b29
[16:25:44] tubbo: mwlang: so don't do that?
[16:25:45] tvon: has joined #RubyOnRails
[16:26:08] tubbo: mwlang: i'm not telling you to set the date formats in yaml in ADDITION to that, i was saying maybe it's a less wordy alternative...
[16:26:55] mwlang: tubbo: if there’s a helper for automatically supressing the time component in templates when hour + minute + second is zero, then I’ll gladly use it, but I couldn’t find it.
[16:27:00] nogic: has joined #RubyOnRails
[16:27:49] mwlang: as far as I could tell, this approach is working well in all cases except parsing an incoming string to a Date.
[16:27:51] nogic: has joined #RubyOnRails
[16:28:01] arifba: has joined #RubyOnRails
[16:28:08] tubbo: yup, because DATE_FORMATS is a global setting
[16:28:16] tubbo: and it's going to be used for both incoming and outgoing data
[16:28:28] arifba: Can someone help me out here? https://stackoverflow.com/questions/38079412/css-animation-not-working-in-rails-app
[16:30:02] itsmedun_: has joined #RubyOnRails
[16:30:47] mwlang: So namespacing isn’t honored? Time::DATE_FORMATS and DateTime::DATE_FORMATS and Date::DATE_FORMATS == one single DATE_FORMATS?
[16:31:45] Oog: anyone have any idea in an after_filter is there a way to get the total time spent rendering etc?
[16:32:13] Oog: right now im thinking ill capture start time in a before_filter then calculate diff in the after_filter but was wondering if time might already be on the response object or something
[16:32:15] mwlang: arif__: instead of bar.toggleClass('hidden', scrollTop > prev), I think the trick is to use slideUp and slideDown, etc.
[16:33:03] ldnunes: has joined #RubyOnRails
[16:33:03] mwlang: arif__: but I’m not entirely sure as I also see you’re attempting to set up transitions in the css.
[16:33:05] blackmesa: has joined #RubyOnRails
[16:33:06] Rodya_: has joined #RubyOnRails
[16:33:41] fujinuma: I get wrong number of arguments in this controller: http://vpaste.net/YWI75
[16:34:00] chouhoulis: has joined #RubyOnRails
[16:34:06] fujinuma: I've created Visitor model with 5 fields
[16:34:07] arifba: @mwlang the confusing part is it works on codepen, jsfiddle, or any other site you can try it, but not on a rails app. I tried this on two different rails apps and it worked on neither
[16:34:34] tego101: has joined #RubyOnRails
[16:34:44] mwlang: arif__: more than likely a JS error is showing in your browswers debug console.
[16:35:10] mwlang: either that, or the stylesheet isn’t including as expected.
[16:35:27] Rodya_: has joined #RubyOnRails
[16:35:43] mwlang: so those are the first two things to guarantee are in place as expected.
[16:36:03] arifba: @mwlang everything else in application.css.scss works though, just not this one.
[16:36:46] mwlang: arif__: are you seeing the rules for .scrollTop, etc. in the browser’s inspector?
[16:38:18] kitsuneyo: has joined #RubyOnRails
[16:39:42] arifba: @mwlang ehrm... how would i go about seeing that?
[16:39:57] Rodya_: has joined #RubyOnRails
[16:40:28] asheinfeld: has joined #RubyOnRails
[16:41:03] mwlang: arif__: well, for Firefox on OSX, F12 toggles the inspector pane as does right clicking on the element and choosing “Inspect element”
[16:41:09] Circuit8: has joined #RubyOnRails
[16:41:37] Circuit8: Hey guys, what do you think the best way to handle javascript dependencies is in rails? Any preference for NPM or Bower, or another solution?
[16:41:45] arifba: @mwlang ok i do see the .scrollTop rules there
[16:41:49] mwlang: arif__: from there, find “Style” tab to the right and review the CSS rules listed there.
[16:42:00] arthurl: has joined #RubyOnRails
[16:42:33] tego101: has joined #RubyOnRails
[16:43:03] arifba: @mwlang yep the rules are there. like i said in the stackoverflow post, everything in autohide.js works fine, it's just that the button doesn't animate
[16:43:13] arifba: @mwlang could you please quickly implement it into any of your apps to see if it works for you?
[16:43:24] arifba: i just want to make sure if the problem is on my side
[16:43:29] jowiar: has joined #RubyOnRails
[16:43:43] jgt3: has joined #RubyOnRails
[16:43:47] mwlang: arif__: I actually have to go to an appointment in a moment.
[16:44:08] arifba: @mwlang ahh no worries!
[16:44:17] mwlang: check the document type that’s rendered by your rails app.
[16:45:00] mwlang: and compare to fiddle’s, etc.
[16:46:07] jowiar: has joined #RubyOnRails
[16:46:26] d0nn1e: has joined #RubyOnRails
[16:47:39] arifba: @mwlang hmm the doc types match as well
[16:49:21] partialTerror: has joined #RubyOnRails
[16:49:27] arifba: @mwlang anyway, if you do come up with an answer later, please answer it on stackoverflow. thanks!
[16:50:46] dminuoso: has joined #RubyOnRails
[16:51:24] DoctorMonocular: has joined #RubyOnRails
[16:56:04] theod: has joined #RubyOnRails
[16:57:16] tego101: has joined #RubyOnRails
[16:57:21] agent_white: has joined #RubyOnRails
[16:57:42] jowiar: has joined #RubyOnRails
[16:57:50] emiltin: has joined #RubyOnRails
[16:59:37] tego101: has joined #RubyOnRails
[17:00:29] fox_mulder_cp: hhe, my Polymorphic Associations with uuid as id can't processed ((
[17:01:00] fox_mulder_cp: undefined method `primary_key' for String:Class
[17:01:10] Devalo: has joined #RubyOnRails
[17:01:53] aegis3121: has joined #RubyOnRails
[17:03:58] tvon: has joined #RubyOnRails
[17:09:16] solars: has joined #RubyOnRails
[17:09:38] macsteps: has joined #RubyOnRails
[17:11:06] partialTerror: Good Morning Agent White
[17:12:29] tego101: has joined #RubyOnRails
[17:12:53] fox_mulder_cp: hm. how to fix Polymorphic associations to use uuids...
[17:12:55] blackmesa: has joined #RubyOnRails
[17:13:34] yellow5: has joined #RubyOnRails
[17:16:06] nettoweb: has joined #RubyOnRails
[17:16:35] sebstrax: has joined #RubyOnRails
[17:18:16] hahuang61: has joined #RubyOnRails
[17:19:00] dionysus69: has joined #RubyOnRails
[17:20:07] wtiger: has joined #RubyOnRails
[17:21:34] Oliphaunte: has joined #RubyOnRails
[17:21:54] wtiger: is there a way to use rails without learning the activerecord dsl?
[17:22:27] fox_mulder_cp: wtiger: plain sql?^_
[17:22:49] fryguy: wtiger: well, tell us about why you don't want to use the activerecord DSL and we can point you to alternatives
[17:23:06] pilne: has joined #RubyOnRails
[17:23:12] dminuoso: wtiger: Rails is just a collection of many gems. You can easily do many things even without an entire SQL database.
[17:23:19] wtiger: creating/changing tables, adding constraints etc
[17:24:00] hirvi: has joined #RubyOnRails
[17:24:08] fryguy: you could just execute SQL in your migration scripts instead if you want to
[17:24:20] wtiger: that's cool
[17:24:35] tego101: has joined #RubyOnRails
[17:25:38] fox_mulder_cp: wtiger: u can use sql views, function, procedures... magic :)
[17:26:41] fryguy: http://stackoverflow.com/questions/14856856/how-to-write-sql-in-a-migration-in-rails
[17:27:07] wtiger: fryguy: thanks
[17:27:40] yardenbar: has joined #RubyOnRails
[17:27:44] arBmind: has joined #RubyOnRails
[17:28:06] fox_mulder_cp: wtiger: now on my oracle based crm oracle dev has ~2500 views, based on tons of tables
[17:28:06] tubbo: wtiger: use mongoid :)
[17:28:14] tubbo: or neo4j-rails
[17:28:26] fox_mulder_cp: tubbo: no, no csv ::))) hahah
[17:28:27] tubbo: or elasticsearch-persistence, my new favorite
[17:28:32] tubbo: fox_mulder_cp: wat
[17:29:19] wtiger: writing sql directly won't output the timestamps goodness, right?
[17:29:26] fryguy: wtiger: right
[17:29:39] wtiger: guess I could write them myself too :)
[17:29:52] tubbo: wtiger: why do you want to use AR without using the migration DSL?
[17:30:03] fox_mulder_cp: tubbo: old, classic sql based on csv, pparsed via perl/bash/sed/awk :)
[17:30:19] wtiger: tubbo: i know sql, why do I need the dsl? it's a big hindrance to my progress
[17:30:34] tubbo: fox_mulder_cp: yeah but i was serious.
[17:30:44] tubbo: fox_mulder_cp: i see what you're saying now :D
[17:31:16] tubbo: wtiger: well as long as you follow the same conventions that AR expects out of the tables (like having an id column, that column being your primary key, tables named as pluralized model names, etc.)
[17:31:21] tubbo: i feel like you'll be fine
[17:31:35] tubbo: wtiger: fuck it, just write db/structure.sql and then you can set up your whole DB in one file :)
[17:31:55] wtiger: that seems wonderful
[17:32:03] Ergo: has joined #RubyOnRails
[17:32:11] tubbo: we had to do that at a past company i worked for because we needed some postgres-specific stuff that hadn't been added to the schema dsl yet, like being able to CREATE EXTENSION
[17:32:16] tubbo: (which you can do now in AR itself)
[17:32:21] Dysp: has joined #RubyOnRails
[17:32:39] fox_mulder_cp: wtiger: tubbo AR is a good and easy abstraction for make sql admin and programmer different
[17:32:49] tego101: has joined #RubyOnRails
[17:32:57] tubbo: fox_mulder_cp: i think genetics is a better abstraction.
[17:33:01] Dysp: Hi there. I was wondering if someone would help by explaining me how to implement scripts to be run by the application. Please be aware I am a total newbie.
[17:33:07] tubbo: fox_mulder_cp: as in, they are two different people.
[17:33:08] matthias_: has joined #RubyOnRails
[17:33:16] fox_mulder_cp: but in very, very high load projects ORM migrated to plain optimized sql
[17:33:20] wtiger: hmm, what do you guys/gals think about other orms like datamapper, sequel etc
[17:33:23] tubbo: Dysp: type `bin/rails runner --help`
[17:33:52] tubbo: i've never used Sequel, but i have used DataMapper
[17:33:58] tubbo: i don't find it to have much of a benefit over AR
[17:34:25] Dysp: Elaboration: Say user should upload excel sheet. Excel sheet is put into memory and script is used on excel sheet. Out comes an object that I wish to save to database (serialize?). How would a proper way of doing this be?
[17:34:33] Dysp: Is it simply done by runner?
[17:34:49] tubbo: Dysp: you want a user to upload an excel sheet, like through a controller, and then you want to run a shell script?
[17:35:05] tubbo: Dysp: why not just do the work in a background job or something?
[17:35:07] Dysp: The thing is here.. I don't know what I want to do.
[17:35:16] Dysp: I don't know how it is done, simply.
[17:35:20] tubbo: Dysp: how what is done
[17:35:23] Dysp: Background job would propably be the best thing, yes.
[17:35:26] tubbo: you've asked like 4 questions so far ;)
[17:36:04] Dysp: I know. It's hard to specify a question when you don't really know what you are asking in details
[17:36:07] Dysp: So you get vague questions
[17:36:14] wtiger: tubbo: ok
[17:36:25] Dysp: Excel -> Controller -> Background job? -> Model?
[17:36:26] Dysp: Or what?
[17:36:35] tubbo: Dysp: so what about this whole thing are you having issues with? parsing the spreadsheet?
[17:36:37] Dysp: I just need to wrap up what to read up on
[17:36:38] tubbo: taking in the data?
[17:36:55] Dysp: I haven't even start building the applikation yet.
[17:37:09] chouhoulis: has joined #RubyOnRails
[17:37:43] Dysp: And since I've gotten a little tired of programming for today, I felt like doing some research instead. I have an okay grasp on how a basic rails applikation works, but beyond that my knowledge is very limited.
[17:37:52] chouhoulis: has joined #RubyOnRails
[17:37:57] Dysp: I am ok with Ruby, but overall a newb.
[17:38:00] baweaver: application by the way
[17:38:07] helpa: Rails 4 in Action - http://manning.com/bigg2 - An excellent book combining Rails and TDD/BDD development. Written by Rebecca Skinner, Steve Klabnik, Ryan Bigg, Yehuda Katz
[17:38:18] baweaver: that'll cover a lot of rails content for you if you want to do some research
[17:39:45] Dysp: Okay, thx. Will bookmark. What I need is more like a top-down view on how to use the rails framework. Not a tutorial.
[17:39:51] Dysp: Will that book do?
[17:40:53] baweaver: This goes through a longer tutorial type sequence but also covers most of the elements
[17:40:57] baweaver: though for that you want the docs
[17:41:51] Dysp: I guess I will get my reader on
[17:42:40] tego101: has joined #RubyOnRails
[17:42:50] baweaver: There's a Rails Deep Dive out there, but it requires some substantial knowledge to get through
[17:42:59] baweaver: it's basically rebuilding rails from ground zero
[17:47:23] adre: has joined #RubyOnRails
[17:48:04] tego101: has joined #RubyOnRails
[17:50:06] roamingdog: has joined #RubyOnRails
[17:51:03] tubbo: it's called "Rebuilding Rails"
[17:51:07] tubbo: or at least, that' sone of them :)
[17:52:23] skroon: is there away to both log to STDOUT but also to logfile?
[17:54:05] itsmeduncan: has joined #RubyOnRails
[17:54:55] havenwood: skroon: The typical setup is to do exactly that, log STDOUT to a log file: http://guides.rubyonrails.org/debugging_rails_applications.html#what-is-the-logger-questionmark
[17:55:44] crankharder: anyone know if heroku can be configured to retain the previous sets of compiled assets? seeing some issues where, I think, heroku is clobbering the old asset sets on deploy and some clients are requesting them
[17:56:05] diegoviola: has joined #RubyOnRails
[17:56:50] jas02: has joined #RubyOnRails
[17:59:14] rubyonrailed: has joined #RubyOnRails
[17:59:33] AntiSpamMeta: has joined #RubyOnRails
[18:00:25] rubyonrailed: I have some extra params coming into my create action that aren't permitted. How can I ignore those params when trying to save my object?
[18:01:07] fox_mulder_cp: fix permitted_params..
[18:01:15] aegis3121: has joined #RubyOnRails
[18:02:48] User458764: has joined #RubyOnRails
[18:03:34] B1n4r10: has joined #RubyOnRails
[18:04:34] asheinfeld: has joined #RubyOnRails
[18:05:50] jowiar: has joined #RubyOnRails
[18:05:58] roamingdog: has joined #RubyOnRails
[18:08:12] banister: has joined #RubyOnRails
[18:09:08] reckoner: has left #RubyOnRails: ()
[18:10:36] edwinvdgraaf: has joined #RubyOnRails
[18:12:29] yfeldblum: has joined #RubyOnRails
[18:13:25] edwinvdgraaf: has joined #RubyOnRails
[18:13:30] tubbo: rubyonrailed: !code
[18:13:30] helpa: rubyonrailed: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[18:14:10] arnonhongklay: has joined #RubyOnRails
[18:15:53] centrx: has joined #RubyOnRails
[18:17:52] Rodya_: has joined #RubyOnRails
[18:19:19] mdw: has joined #RubyOnRails
[18:20:53] ustrajunior: has joined #RubyOnRails
[18:20:57] USvER: has joined #RubyOnRails
[18:21:25] reckoner: has joined #RubyOnRails
[18:22:02] dc4: has joined #RubyOnRails
[18:22:57] fujinuma: how can I define two model's association in this situation?
[18:23:01] USvER: I have strange problem. When i do "accepts_nested_attributes_for ......... reject_if: ->{ false }".I get all items duplicated...
[18:23:07] fujinuma: I have three models User, Visitor, Site
[18:23:17] jyraff: has joined #RubyOnRails
[18:23:20] fujinuma: User registers and creates many sites
[18:23:47] fujinuma: Visitors visits many sites
[18:23:54] omosofe: has joined #RubyOnRails
[18:23:59] fujinuma: Site has many visitors but only one user
[18:24:00] tubbo: USvER: that is strange
[18:24:29] Rodya_: has joined #RubyOnRails
[18:24:30] omosofe: has left #RubyOnRails: ()
[18:24:47] omosofe: has joined #RubyOnRails
[18:25:03] USvER: tubbo, without reject_if or with reject_if: ->{ true } items not rejected nor duplicated
[18:25:34] omosofe: has left #RubyOnRails: ()
[18:25:42] macsteps: has joined #RubyOnRails
[18:26:05] USvER: tubbo, i think i will go mad with this =\
[18:26:33] tubbo: USvER: i think this is the wrong place to be rejecting params personally.
[18:26:44] tubbo: why not block these params from being mass-assigned in the controller, with the more powerful StrongParameters?
[18:26:51] yellow5: has joined #RubyOnRails
[18:27:08] partialTerror: has joined #RubyOnRails
[18:27:38] USvER: tubbo, i want reject parameters with blank values(not :all_blank)
[18:28:19] USvER: tubbo, can i use StrongParameters for this?
[18:29:48] USvER: tubbo, i was thinking that iterating though parameters array and rejecting will be more dirty than reject_if: ->(attributes){ attributes['value'].blank? }
[18:29:52] tubbo: hmm, yeah i don't think strong params can help with that
[18:31:00] tubbo: USvER: in the docs for accepts_nested_attributes_for, i noticed this env variable: REJECT_ALL_BLANK_PROC
[18:31:05] USvER: tubbo, also i have attribute called "value", is it reserved word? maybe this is why i have this strange behavious?
[18:31:06] tubbo: USvER: http://api.rubyonrails.org/classes/ActiveRecord/NestedAttributes/ClassMethods.html
[18:31:52] tubbo: fujinuma: so a site has an owner, and visitors
[18:32:11] snowy: has joined #RubyOnRails
[18:32:21] USvER: tubbo, not all attributes are blank... so i cant use :all_blank
[18:32:58] partialTerror: has joined #RubyOnRails
[18:33:11] tubbo: fujinuma: the Site-Visitor relationship is the only complex part. it depends on what "Visitor" means to you.
[18:33:57] USvER: fujinuma, tubbo, Visitor and User is separate models?
[18:34:53] tubbo: USvER: <fujinuma> I have three models User, Visitor, Site
[18:35:34] jas02: has left #RubyOnRails: ()
[18:40:02] arnonhongklay: has joined #RubyOnRails
[18:41:52] artto: has joined #RubyOnRails
[18:43:55] Oliphaunte: has joined #RubyOnRails
[18:46:28] iceden: has joined #RubyOnRails
[18:47:26] ustrajunior: has joined #RubyOnRails
[18:47:28] ekinmur: has joined #RubyOnRails
[18:50:02] USvER: fujinuma, tubbo, I would use something like this... https://gist.github.com/USvER/5385437cc88ff60e752bb3ed9846c864
[18:50:07] pontiki: has joined #RubyOnRails
[18:52:10] tubbo: don't worry about mentioning me, USvER...i don't care :P
[18:52:14] fujinuma: USvER: yeah
[18:52:31] fujinuma: the complex part is relation between site, user and visitor
[18:52:34] fox_mulder_cp: hm. add into migration t.boolean :active field, it seemd ok at posgtesql, but when i try to set in into model.active = true raised undefined method `active='
[18:53:17] USvER: fujinuma, feel free to ask me...
[18:53:19] fox_mulder_cp: in rails 5 apps - it's ok
[18:53:26] fox_mulder_cp: in 4.2.6 - fails now
[18:54:13] fox_mulder_cp: tubbo: may be u can help me. as a pro :)
[18:55:55] fox_mulder_cp: active: nil, in .inspect presents
[18:56:26] tubbo: fox_mulder_cp: !code
[18:56:26] helpa: fox_mulder_cp: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[18:56:36] whathapp_: has joined #RubyOnRails
[18:56:58] sneakers: has joined #RubyOnRails
[18:57:07] ych: has joined #RubyOnRails
[18:57:36] centrx: has joined #RubyOnRails
[18:59:12] fujinuma: USvER: I'm writing a web widget
[18:59:50] fujinuma: USvER: I defined three models, Site, User and Visitor
[19:00:31] USvER: fujinuma: and, the question is?
[19:00:52] fujinuma: USvER: how should I define association?
[19:01:25] USvER: fujinuma: first of all, most likely you don't want a separate model for the visitor
[19:01:48] USvER: fujinuma: istead you want user to be able to visit sites
[19:02:01] USvER: fujinuma: am i right?
[19:02:09] ekinmur: has joined #RubyOnRails
[19:02:19] DoctorMonocular: has joined #RubyOnRails
[19:02:34] jmignault: has joined #RubyOnRails
[19:02:35] fujinuma: USvER: user registers and add sites which visitor can visit
[19:03:04] USvER: fujinuma, visitor is not registered user?
[19:03:56] USvER: fujinuma, so what the problem, to define relation betwin site and visitor it's just a simple has_many :visitors
[19:05:21] fujinuma: USvER: how can I get site.visitors?
[19:05:43] tubbo: fujinuma: !associations for more info fwiw
[19:05:43] helpa: fujinuma: http://guides.rubyonrails.org/association_basics.html - Active Record Association Basics by Mike Gunderloy
[19:06:16] USvER: fujinuma, on the visitors table add collumn site_id, on the site model add has_many :visitors
[19:07:10] Devalo: has joined #RubyOnRails
[19:07:17] fujinuma: I've done opposite :)
[19:07:30] fox_mulder_cp: tubbo: gist here. each fails. but count work, https://gist.github.com/foxmuldercp/b742c4727c39e6af5712d983f8ebfe4c
[19:07:32] fujinuma: tubbo: I read that.
[19:07:55] tubbo: fox_mulder_cp: yeah i think it's all.each, not each
[19:08:28] fox_mulder_cp: tubbo: where(ip: 'ip').first fails to .update(active: true)
[19:09:00] USvER: fujinuma, why you add opposite? You want site to have many visitors... So one visitor will have relation to site, and site will have many visitors///
[19:09:48] fujinuma: USvER: OK. there is WidgetsController which I get visitor information through it
[19:10:13] fujinuma: USvER: how to build Visitor inside the controller? Visitor.sites.buid?
[19:10:26] tubbo: fujinuma: do opposite of opposite
[19:10:53] fujinuma: USvER: Site.visitors.build?
[19:11:05] tubbo: fujinuma: no opposite of that
[19:11:15] tubbo: haha nah i'm just messing with you
[19:11:29] USvER: fujinuma site.visitors.build are fine
[19:11:35] fujinuma: tubbo: damn :D
[19:11:55] brettu: has joined #RubyOnRails
[19:11:55] tubbo: fujinuma: anyway, please re-read the guide as i'm pretty sure it solves the problem you're talking about. this is just a basic has_many/belongs_to relationship.
[19:11:57] USvER: fujinuma, skype?
[19:12:25] fujinuma: USvER: internet is slow :|
[19:12:55] fujinuma: how to remove a column from a table?
[19:13:06] fujinuma: is there a generator for it?
[19:13:29] USvER: fujinuma, since you are mantioning "build" are you having troubles with storing the visits? or with relation itself?
[19:13:35] fox_mulder_cp: fujinuma: rails migrations
[19:14:02] fujinuma: USvER: first one
[19:14:37] USvER: fujinuma, please !gist your models, and migrations for that models
[19:14:50] tubbo: fujinuma: !migrations
[19:14:50] helpa: fujinuma: http://guides.rubyonrails.org/migrations.html - Migrations Guide by Frederick Cheung
[19:15:16] morfin: what's proper way to reverse database in schema.rb?
[19:16:06] fox_mulder_cp: morfin: rake db:rollback, db:reset, drop schema.rb and make it by db:migrate
[19:16:17] fox_mulder_cp: morfin: man rake --tasks
[19:16:29] SteenJobs: has joined #RubyOnRails
[19:16:50] morfin: basically i have non-ruby app with database
[19:17:27] pontiki: then why are you in here?
[19:17:41] morfin: because i want to rewrite with RoR
[19:17:41] fujinuma: USvER: https://gist.github.com/anonymous/ae3476e8ed586985aed827d14aae0aa5
[19:17:49] pontiki: ah, sorry, gotcha
[19:18:10] morfin: so i have to create migrations for every table i already has, export data, recreate database, import data
[19:18:21] pontiki: do you mean to etract the current database design into schema.rb?
[19:18:36] pontiki: ah, yeah, "reverse" was confusing above :)
[19:19:01] pontiki: i've never done this, but you can run `rake db:schema:dump`
[19:19:03] fujinuma: USvER: is it correct?
[19:19:43] tubbo: morfin: i did this once. migrated from CakePHP and MySQL to Rails and PostgreSQL.
[19:19:50] USvER: fujinuma: looks fine... site.visitors.build.... then save
[19:19:55] fujinuma: USvER: btw, auto completion with your nickname is really messy.
[19:20:01] pontiki: morfin: do you know if the current database contains any views, stored procs, or other such things?
[19:20:09] aldodelgado: has joined #RubyOnRails
[19:20:11] patrick_star_2: has joined #RubyOnRails
[19:20:13] morfin: nothing like that so should be easy
[19:20:14] tubbo: morfin: the solution we came up with was to run a script that converted between the two databases, instead of trying to use the old database with the new rails app.
[19:20:22] aldodelgado: Is it possible to create a model scope that returns a set of results and then from those results have a condition to only return the strings from a column?
[19:20:28] aldodelgado: https://gist.github.com/aldodelgado/52afb736463e5c379ba8fc8a3f1ee47f
[19:20:33] aldodelgado: Thats the query I can do in the console. However I’d like to make it a scope
[19:20:36] morfin: well, converting could be pretty simple
[19:20:40] fujinuma: USvER: how about adding site_id to visitors?
[19:21:02] tubbo: aldodelgado: it would probably be better off as a class method, since it won't be chainable to other scopes
[19:21:07] morfin: seems like db:migrate calls same code as db:scema:dump btw afte rmigrating
[19:21:26] aldodelgado: tubbo: but can I still return a st of results?
[19:21:28] USvER: fujinuma, rails magic, when you say site.visitors it will automaticaly add site_id to it
[19:22:17] fujinuma: USvER: so why in some tutorial they also do the migration?
[19:22:36] tubbo: aldodelgado: you can use the :pluck method to get just the one attribute from each record
[19:22:48] aldodelgado: tubbo: ah ok let me give that a try
[19:22:51] USvER: fujinuma, ofc you need a migration... you need to add site_id field to visiotr
[19:23:13] tubbo: aldodelgado: oh wait, is live.title a different objecT?
[19:23:25] USvER: fujinuma, thats why i asked you to post a gist WITH MIGRATIONS
[19:23:30] aldodelgado: tubbo: mongodb
[19:23:47] fujinuma: USvER: rails g migration add_site_id_to_visitors site_id:integer:index
[19:23:51] fujinuma: USvER: right?
[19:23:57] aldodelgado: so its an object that extends itself
[19:24:31] USvER: USvER: i'm not using generators, i prefare to add migrations manualy
[19:24:31] tubbo: aldodelgado: you can only pluck direct descendants from the object
[19:24:53] tubbo: like if you have Order embeds_many :items embeds_many :shipments, you can't do Order.pluck 'shipment.name' or something
[19:25:09] aldodelgado: ok I understand now, thanks!
[19:25:14] fujinuma: USvER: OK. here's the controller: https://gist.github.com/anonymous/897c15bf78875782968e9702f6f9cef7
[19:25:15] Rodya_: has joined #RubyOnRails
[19:26:47] USvER: fujinuma, i'm not sure if this line works as you expect
[19:26:54] USvER: fujinuma, @visitor = @site.visitors.build(visitor_params).save
[19:27:21] USvER: fujinuma, i guess save will not happen... you have to save @site instead
[19:27:44] tubbo: USvER: save could happen, but @visitor becomes a true or false
[19:27:47] tubbo: not a Visitor
[19:27:48] fujinuma: USvER: site is already exist
[19:27:50] tubbo: fujinuma: ^
[19:28:44] pontiki: anyone else need a spoon ?
[19:29:01] fujinuma: USvER: so after I find an already exist site then I should save it?
[19:29:33] USvER: fujinuma, you find site, you change visitors on it, you seve site, wich will in turn save visitors
[19:29:43] nettoweb: has joined #RubyOnRails
[19:30:12] fujinuma: USvER: https://gist.github.com/anonymous/a608f1df37ad6feb8ab7c2fc4d540ea8
[19:31:27] USvER: fujinuma, and the problem with that code is? visitors database is empty? no visitors saved?
[19:31:49] jowiar: has joined #RubyOnRails
[19:33:02] USvER: fujinuma, open rails console (rails c) and test there... you should see SQL queries logged... this will give you a clue whats happening
[19:34:39] reckoner: has left #RubyOnRails: ()
[19:35:03] fujinuma: USvER: I've already find out.
[19:35:29] USvER: fujinuma: nice! gj!
[19:35:49] fujinuma: USvER: build adds site_id to visitor then I save site with visitors.
[19:35:54] centrx: has joined #RubyOnRails
[19:36:31] USvER: fujinuma: yeah... as it should be
[19:36:58] fujinuma: USvER: I've totally got that wrong and it's been hours I stock at this level :|
[19:37:14] edwinvdgraaf: has joined #RubyOnRails
[19:37:58] yardenbar: has joined #RubyOnRails
[19:38:28] fox_mulder_cp: wow. 2 bugs https://github.com/rails/rails/milestones/5.0.0
[19:38:30] fujinuma: tubbo, USvER: thank you for your time and patience, for real :)
[19:39:37] USvER: fujinuma: this way you are adding new visitor each time it's One-to-Many. Previously you asked about Visitor has many Sites and Site has many Visitors... that is a different story... Many-to-Many relation
[19:39:54] centrx: has joined #RubyOnRails
[19:40:32] USvER: fujinuma: but i guess you are tottaly fine with One-to-Many relation.
[19:40:56] mdw: has joined #RubyOnRails
[19:41:35] fujinuma: USvER: yeah I got that wrong. do you know any tool to request by random IPs?
[19:41:50] fujinuma: USvER: to test fake visitors.
[19:43:31] jrochkind: has joined #RubyOnRails
[19:43:43] jrochkind: Is there any way to provide content to a `content_for` from a controller, rather than a view?
[19:45:36] workmad3: has joined #RubyOnRails
[19:46:52] USvER: fujinuma, sorry i'm not tested such scenario when you need to test icluding fake ip... read about rails testing...
[19:48:25] USvER: fujinuma, i see your project is about site statistics... IMHO rails is not good fit here =)
[19:49:25] USvER: fujinuma, my stack for such project would be nodejs + mongodb
[19:56:54] sharkman: has joined #RubyOnRails
[19:57:05] myworkaccount33: has left #RubyOnRails: ()
[19:57:44] sharkman: good gentleman of the internet, if i have a rails model which has say this line, def info; "blah"; end... then i can access it by entry.info... how can i make it accessible through entry[:info]
[19:58:02] nofxx: USvER, fujinuma I would rewrite that server part only on js or erlang or whatever, and be running fast with ruby
[19:58:13] nofxx: also, rethinkdb might worth a look for that use case
[19:58:38] nofxx: nothing against mongo, use it everywhere... just use case scenario
[19:58:45] jas02: has joined #RubyOnRails
[19:59:24] jas02: has left #RubyOnRails: ()
[20:00:38] sharkman: thoughts good sirs?
[20:01:33] pvertenten: has joined #RubyOnRails
[20:02:39] USvER: nofxx, fujinuma: everyone have their own view... i'm just said that Rails as framework and SQL database is not a good fit...
[20:03:26] matthias_: has joined #RubyOnRails
[20:03:47] USvER: sharkman: try entry.as_json[:info]
[20:04:14] sharkman: USvER i need to access the data exactly as entry[:info] because of conventions im already using
[20:04:32] sharkman: so i need to make code and put it into the model that will make it accessible in that way. if thats possible.
[20:04:48] centrx_: has joined #RubyOnRails
[20:04:53] USvER: sharkman look at attr_accessible
[20:05:03] DoctorMonocular: has joined #RubyOnRails
[20:05:42] roamingdog: has joined #RubyOnRails
[20:07:03] solars: has joined #RubyOnRails
[20:07:35] USvER: sharkman: sorry i meant attr_accessor
[20:09:28] nofxx: USvER, disagree... all systems needs lots of GUIs: config account, help, whatever and ever ever... you just go with a better tool for specific jobs
[20:10:20] nofxx: USvER, real case scenario, app that receives tons of writes of IoT devices... like 1000writes/sec easily... all the configs and whatnots are rails, and a nice elixir server handling that "heavy" part
[20:11:30] USvER: nofxx, but i was talking not about GUI... but about exact usecase... controller for ctoring visits of a site...
[20:11:45] sharkman: okay thanks USvER
[20:11:46] jas02: has joined #RubyOnRails
[20:12:31] USvER: sharkman, did that helped? Because i'm not shure if attr_accessor magic adds array-like interface
[20:12:39] whathappens: has joined #RubyOnRails
[20:13:08] nofxx: USvER, yup, you can make it work fast with ruby, and when that part starts to bottleneck, just rewrite it
[20:13:15] nofxx: you won't even need to change .js heh
[20:13:21] sharkman: im looking but i dont see how to make it work yet
[20:13:33] nofxx: with fast I mean programmer fast, machines are cheap
[20:14:13] jenrzzz: has joined #RubyOnRails
[20:14:13] jenrzzz: has joined #RubyOnRails
[20:14:19] USvER: nofxx, agree
[20:15:27] sharkman: hey i want to hire someone to work, any chance i can find someone in here?
[20:15:37] solars: has joined #RubyOnRails
[20:15:48] sharkman: part time, long term, flexible work. ruby, rails, postgres, like $15-$30 an hour ddepending on skill level i will pay
[20:15:56] lupine: sharkman: probably not. literally nobody here is any good at omg
[20:16:08] sharkman: haha, too low? too high?
[20:16:08] USvER: ahahahaah
[20:16:21] lupine: yeah. too low
[20:16:35] sharkman: russians on freelancer work for $10!
[20:16:43] lupine: contractor rate here is ~£500/day
[20:16:45] USvER: sharkman, you found me, but 40$ will be fine :D
[20:17:05] nofxx: sharkman, brazil is way better for you, dollar is like 4x the coin
[20:17:06] lupine: which is easily order-of-magniude
[20:17:09] pontiki: that's okay, hire the russians
[20:17:10] sharkman: arent there any poor khazakis in here?
[20:17:56] USvER: sharkman, not indian anymore?
[20:17:56] centrx: has joined #RubyOnRails
[20:18:30] sharkman: i dunno, market sounds so expensive, maybe id do best with a bangladeshi
[20:18:59] sharkman: lupine what were you sayng, order of magnitude what?
[20:19:15] lxsameer: has joined #RubyOnRails
[20:19:23] lupine: um. https://en.wikipedia.org/wiki/Order_of_magnitude
[20:19:44] USvER: sharkman, you can ping me on skype: TridentStudio
[20:19:51] tubbo: sharkman: $15-30 an hour? haha
[20:20:20] roamingdog: has joined #RubyOnRails
[20:20:29] sharkman: tubbo i dont know, that seems reasonable based on upwork
[20:22:07] sharkman: what is reasonable to ofer in here
[20:23:29] lupine: sharkman: for employment, you're looking at at least double your max rate, I suspect. for contracting, at least ten times
[20:23:54] USvER: ahahaaahahh
[20:23:59] dc4: has joined #RubyOnRails
[20:24:54] neha-: has joined #RubyOnRails
[20:26:03] sharkman: huh, $300 an hour?
[20:26:04] Rodya_: has joined #RubyOnRails
[20:26:26] lupine: sorry, I'm being thick
[20:26:28] USvER: sharkman, i would double that to make sure you will get a real pro
[20:26:43] lupine: hourly rate != daily rate, of course
[20:26:47] roamingdog: note to self - become a real pro
[20:26:50] lupine: brb, handing in maths card
[20:27:37] USvER: roamingdog, 600$/hr??? not bad!
[20:27:56] sharkman: so i i pay $600 an hour will i at least get someone with 5 years experience?
[20:27:57] JamieD: has joined #RubyOnRails
[20:28:16] USvER: thick troll =)
[20:28:31] brendan-: i've stopped using upwork due to their change to % fees and tiering
[20:28:38] Darmani: has joined #RubyOnRails
[20:28:40] brendan-: and i was a freelancer vs an employer
[20:28:43] USvER: brendan- same shit
[20:28:55] brendan-: waiting for something else to come along
[20:29:03] tubbo: sharkman: if you're a programmer, why are you looking at upwork?
[20:29:11] fox_mulder_cp: really people drop it's upwork?
[20:29:16] brendan-: and it's per client too USvER vs per freelancer
[20:29:38] USvER: tubbo: oursource?
[20:29:39] brendan-: i'd rather have my % drop over x number of jobs i've completed than 10K in wages per job
[20:29:44] sharkman: tubbo i have enough work for more than me, and id rather take a semi vacation and outsource the coding
[20:29:56] USvER: tubbo: outsource* sr
[20:29:57] jetpackj1: has joined #RubyOnRails
[20:29:58] fox_mulder_cp: tubbo: my friend use upwork for work as a long jobs.. more than 2 years..
[20:30:45] hahuang61: has joined #RubyOnRails
[20:31:04] B1n4r10: has joined #RubyOnRails
[20:32:43] jhack: has joined #RubyOnRails
[20:34:19] macsteps: has joined #RubyOnRails
[20:34:48] JamieD: has left #RubyOnRails: ("Textual IRC Client: www.textualapp.com")
[20:37:03] qejk: has joined #RubyOnRails
[20:39:05] solars: has joined #RubyOnRails
[20:40:44] evansbee: has joined #RubyOnRails
[20:41:20] AntiSpamMeta: has joined #RubyOnRails
[20:42:23] ekinmur: has joined #RubyOnRails
[20:44:05] jowiar: has joined #RubyOnRails
[20:49:19] USvER: sharkman: As for you problem. i think this will help you http://stackoverflow.com/a/20417181/670156
[20:49:55] Darmani: Hey guys does this look right?
[20:49:55] meoblast001: has joined #RubyOnRails
[20:49:56] Darmani: https://gist.github.com/mfifth/20f8e664b3944a7154ca0d7199360c3c#file-order_controller-rb-L8
[20:50:14] pontiki: Darmani: does it work?
[20:50:41] Darmani: pontiki: no :[
[20:51:18] pontiki: error messages might help
[20:51:37] Darmani: pontiki: https://gist.github.com/mfifth/20f8e664b3944a7154ca0d7199360c3c#file-error-msg
[20:54:02] pontiki: Darmani: look at line 2 on that file
[20:54:46] Darmani: pontiki: I see it...
[20:56:13] Darmani: I figured this line would create the order and the id.
[20:56:20] Darmani: pontiki: https://gist.github.com/mfifth/20f8e664b3944a7154ca0d7199360c3c#file-error-msg
[20:56:59] clandry: has joined #RubyOnRails
[20:57:59] jsrn: has joined #RubyOnRails
[21:00:38] ur5us: has joined #RubyOnRails
[21:01:00] marr: has joined #RubyOnRails
[21:03:51] pontiki: this line? https://gist.github.com/mfifth/20f8e664b3944a7154ca0d7199360c3c#file-order_controller-rb-L10
[21:04:04] tubbo: find_or_create_by! expects a hash fwiw
[21:05:31] pontiki: let's assume for a minute the find_or_create_by! succeeded. in #show you're looking for an :order_id, that's not going to be in params
[21:08:18] Talltree: has joined #RubyOnRails
[21:09:17] DoctorMonocular: has joined #RubyOnRails
[21:09:27] edwinvdg_: has joined #RubyOnRails
[21:13:35] quazimodo: has joined #RubyOnRails
[21:14:56] Darmani: pontiki: o.o
[21:15:36] pontiki: look at your routes
[21:16:52] Coldblackice: has joined #RubyOnRails
[21:17:00] Darmani: pontiki: I'm still a little iffy on how params work I guess.
[21:17:13] Darmani: I thought order_id would be the way to go.
[21:17:13] pontiki: Darmani: !routing
[21:17:13] helpa: Darmani: http://guides.rubyonrails.org/routing.html - Rails Routing From the Outside In - Rails Guide - by Mike Gunderloy
[21:17:23] Darmani: pontiki: I've read that -__-
[21:17:37] pontiki: read it again, then
[21:17:45] pontiki: i read it from time to time
[21:17:57] pontiki: i read Enumerable at least once a month
[21:18:02] pontiki: there's no harm in it
[21:18:13] Darmani: pontiki: I suppose you're right ^.^
[21:18:43] pontiki: i gave a talk on routing last week, and to prepare i read that guide through twice
[21:19:39] Darmani: pontiki: Are you a teacher or something?
[21:20:03] pontiki: we have a monthly rails beginners meetup i lead
[21:20:19] Darmani: pontiki: I wanna come D:
[21:20:55] pontiki: 2nd monday of the month in minneapolis
[21:21:25] pontiki: http://www.meetup.com/ruby-on-rails-for-beginners/
[21:21:57] Darmani: pontiki: that's so cool! I wonder if they have something like that in LA...
[21:22:09] pontiki: if they don't, start one
[21:23:05] Darmani: pontiki: Lol thanks man.
[21:24:08] FCser: has joined #RubyOnRails
[21:24:31] cnk: has joined #RubyOnRails
[21:24:36] baweaver: In LA? I'd be shocked if they don't
[21:24:52] banister: has joined #RubyOnRails
[21:25:04] cnk: Just joining - what in LA?
[21:25:13] Darmani: baweaver: yeah I found a few... I'm looking through them.
[21:25:16] baweaver: Ruby / Rails meetups
[21:25:22] Rodya_: has joined #RubyOnRails
[21:25:37] cnk: Yes lots. If you want details, message me
[21:25:41] Darmani: I'm scared I don't wanna go alone D:
[21:26:09] cnk: What part of LA are you in?
[21:26:38] Darmani: uhm it's like right outside LA. I'm in Whittier.
[21:27:28] cnk: OK the OC ruby meetup might actually be closer for you
[21:27:42] Darmani: cnk: There's one in OC? :o
[21:27:54] cnk: If you are willing to drive, the San Diego meetup looks great - but to far for me on a Thursday
[21:28:32] Darmani: cnk: San Diego is so far away......
[21:28:45] jowiar: has joined #RubyOnRails
[21:28:45] Darmani: OC looks good though!
[21:29:12] cnk: Hmmm I don't see them on the Meetup.com site but I still get email from them ....
[21:29:37] cnk: http://www.meetup.com/ocruby/
[21:29:43] cnk: terrible search
[21:29:54] cnk: fortunately google found them
[21:30:13] cnk: Looks like you are in luck, they are meeting Thursday
[21:30:15] Darmani: cnk: yeah I had to look on google too
[21:30:31] cnk: I am afraid I can't go with you but go. They are very low key and friendly
[21:30:48] Darmani: cnk: You don't know that Q.Q
[21:31:06] cnk: Well they were when I was last there
[21:31:42] Darmani: cnk: mehh. I guess going one time wouldn't hurt...
[21:31:52] cnk: I have not been in a while but I am sure no one will eat you
[21:31:56] baweaver: Haven't been to the SF ones in a while
[21:32:20] Darmani: cnk: I hope not xD
[21:32:32] whathapp_: has joined #RubyOnRails
[21:32:37] allcentury: has joined #RubyOnRails
[21:32:41] Darmani: I will let you all know how it goes come Friday.
[21:32:44] Darmani: Stay tuned.
[21:32:48] cnk: Sounds good
[21:33:01] cnk: the LA meetup is ? second Thursday of the month
[21:33:04] Darmani: should I bring a laptop?
[21:33:07] pontiki: time now to head over for tonight's meetup
[21:33:09] Darmani: Or like... food?
[21:33:11] Darmani: or something...
[21:33:14] baweaver: with stickers
[21:33:31] pontiki: oh yes, bring a laptop to *every* tech meetup
[21:33:42] cnk: take your laptop if you like - but don't spend the entire time looking at it
[21:33:59] cnk: I usually don't take a laptop - forces me to socialize *in person*
[21:34:23] pontiki: it's easier to get answers to your problems if you can show them code and work on it right there
[21:34:23] Darmani: cnk: But don't you have to follow along..? Or do you just listen to someone talk?
[21:34:36] jmarchello: has joined #RubyOnRails
[21:34:51] tvon: has joined #RubyOnRails
[21:35:02] cnk: I usually just listen to the talks
[21:35:03] pontiki: Darmani: most meetups are different than the one i lead
[21:35:30] pontiki: people talk, socialize, network, etc, but still bring your laptop
[21:35:34] cnk: I used to run a study group. For that I took my laptop so we could share examples
[21:35:35] jmarchello: Does anyone know of a way to have one ActiveRecord class be made up of two tables?
[21:35:53] cnk: jmarchello: by using a database view?
[21:36:00] pontiki: just be okay that you might not get a chance to use it
[21:36:23] Darmani: Okay I'll bring my laptop, my travel pillow, my fuzzy blanket, a water bottle, and a notepad.
[21:36:26] jmarchello: cnk: ahh.. Yes that would work
[21:36:41] cnk: jmarchello: one class per table is the usual way. Are you dealing with a legacy db?
[21:36:53] cnk: is that why you want to adapt 2 tables?
[21:37:15] jmarchello: no, I'm just looking for a way to keep from duplicating data
[21:37:58] pawnbox: has joined #RubyOnRails
[21:37:59] cnk: So why not 2 AR classes with a relationship - mirroring your db schema?
[21:38:47] djbkd: has joined #RubyOnRails
[21:39:04] jmarchello: Unfortunately I'm not sure how much I can talk about it given it's a proprietary system. I know that doesn't really help much haha
[21:39:08] B1n4r10: has joined #RubyOnRails
[21:40:19] cnk: No prob. The questions are just to give you things to think about
[21:40:31] cnk: depending on your database, you can't write ot a view
[21:40:47] jmarchello: cnk: thanks for the input. I appreciate it. I'll explore the DB view options and see if that's a viable solution.
[21:40:47] cnk: so if you need to write in addition ot read, a db view might not work
[21:41:38] jmarchello: I'll keep that in mind
[21:41:46] cnk: thoughtbot has a plugin for managing views - I t hink it does migrations
[21:42:05] cnk: look at their open source projects page if you decide to go down that route
[21:42:39] jmarchello: I definitely will. Thanks!
[21:46:42] whathappens: has joined #RubyOnRails
[21:49:33] solars: has joined #RubyOnRails
[21:51:24] Psyq: has joined #RubyOnRails
[21:52:12] Psyq: has left #RubyOnRails: ()
[21:58:16] macsteps: has joined #RubyOnRails
[22:04:00] desnudopenguino: has joined #RubyOnRails
[22:05:12] desnudopenguino: Anyone have an opinion on admin gems for rails? I'm looking to pick one for a project, but thought I would ask to get some experienced input
[22:07:08] helpa: Please do not use active_admin, rails_admin or any other gems to build your admin interfaces. Instead, build it yourself. This will lead you to a safe path of understanding of the code, rather than to the Hell that is those gems.
[22:08:26] wmoxam: desnudopenguino: either work fine for simple cases
[22:10:44] Axilla: has joined #RubyOnRails
[22:15:04] cnk: desnudopenguino: if you really must, then look at the one from Thoughtbot. I like their other software so that might be ok-ish.
[22:15:15] Radar: admiistrate
[22:15:51] dannyh: has joined #RubyOnRails
[22:16:12] dannyh: hi...i have a service class with an initialize event and an execute event...how do i rspec a test of an instance of the class, passing in parameters to the new (initialize) method, and then testing the output of the execute method?
[22:16:18] dannyh: i've been at it about 4 hours with no luck
[22:16:19] desnudopenguino: so the consensus is roll your own
[22:16:36] Radar: Danny_: !rule4
[22:16:36] helpa: Danny_: Do not use any service that is not Pastie or Gist to post code. Pastebin, for example has a tiny font and it has ads on it which cause the page to load slowly. Other paste services generally look like crap.
[22:16:38] Radar: Danny_: !rule0
[22:16:38] helpa: Danny_: Show rather than tell. Explaining your problem with code, stacktraces or errors is always preferred to explaining it with just text. Show us what's happening, rather than telling us. Put the code on https://gist.github.com and then give us the HTTP link to the Gist.
[22:16:49] Radar: Sorry, rule4 was a tyo
[22:16:52] cnk: Personally I often just use rail's generated scaffold for my admin interfaces
[22:16:57] xlegoman: has joined #RubyOnRails
[22:16:58] dc4: has joined #RubyOnRails
[22:18:07] dannyh: http://pastie.org/private/3kfm9m6rrx5ilmqpz5nww
[22:18:45] alfiemax: has joined #RubyOnRails
[22:18:46] dannyh: i have a controller action which creates an instance of that class (with params), and runs the execute method
[22:18:51] swistak35: has joined #RubyOnRails
[22:18:52] dannyh: im writing an rspec for my controller action
[22:18:56] Radar: @params.total + 1
[22:19:00] desnudopenguino: cnk: that sounds like a simple solution, thanks all!
[22:19:03] Radar: This line does not increase @params.total
[22:19:17] dannyh: i was trying to write a simple simple example for illustrative purposes
[22:19:20] oystersauce8: has joined #RubyOnRails
[22:19:31] Radar: Danny_: !fake
[22:19:31] helpa: Danny_: Please do not use fake values, as they can be confusing or misleading. Sometimes both.
[22:19:34] dannyh: all im trying to test is that the class instance was initialized, and that the execute method was called
[22:19:50] roamingdog: has joined #RubyOnRails
[22:19:55] dannyh: http://pastie.org/private/71pyc3fkequvu7qqp4uewa
[22:20:08] Radar: Danny_: Where is the RSpec test?
[22:20:18] dannyh: like in the folder tree?
[22:21:18] Radar: Danny_: You claim to be writing an RSpec test and having issues with it, but you haven't shown us anything.
[22:24:15] dannyh: i can't show all my code because its proprietary to my company. i can try to re-create illustrative examples in pastebin, i was just hoping we could chat about it and i could get an idea of how to proceed without having to use actual code
[22:24:35] helpa: A "Full Trace" as opposed to the default "Application Trace" is preferred.
[22:24:41] Radar: ... off my game this morning
[22:24:49] helpa: NO FAKE CODE. If you're under an NDA, we cannot help you with your problem. Go hire a consultant.
[22:25:38] cnk: Danny_: I am not sure there is value in testing that something got initialized - at least in a test focused on that something
[22:26:13] cnk: if, for example, your controller should initalize something, then mocking something and then checking that something's mock was initialized, then perhaps that is useful
[22:26:26] dannyh: im trying to confirm that the service was actually called, and with the appropriate parameters object
[22:26:30] dannyh: yes, that's what im trying to do
[22:26:37] dannyh: mock the initialize and execute events for this service class
[22:26:44] dannyh: that's all im trying to do, and i can't get that to work
[22:26:56] dannyh: ill settle for tutorial links or anything else
[22:27:04] cnk: Danny_: Since we can help iwth your live code, it's hard. I suggest you read the testing chaptersin POODR
[22:27:19] cnk: http://www.poodr.com/
[22:29:53] Radar: Danny_: expect(Service).to receive(:new).with(:parameters, :go, :here)
[22:30:09] Radar: you can chuck a .and_return(service) on the end of that, where service is probably a double.
[22:30:19] jgt3: has joined #RubyOnRails
[22:30:24] Radar: then expect(service).to receive(:execute).with(:more, :parameters)
[22:30:27] dannyh: first: thank u. i know its annoying when n00b's come along and don't follow the rules. i get annoyed by that too.
[22:30:37] dannyh: second: thank u for attempting to help me anyways :-)
[22:30:50] dannyh: third: do the expect statements go before or after the post: in the test?
[22:31:06] dannyh: thank u @Radar
[22:31:08] Radar: first: thanks for understanding
[22:31:11] Radar: second: no worries
[22:31:13] Radar: third: before
[22:31:35] dannyh: ahhh...that may be it. let me re-work, standby. also, :new === :initialize?
[22:31:50] Radar: Well, you'll be doing `Service.new` which indirectly calls the initialize method.
[22:32:57] SteenJobs: has joined #RubyOnRails
[22:33:40] dannyh: (my background btw: nodejs developer learning ruby and rails for the first time, trying to help out my team at my startup with improvements we've been dying for in our internal configuration system which never get prioritized. so, not getting as much support at my company as i'd like, but im motivated and determine (plus, since ive started all this, i've fallen in love with rails). in the span of 3 weeks ive already read
[22:33:40] dannyh: 2 ruby books and im almost done with The Rails 4 Way)
[22:35:01] DoctorMonocular: has joined #RubyOnRails
[22:35:25] cnk: excellent!
[22:37:53] pilne: Danny_-} i'm not a paid coder, but i have a hard time settling down, so i bounce from python to ruby a lot, and i'm dipping my toes into node.js
[22:38:20] jottr: has joined #RubyOnRails
[22:38:37] tanuki: has joined #RubyOnRails
[22:38:54] dannyh: i love nodejs (for certain things), but Ruby DEF has its advantages. writing scripts to process data is MUCH more annoying in node which is asynchronous
[22:40:15] pilne: i love ruby for it's syntax and semantics (it is my "explore concepts" language usually), python for it's... "plain-ness" if that makes sense, and i figured since i'm learning js on the frontend, might as well learn it for the backend too since that is what i prefer.
[22:41:39] evansbee: has joined #RubyOnRails
[22:42:28] wethu: has joined #RubyOnRails
[22:45:04] eljimmy: has joined #RubyOnRails
[22:45:41] pontiki: has joined #RubyOnRails
[22:49:00] hahuang61: has joined #RubyOnRails
[22:49:46] xall: has joined #RubyOnRails
[22:50:41] nettoweb: has joined #RubyOnRails
[22:55:55] choke: in a has many relationship, whats the easiest way to limit what is returned to a specific number when passed through like: Model.includes(:Othermodel).all for AMS?
[22:58:17] cnk: there is a limit method in AR, that help? create a scope?
[22:58:56] Darmani: Question, my images are being displayed twice in a row and they shouldn't be. I don't know why.
[22:58:57] Darmani: https://tshirtshop-mfifth.c9users.io/
[22:59:05] Darmani: Any ideas? o.o
[22:59:26] Radar: Darmani: and only for the first row of images
[22:59:55] Darmani: Radar: Yeah... To be more clear it's only the first row.
[23:00:05] Radar: Darmani: is the code on GH?
[23:00:17] choke: cnk, i could create a scope but how would that help in regard to AMS?
[23:00:24] Darmani: Radar: No :[
[23:00:55] Darmani: I can upload it though. Gimme a sec.
[23:01:03] cnk: I don't know. Can't see your code and don't know what you need
[23:01:33] Darmani: cnk: okay okay I just thought someone might know right off the bat.
[23:02:01] cnk: Darmani: sorry - that reply was for choke
[23:02:22] Darmani: cnk: oh lol
[23:02:28] crdpink2: has joined #RubyOnRails
[23:02:32] sypheren: has joined #RubyOnRails
[23:04:46] superlou: has joined #RubyOnRails
[23:05:40] Darmani: Radar: https://github.com/mfifth/T-Shirt-Store
[23:07:10] Darmani: I'm really not sure why they are being displayed twice... All of the code there is mostly html/css it's not from my db...
[23:09:46] rafaelfranca: has joined #RubyOnRails
[23:13:16] pontiki: has joined #RubyOnRails
[23:13:41] Radar: Darmani: https://github.com/mfifth/T-Shirt-Store/blob/master/app/views/shirts/index.html.erb#L21
[23:13:46] Radar: Darmani: I'm willing to bet you have two shirts in your database.
[23:14:11] pontiki: Radar: you are correct
[23:14:24] pontiki: app only responds to /shirts/1 and /shirts/2
[23:14:28] pontiki: and they're identical
[23:14:42] Darmani: But why do the rest of the shirts replicate? o.o
[23:14:55] Radar: Darmani: Look at the code I linked
[23:15:16] Darmani: Radar: okay
[23:15:23] pontiki: Darmani: you hard coded all that
[23:15:38] Darmani: pontiki: It's my first time making a website like this okay D:
[23:17:15] Cohedrin: has joined #RubyOnRails
[23:17:28] pontiki: Darmani: have you made website other ways?
[23:18:36] dalbuschat: has joined #RubyOnRails
[23:18:37] Darmani: pontiki: What do you mean? o.o
[23:20:14] choke: cnk havent started the code really... right now it's just the query, but have a places model which has a has many relationship with posts... when i run the query to get places and eager load posts i need only the last 6
[23:20:54] cnk: so .limit(6) with a sort should work
[23:21:26] choke: that would only limit the places, not the posts for each place though in a query like: Place.includes(:post).all
[23:23:27] sharkman: has joined #RubyOnRails
[23:23:56] Darmani: pontiki: Wait, so I can't have more than one shirt in my database?
[23:24:03] sypheren: has joined #RubyOnRails
[23:25:11] pontiki: you can have thousands, millions
[23:26:39] pontiki: you have told the view to print the exact same row for each shirt in your data base
[23:27:49] Darmani: pontiki: And I guess I shouldn't be doing that? o.o
[23:28:27] tvon: has joined #RubyOnRails
[23:29:18] cnk: choke: you're right. interesting
[23:29:22] jmignault: has joined #RubyOnRails
[23:30:17] pontiki: Darmani: how are you learning this?
[23:30:33] arnonhongklay: has joined #RubyOnRails
[23:30:45] Darmani: pontiki: Trial and error mostly. Using what I've learned so far.
[23:30:53] choke: maybe i'll have to do this in two queries instead of just one.
[23:31:04] dannyh: _cnk _radar got it working :-)
[23:31:10] choke: get the places, then cycle through each place and get all the posts based on criteria that i want...
[23:31:17] dannyh: (still don't know how to @ people in limechat)
[23:32:56] Radar: Danny_: !tabcomplete
[23:32:56] helpa: Danny_: If you type a few letters of another user's name and then press tab, if you have a proper client, it'll autocomplete towards their name. You might have to press tab more than once to get there though.
[23:33:32] dc4: has joined #RubyOnRails
[23:34:24] Radar: Darmani: So on that line of code I linked
[23:34:36] Radar: Darmani: Do you see that you're going throguh each shirt and displaying a list of images?
[23:34:57] Darmani: I didn't know I was doing that.
[23:35:05] Radar: https://github.com/mfifth/T-Shirt-Store/blob/master/app/views/shirts/index.html.erb#L21
[23:35:09] Radar: That is what this line is doing
[23:35:21] Radar: If you remove the each block entirely (from the .each to the "end") then you'll only have one row of iamges
[23:35:42] jenrzzz: has joined #RubyOnRails
[23:35:42] jenrzzz: has joined #RubyOnRails
[23:35:50] dannyh: Radar: got it :-)
[23:35:53] dannyh: did that work?
[23:36:03] Darmani: Radar: I deleted it. Thanks for pointing that out.
[23:36:27] Radar: Danny_: it sure did
[23:38:13] DoctorMonocular: has joined #RubyOnRails
[23:39:49] Darmani: Radar: I'm curious, why would that block of code do that in the first place? That wasn't even my intention.
[23:39:59] pontiki: Darmani: i strongly suggest working through railstutorial, free online
[23:40:32] dannyh: Radar: one quick question: validates: in a model, you can pass it a function. what parameters does that function receive? more importantly, does it receive the name of the controller action? (e.g. what you'd get when using the :on conditional on the validates:)
[23:40:44] Rodya_: has joined #RubyOnRails
[23:41:14] Darmani: pontiki: I'll take a look at that.
[23:43:31] Cache_Money: has joined #RubyOnRails
[23:44:28] Radar: Danny_: what
[23:44:36] Radar: Danny_: no it doesn't receive anything more than what you pass it
[23:45:03] pragmatism: has joined #RubyOnRails
[23:45:05] dannyh: i have a validate: :some_method in my model
[23:45:19] dannyh: im trying to figure out, in that method, what the name of the action from the controller is
[23:45:25] xall: has joined #RubyOnRails
[23:45:35] Radar: you can't
[23:49:31] nettoweb: has joined #RubyOnRails
[23:49:47] hahuang61: has joined #RubyOnRails
[23:50:20] Radar: Danny_: why do you want to do that anyway?
[23:50:44] blackmesa: has joined #RubyOnRails
[23:51:13] dannyh: there are error messages for the validations, and it says, for example, "{object type} name has to be unique"
[23:51:38] dannyh: and i added in the actual name of the object, which is really only useful in certain situations
[23:51:58] dannyh: the main developer is insisting that i find a way to customize the validations so that the name is interpolated only for certain actions
[23:52:13] gusrub: has joined #RubyOnRails
[23:52:44] desnudopenguino: that sounds kind of annoying
[23:53:13] lupine: TBH AR validations are kind of useless
[23:53:47] desnudopenguino: you CAN set the message for the validation in the model
[23:53:58] lupine: sure, it doesn't make them useful
[23:54:40] lupine: your different actions could rescue unique key constraint violation exceptions and give the appropriate output for each behaviour though
[23:55:05] dannyh: the messages are already in the model
[23:55:35] lupine: but you're missing the controller context on whether message A or B should be shown
[23:55:43] lupine: and you're always vulnerable to magic races
[23:55:55] dannyh: moving the messages out of the model is not an option (aka the main dev wouldn't want that)
[23:56:00] lupine: you could have an instance variable that the controller sets to say whether to reveal the magic information or not
[23:56:05] lupine: TBH I don't like that
[23:56:38] lupine: another option is to have the most-explicit messages in the model and then have a censor that wraps the model instance and sanitises the interpolated messages
[23:56:47] lupine: that's a touch risky
[23:56:54] quazimodo: has joined #RubyOnRails
[23:57:12] lupine: or you could ask lead dev to show you what they'd do in a particular instance and replicate that
[23:57:55] lupine: a final option might be to separate out the different validators into modules by desired behaviour, and apply them in the controller per-instance
[23:58:06] lupine: that's really nasty
[23:59:10] jenrzzz: has joined #RubyOnRails
[23:59:52] djbkd: has joined #RubyOnRails