« Back to channel list

#RubyOnRails - 10 November 2015

« Back 1 day Forward 1 day »
[00:00:03] slash_nick: computed_attributes(@foo.attributes) #=> { foo_name: "fooo", other_attr_a: "barrrr", other_attr_b: "bazzzz" }
[00:00:24] Pazician: has joined #RubyOnRails
[00:00:31] wldcordeiro: has joined #RubyOnRails
[00:01:37] djbkd: has joined #RubyOnRails
[00:02:41] atomical: has joined #RubyOnRails
[00:02:50] finnergizer: has joined #RubyOnRails
[00:04:16] yfeldblum: has joined #RubyOnRails
[00:06:05] ja: Radar: Just a moment??? (Or several)
[00:06:08] ja: slash_nick: wut?
[00:06:28] Radar: ja: np. I've got stuff here to entertain myself in the mean time.
[00:07:14] slash_nick: ja, i was saying, "write a method that takes @some_obj.attributes, appends some key/value pairs, then returns the modified hash"
[00:07:25] darrencauthon: has joined #RubyOnRails
[00:07:38] EminenceHC: has joined #RubyOnRails
[00:08:16] simkessy: has joined #RubyOnRails
[00:08:31] Trynemjoel: has joined #RubyOnRails
[00:10:18] ja: slash_nick: Oooh, that might be an excellent fit, actually. THanks!
[00:11:58] rakm: i'm trying to write a test for a gem that adds a method to all controllers that inherit from ActionController::Base. looking around for how to write tests for this gem and can't find anything that doesn't seem outdated. how do I load a rails environment for an integration style test?
[00:12:18] Axsuul: has joined #RubyOnRails
[00:12:53] Axsuul: How would you guys go about adding associations to new records.. as in, when creating a new post, adding media, where each media is a model
[00:13:03] Axsuul: Store the media ids in a session? or
[00:13:14] infamos: has joined #RubyOnRails
[00:14:03] slash_nick: axsuul: i'm not really sure what you're asking... but...something like `p = Post.new; p.media = Media.new; p.save` would do, no?
[00:14:31] alex88_: has joined #RubyOnRails
[00:14:43] hardtail: has joined #RubyOnRails
[00:15:22] Axsuul: Ah no, was asking on a higher level feature scope.. for exmaple, when goign to a page to create a new post, the model hasn't been created yet, but we want to upload some media (which is a model). However we can't associate the media to the post because the post hasn't been created yet
[00:16:03] MrPunkin: has joined #RubyOnRails
[00:17:05] pixelhandler: has joined #RubyOnRails
[00:17:07] Axsuul: Hope that makes sense.. my strategy is
[00:17:50] slash_nick: axsuul: have you seen file_field? combine that with accepts_nested_attributes_for ... ?
[00:17:59] MrPunkin: Is there a way I can utilize Kernal#Array when I want to ensure an array but where the two options are either an array of hashes (already an array) or a single hash? Right now it converts the hash using Hash#to_array instead of wrapping the hash in an array. My current method is [arrayorhashobject].flatten because of this limitation.
[00:18:37] Radar: MrPunkin: !rule0
[00:18:37] helpa: MrPunkin: 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.
[00:18:59] Radar: MrPunkin: You probably want Array.wrap, but hard to tell without inputs + expected output examples.
[00:20:48] kies: has joined #RubyOnRails
[00:21:42] alex88: has joined #RubyOnRails
[00:22:18] MrPunkin: Radar: https://gist.github.com/mrpunkin/460ea7423ace18aeb3d9
[00:23:01] MrPunkin: Array.wrap does indeed look like what I need here.
[00:23:55] djbkd: has joined #RubyOnRails
[00:24:33] centrx: has joined #RubyOnRails
[00:25:13] TPBallbag: has joined #RubyOnRails
[00:29:03] atomical: has joined #RubyOnRails
[00:29:19] simkessy: Hi, looking for some help with my scope. I have a model with a through association and I need to return records based on a column from the through association.
[00:29:31] simkessy: I've tried this: scope :after_notice_time, -> {where{start_time >= (Time.zone.now + facility.venue_id.hours)}}
[00:30:13] simkessy: Sorry: {where{start_time >= (Time.zone.now + facility.venue_notice_time.hours)}
[00:32:22] flashpoint9: has joined #RubyOnRails
[00:34:09] pixelhandler: has joined #RubyOnRails
[00:34:29] simkessy: I added details here: http://stackoverflow.com/questions/33617177/referencing-self-and-through-association-in-scopes
[00:34:45] Radar: simkessy: Time.current is the shorter version of Time.zone.now btw.
[00:34:50] djbkd: has joined #RubyOnRails
[00:35:02] Radar: facility.venue_id.hours.from_now will also get you the same result.
[00:35:11] Radar: where("start_time >= ?", facility.venue_id.hours.from_now)
[00:36:23] sevenseacat: has joined #RubyOnRails
[00:37:08] recurrence: has joined #RubyOnRails
[00:38:46] podman: has joined #RubyOnRails
[00:39:42] EminenceHC: has joined #RubyOnRails
[00:42:25] exadeci: has joined #RubyOnRails
[00:43:34] goodcodeguy: has joined #RubyOnRails
[00:45:19] simkessy: yea you're right the hours.from_now is a great way to clean up it. I think however, the issue I have is actually getting the associated venue in the scope
[00:46:31] simkessy: I've changed it to this: scope :after_notice_time, -> {where{start_time >= (venue.notice_time.hours.from_now)}}
[00:48:16] simkessy: the "venue" is coming from "has_one :venue, through: :facility" but I'm not sure if I can access that through association in the scope
[00:50:32] djbkd: has joined #RubyOnRails
[00:51:17] Pazician: has joined #RubyOnRails
[00:52:06] smathy: simkessy, a scope just replaces the method you're calling with the stuff in the lambda.
[00:52:39] smathy: simkessy, would: `Availability.where( start_time >= (venue.notice_time.hours.from_now) )` work?
[00:53:48] djbkd: has joined #RubyOnRails
[00:54:29] shibabu: has joined #RubyOnRails
[00:54:41] simkessy: I had to change it to :start_time and I got an error: NameError: undefined local variable or method `venue' for main:Object
[00:54:42] shock_one: has joined #RubyOnRails
[00:55:08] fre: has joined #RubyOnRails
[00:55:23] Palsson: has joined #RubyOnRails
[00:55:44] stannard: has joined #RubyOnRails
[00:55:51] sarink: has joined #RubyOnRails
[00:56:02] smathy: simkessy, right, because that's basically being called on the implicit self which in this case is your Availability class (class, not instance).
[00:56:43] owenjones: has joined #RubyOnRails
[00:56:51] smathy: simkessy, so, at a class level, how do you create an AR query that joins with an associated set of data?
[00:57:12] gavit: I wonder why I dont see any apps who have i18n that have chinese in pingyin and in chinese chars
[00:57:18] gavit: all I see is in chinese chars
[00:57:47] simkessy: smathy: Is this what you mean? https://gist.github.com/simkessy/2372fae76588180c756b
[00:58:48] baweaver: has joined #RubyOnRails
[00:58:51] nya: has joined #RubyOnRails
[01:01:27] annlewis: has joined #RubyOnRails
[01:05:03] rgtk: has joined #RubyOnRails
[01:06:29] codeurge: has joined #RubyOnRails
[01:07:03] bruno-: has joined #RubyOnRails
[01:07:48] CodingWolf: has joined #RubyOnRails
[01:08:13] smathy: simkessy, not sure what I'm looking at, you put facility in front of venue?
[01:08:34] smathy: simkessy, so is Availability.facility a valid method call?
[01:09:00] rgtk: has joined #RubyOnRails
[01:10:10] simkessy: smathy: Availability has as belongs_to association with Facility but that'd need to be an instance like Availability.first.facility
[01:10:28] simkessy: I can also do Availability.first.venue because I have a "has_one :venue, through: :facility"
[01:10:43] smathy: simkessy, right, so no - you can't call that/those on the class.
[01:11:15] smathy: simkessy, you seem to be swimming in the dark here, so take a read of this: http://guides.rubyonrails.org/active_record_querying.html#joining-tables (and read the rest of that guide while you're there)
[01:11:24] alex88: has joined #RubyOnRails
[01:11:43] smathy: simkessy, using associations to create join queries is something you use all the time, you need to be familiar with it.
[01:13:16] DiCablo: has joined #RubyOnRails
[01:14:31] hahuang65: has joined #RubyOnRails
[01:14:55] kp666_: has joined #RubyOnRails
[01:16:25] simkessy: smathy: ill look though it and see if i can find anything to help me out but I'm already using joins and that hasn't helped
[01:17:25] rgtk: has joined #RubyOnRails
[01:17:26] pkrnj: has joined #RubyOnRails
[01:18:39] smathy: simkessy, nothing you've shown me is using joins (in the scope you're asking about).
[01:19:00] jobewan: has joined #RubyOnRails
[01:19:48] simkessy: smathy: sorry probably had too much stuff here https://gist.github.com/simkessy/2372fae76588180c756b the search methods first call is to a join scope
[01:21:29] ellisTAA: has joined #RubyOnRails
[01:23:35] dikaio_: has joined #RubyOnRails
[01:23:39] rgtk: has joined #RubyOnRails
[01:25:14] ellisTAA: would anyone be able to give me a code review?
[01:26:02] smathy: simkessy, ok, so first I would make each scope valid on its own, it's silly to have a scope that depends on another one to be called before it. And second, that definitely would work if this was regular AR, maybe Squeel needs the scope itself to be valid.
[01:26:05] SteenJobs: has joined #RubyOnRails
[01:26:38] smathy: ...I don't know when that block gets called, maybe it's called too soon, which in AR isn't a problem because they're only symbols until the actual SQL needs to be run.
[01:27:09] simkessy: smathy: I see what you're saying regarding the joins, I'll change that so each scope will include it
[01:28:01] broman: has joined #RubyOnRails
[01:29:26] broman: can someone please help me?? I created a scaffold for cliente.. I'm now trying to include the search so I've included in the route.rb get "clients/search", :action=>:search, :as => :search_clients .... but when i try to access the page /clients/search, it takes me to the show method of the controller... what am i doing wrong?
[01:30:29] SamGerber: has joined #RubyOnRails
[01:30:35] Sam_Gerber: has joined #RubyOnRails
[01:30:54] ellisTAA: broman: put it above the search route maybe
[01:31:19] jim1138: has joined #RubyOnRails
[01:32:01] rgtk: has joined #RubyOnRails
[01:32:06] one_zero: has joined #RubyOnRails
[01:32:12] smathy: broman, that can't be your full route, you don't define a controller.
[01:32:13] broman: EllisTAA, it worked :)
[01:32:19] ellisTAA: !!! yeah i helped someone
[01:32:31] broman: smathy, it was just above.. thank you
[01:33:00] ellisTAA: recurrence: :)
[01:33:02] broman: now.. i have a render 'form'.. how can i change the button text? its one for create, one for update and now one for search
[01:33:43] ellisTAA: broman: what???s a render form?
[01:34:08] ellisTAA: .submit ???text you want??? %> ??? i think
[01:34:31] broman: <%= render 'form' %> ...
[01:34:39] llimllib: has joined #RubyOnRails
[01:35:19] broman: how does the scaffold does that??
[01:35:40] broman: on the new i got the "create" text and on update "update"... now i want to make it display "search"
[01:35:53] broman: forget about.. just got an idea :)
[01:35:54] llimllib: rails asset:precompile seems to be ignoring the RAILS_RELATIVE_ROOT_URL. Anybody know how to work around this? https://gist.githubusercontent.com/llimllib/0f511744455e5ce21afd/raw/e86580c4806253914eb8ae8a16a93a31113df8a0/bug.sh
[01:35:57] simkessy: smathy, when you say "That definitely would work", what are you referring to specifically?
[01:36:19] llimllib: I found a couple relevant issues, but nothing with a solution AFAICT
[01:36:31] llimllib: any and all suggestions welcome
[01:36:55] slash_ni1k: has joined #RubyOnRails
[01:37:02] smathy: simkessy, making a scope :join, -> { joins(:an_association) } and another scope :dependent, -> { where( "an_associations.field >= ?", something ) } and then calling: YourClass.join.dependent
[01:37:43] smathy: ...because Rails doesn't care what that string in your `where` clause is until it actually goes to execute the SQL.
[01:37:53] smathy: ...which is the part I'm not sure about with squeel
[01:38:07] veg: has joined #RubyOnRails
[01:38:15] rgtk: has joined #RubyOnRails
[01:38:35] simkessy: smathy, I understood that as the part you said was silly, so I changed the 'dependent' to include a join
[01:38:39] pydave6367: has joined #RubyOnRails
[01:38:43] smathy: ...because in your where block you have method calls, I'm not sure how squeel performs the magic to bind them back to the query's scope (not the named scope), or when that happens, etc.
[01:39:08] smathy: simkessy, right, I think that's the best way regardless of whether you're using AR or Squeel.
[01:39:18] smathy: simkessy, all your scopes should be self-contained.
[01:39:20] simkessy: Yea it makes perfect sense
[01:39:39] llimllib: specifically, this issue seems relevant: https://github.com/rails/rails/issues/5122
[01:39:54] yfeldblum: has joined #RubyOnRails
[01:41:48] mordocai: has joined #RubyOnRails
[01:42:17] llimllib: here's a simpler way to spell the same bug: https://gist.githubusercontent.com/llimllib/0f511744455e5ce21afd/raw/d1aa6b28f529628b0f2f36a633b2f363f783b2ba/alt.sh
[01:43:00] llimllib: skills_translator_suggest_path ought to be /subdir/skills-translator/suggest, not /skills-translator/suggest
[01:43:47] alex88: has joined #RubyOnRails
[01:44:54] bruno-_: has joined #RubyOnRails
[01:48:42] rgtk: has joined #RubyOnRails
[01:50:33] Sam_Gerber: has joined #RubyOnRails
[01:52:57] bricker: has joined #RubyOnRails
[01:53:35] Rinzlit: has joined #RubyOnRails
[01:54:44] rgtk: has joined #RubyOnRails
[01:58:47] rgtk: has joined #RubyOnRails
[01:58:47] llimllib: sooo... nobody with any ideas on the relative_url_root thing?
[01:58:56] llimllib: because it's really throwing a spanner in the works over here
[01:59:28] nogic: has joined #RubyOnRails
[01:59:51] baweaver: has joined #RubyOnRails
[02:00:00] Rinzlit: has joined #RubyOnRails
[02:00:15] rakm: has joined #RubyOnRails
[02:01:26] sevenseacat: llimllib: in your console, what is ActionDispatch::Routing::RouteSet.relative_url_root equal to
[02:01:49] sevenseacat: https://github.com/rails/rails/pull/18775/files implies its fixed
[02:02:13] annlewis: has joined #RubyOnRails
[02:03:17] ascarter: has joined #RubyOnRails
[02:03:34] infamos: has joined #RubyOnRails
[02:03:56] llimllib: saw that, but there's a person in the issue saying it's still busted in 4.2.4 (I'm currently at 4.2.3)
[02:04:07] jobewan: has joined #RubyOnRails
[02:04:20] llimllib: can I check what release that pull is in?
[02:04:33] SteenJobs: has joined #RubyOnRails
[02:04:58] rgtk: has joined #RubyOnRails
[02:05:35] notnoyyyyy: has joined #RubyOnRails
[02:05:58] llimllib: 4.2.3 was release on Jun 25, 4 months after that patch landed
[02:06:57] flip_digits: has joined #RubyOnRails
[02:07:16] llimllib: confirmed that that bug should have been fixed in 4.2.3: https://github.com/rails/rails/blob/v4.2.5.rc2/actionpack/CHANGELOG.md#rails-423-june-25-2015
[02:07:53] gmond071: has joined #RubyOnRails
[02:08:43] sevenseacat: https://github.com/rails/rails/commit/0703453fabc4a47411c2f9df291acfdfbcaf5ae4 is in 4.2.5 and 4.2.stable
[02:09:01] northfurr: has joined #RubyOnRails
[02:09:03] rgtk_: has joined #RubyOnRails
[02:09:49] sevenseacat: I think the changelog is messed up there
[02:10:01] sevenseacat: and that you should try upgrading to 4.2.5.rc3
[02:10:11] llimllib: thanks, will give it a shot
[02:10:19] paradisaeidae: has joined #RubyOnRails
[02:11:41] darrencauthon: has joined #RubyOnRails
[02:12:24] RegulationD: has joined #RubyOnRails
[02:13:10] rgtk: has joined #RubyOnRails
[02:13:52] upsell5: has joined #RubyOnRails
[02:15:26] ur5us: has joined #RubyOnRails
[02:15:56] pkrnj: has joined #RubyOnRails
[02:16:04] llimllib: I can't install rails 4.2.5.rc2 in my app because of dependencies, but trying it outside :(
[02:16:55] DLSteve: has joined #RubyOnRails
[02:19:23] rgtk: has joined #RubyOnRails
[02:20:10] ur5us: has joined #RubyOnRails
[02:20:32] atomical_: has joined #RubyOnRails
[02:23:04] nogic: has joined #RubyOnRails
[02:24:02] rclanan: has joined #RubyOnRails
[02:25:14] EminenceHC: has joined #RubyOnRails
[02:27:07] baweaver: has joined #RubyOnRails
[02:27:43] rgtk: has joined #RubyOnRails
[02:29:00] jobewan: has joined #RubyOnRails
[02:30:59] broman: I made a file upload and it copies the file to the public/uploads file... how can i <img src="/public/uploads/name.jpg"> ??
[02:31:07] jessemcgilallen: has joined #RubyOnRails
[02:31:14] sevenseacat: remove the /public
[02:31:31] sevenseacat: just img src="/uploads/whatever.png"
[02:32:25] Aeyrix: Fuck why did I use Devise for this project
[02:32:49] Ropeney: Aeyrix: because reasons!
[02:32:55] Aeyrix: Absolutely disgusting.
[02:32:58] Aeyrix: Now I have to rip it out of my app.
[02:33:20] Aeyrix: Could not find generator 'devise:uninstall'. Maybe you meant 'devise:install', 'devise:views' or 'rspec:install'
[02:33:35] tubbo: Aeyrix: `rails destroy devise:install`
[02:33:43] Aeyrix: just fuck me up
[02:33:53] Aeyrix: that worked a charm
[02:33:54] Aeyrix: thanks tubbo!
[02:33:57] tubbo: no problem
[02:34:04] tubbo: works for anything you can `rails generate`.
[02:34:09] llimllib: sevenseacat: doesn't seem to work on 4.2.5rc2 either https://gist.githubusercontent.com/llimllib/0f511744455e5ce21afd/raw/1ddd585ea97bb30d11ed760cdc081603a40722ce/fails_on_4.2.5.rc2.sh
[02:34:20] llimllib: (yeesh it takes forever to install rails!)
[02:35:56] sevenseacat: oh that commit isnt listed as being in the 4.2.5.rc2 tag :/
[02:35:56] shibabu: has joined #RubyOnRails
[02:37:49] sevenseacat: I'm confused.
[02:38:24] rgtk: has joined #RubyOnRails
[02:38:42] DiCablo: has joined #RubyOnRails
[02:39:01] llimllib: we could start a club
[02:39:49] northfurr: has joined #RubyOnRails
[02:40:09] sevenseacat: I'd stick a comment in https://github.com/rails/rails/issues/5122 with your example
[02:41:45] broman: sevenseacat, thanks a lot!
[02:41:46] matthewd: That commit is in 4.2.5.rc2
[02:41:50] gambl0re: has joined #RubyOnRails
[02:41:56] sevenseacat: matthewd: yeah I saw
[02:42:06] matthewd: Sounds like https://github.com/rails/rails/pull/21804 may be relevant?
[02:42:09] sevenseacat: normally github would list that in the header for the commit, the tags that its part of
[02:44:30] rgtk: has joined #RubyOnRails
[02:45:03] flip_digits: Does anyone know of a good article on testing sunspot/solr in a rails app?
[02:45:49] safety_cut: has joined #RubyOnRails
[02:46:18] rickmasta: has joined #RubyOnRails
[02:48:05] drbayer: has joined #RubyOnRails
[02:48:31] rgtk: has joined #RubyOnRails
[02:48:32] scmx: has joined #RubyOnRails
[02:49:17] paradisaeidae: has joined #RubyOnRails
[02:50:39] vigintas: has joined #RubyOnRails
[02:51:53] koprom: has joined #RubyOnRails
[02:52:02] Pazician: has joined #RubyOnRails
[02:52:42] bruno-: has joined #RubyOnRails
[02:55:41] goodcodeguy: has joined #RubyOnRails
[02:58:56] rgtk: has joined #RubyOnRails
[03:02:57] rgtk: has joined #RubyOnRails
[03:02:59] annlewis: has joined #RubyOnRails
[03:07:02] rgtk: has joined #RubyOnRails
[03:09:21] ur5us_: has joined #RubyOnRails
[03:10:00] maxz: has joined #RubyOnRails
[03:10:01] edj: has joined #RubyOnRails
[03:10:11] edj: radar: are you here?
[03:10:17] Radar: edj: yes, but not on weekends.
[03:10:19] Radar: As you found out.
[03:10:27] Radar: edj: More than me can answer your questions three.
[03:10:38] edj: radar: lol yea
[03:12:01] theblang: has joined #RubyOnRails
[03:12:28] edj: radar: should I go through courses multiple times until i master them or just keep going?
[03:12:39] weaksauce: Radar is like a comfortable blanket of rails knowledge
[03:12:50] ur5us: has joined #RubyOnRails
[03:12:58] Radar: edj: Running around an oval does not give you an idea of the suburb.
[03:14:05] edj: radar: So just keep going?
[03:14:31] Radar: edj: If you keep running around an oval, will you know anything more about your suburb?
[03:15:14] edj: radar: I'll know more about certain parts of it, but overall i guess not.
[03:15:20] rgtk: has joined #RubyOnRails
[03:15:25] Radar: edj: which tutorials have you done?
[03:15:43] edj: codeacademy ruby and im working on rubymonk
[03:15:54] mary5030: has joined #RubyOnRails
[03:17:13] edj: I really like ruby monk, it seems to cover a lot of information
[03:17:14] recurrence: has joined #RubyOnRails
[03:17:41] ur5us: has joined #RubyOnRails
[03:18:57] erbse: has joined #RubyOnRails
[03:19:24] rgtk: has joined #RubyOnRails
[03:21:15] weaksauce: edj what do you plan to use rails for?
[03:21:34] woods: has joined #RubyOnRails
[03:21:50] edj: weaksauce: I want to use rubymotion to make an app
[03:22:02] DanielN: has joined #RubyOnRails
[03:22:39] hardtail: edj have you started learning Rails?
[03:22:47] edj: weaksauce: it makes ruby code cross platform
[03:23:10] edj: hardtail: not yet I'm trying to learn all the ruby ill need first.
[03:23:13] weaksauce: I have used it before edj. just curious why you are in a rails channel for that :)
[03:23:36] woods: has left #RubyOnRails: ()
[03:23:40] djbkd: has joined #RubyOnRails
[03:23:44] weaksauce: ruby might be a better place to learn pure ruby. rubymotion is pretty slow but they could answer some questions about that
[03:23:46] edj: weaksauce: don't i need rails to use it?
[03:23:57] kp666: has joined #RubyOnRails
[03:23:59] hardtail: RubyMonk is great
[03:24:11] edj: hardtail: awesome!
[03:24:37] edj: weaksauce: well I'm about to sound like a total noob... but what exactly is rails for...
[03:24:49] weaksauce: edj rubymotion is a subset of ruby that interfaces with ios and osx and android
[03:25:13] weaksauce: rails is a web framework for websites that have database backends typically
[03:25:14] edj: wealsauce: so i could make an app using location using that right?
[03:25:42] edj: weaksauce: rubymotion
[03:25:45] Radar: edj: http://logs.ryanbigg.com/RubyOnRails?date=2015-11-04#4478694
[03:25:48] weaksauce: phone app or webapp?
[03:25:49] Radar: edj: Do you have an answer for me now?
[03:26:07] hahuang65: has joined #RubyOnRails
[03:26:37] edj: radar: a hash
[03:26:51] edj: weaksauce: phone i guess
[03:26:59] weaksauce: edj yes you can
[03:27:00] Radar: edj: you learned!
[03:27:07] tds5016: has joined #RubyOnRails
[03:27:12] edj: radar: I have!
[03:27:16] darrencauthon: has joined #RubyOnRails
[03:27:25] Radar: edj: Have you tried building a Rails app yet?
[03:27:39] edj: weaksauce: it needs to track current location and have users
[03:27:40] Ropeney: Radar: how long do you log for?
[03:27:45] Radar: Ropeney: All time.
[03:27:47] tds5016: hi all. Question; is it possible to create a reference to a persisted model WITHOUT querying for the model?
[03:27:50] rgtk: has joined #RubyOnRails
[03:28:09] tds5016: like I have another way to get the data, and what Iwant to do is create a reference to that data one the server without re-querying for it.
[03:28:39] weaksauce: tds5016 does that data involve an id?
[03:28:40] edj: radar: not yet, I'm sort of scared to I feel like i might need to finish up codemonk then try michael hartls tutorial or maybe rails for zombies first then the rails tutorial.
[03:28:50] tds5016: weaksauce: sure does!
[03:28:51] Radar: Ok, that sounds fine.
[03:29:04] Radar: edj: Do you have a GitHub account yet? I have a book I'd like you to read once you finish Codemonk.
[03:29:07] nogic: has joined #RubyOnRails
[03:29:14] weaksauce: I don't see why you couldn't just build up a model with all that data then
[03:29:17] tds5016: if I do Model.new and then save though it creates a new version of the model.
[03:29:18] edj: radar: yea i do
[03:29:26] tds5016: how would I build that model?
[03:29:34] tds5016: What I was doing was new.
[03:29:38] tds5016: and that is writing a new one.
[03:30:04] weaksauce: have you tried Model.new and then setting the id specifically?
[03:30:35] weaksauce: and then perhaps using update if save still wants to make a new model
[03:30:40] tds5016: not after the model.new.
[03:30:47] tds5016: I've only created with passing an id
[03:31:00] weaksauce: I haven't tried that but it could work
[03:32:57] tds5016: is there a way to set it to persisted instead of new?
[03:32:59] dionysus69: has joined #RubyOnRails
[03:33:11] SteenJobs: has joined #RubyOnRails
[03:33:59] tds5016: errr... maybe that's what's doing it./
[03:35:14] dionysus69: ruby symbol is same as pointer or there is some difference?
[03:35:55] SteenJobs: has joined #RubyOnRails
[03:36:41] DLSteve: has joined #RubyOnRails
[03:37:27] sankaber: has joined #RubyOnRails
[03:39:39] erbse: it's a shared char array, although python already did that for normal string
[03:43:03] ellisTAA: has joined #RubyOnRails
[03:43:46] ellisTAA: has left #RubyOnRails: ()
[03:46:47] EvilEpoch: has joined #RubyOnRails
[03:47:13] ur5us_: has joined #RubyOnRails
[03:47:47] EvilEpoch: Warm Greetings to all, I am The EvilEpoch.
[03:48:23] pydave6367: has joined #RubyOnRails
[03:48:28] sevenseacat: good morning to the EvilEpoch
[03:48:28] Radar: edj: what is your GH account username?
[03:48:38] Radar: Good morning to the EvilEpoch.
[03:48:43] wildlander: has joined #RubyOnRails
[03:48:53] EvilEpoch: Greetings to sevenseacat from The EvilEpoch.
[03:48:59] EvilEpoch: Greetings to Radar from The EvilEpoch.
[03:50:20] edj: radar:edj979
[03:51:08] Radar: edj: check your email
[03:51:14] Radar: edj: It's Rails 4 in Action, a book that sevenseacat and I wrote.
[03:51:24] vigintas: has joined #RubyOnRails
[03:51:32] Radar: If you like it then please do buy a copy from Amazon or from Manning's own site (https://www.manning.com/books/rails-4-in-action)
[03:51:38] Radar: Amazon will be cheaper, of course.
[03:52:34] sevenseacat: wow, it's like $12 cheaper.
[03:52:58] Radar: The Power of Amazon
[03:53:03] hardtail: edj from one beginner to another, I will tell you it is by far the best publication on this subject that I have ever read
[03:53:23] hardtail: PLUS you get to speak to the authors! how cool is that?
[03:53:46] edj: radar: thanks I'll probably get it with my next check
[03:54:43] bruno-: has joined #RubyOnRails
[03:54:46] sevenseacat: ACTION gets all the warm and fuzzies
[03:54:54] SteenJobs: has joined #RubyOnRails
[03:55:06] sevenseacat: ps. the abuse of the word 'awesome' in the book was all me. it's my favorite word.
[03:56:02] Rinzlit1: has joined #RubyOnRails
[03:56:04] Radar: The abuse of "now" was all me
[03:56:06] Radar: and commas
[03:56:08] Radar: so many commas
[03:59:54] Rinzlit: has joined #RubyOnRails
[04:00:40] leonardoajim: has joined #RubyOnRails
[04:00:55] x-light: has joined #RubyOnRails
[04:01:01] EminenceHC: has joined #RubyOnRails
[04:01:06] Aeyrix: 2:53 PM <Hardtail> PLUS you get to speak to the authors! how cool is that?
[04:01:09] Aeyrix: By appointment only fwiw.
[04:01:15] leonardoajim: has joined #RubyOnRails
[04:01:22] Aeyrix: $225/hr IIRC, minimum 2hr appointments.
[04:01:22] acti0nman: has joined #RubyOnRails
[04:01:39] dionysus69: awesome didn't even know you had written book :) will there be a rails 5 revision ?
[04:02:31] sevenseacat: if there is, it won't be written by us.
[04:02:51] railsknight: has joined #RubyOnRails
[04:02:59] dionysus69: may I ask why ? :s
[04:03:20] sevenseacat: because the publisher is a pain in the ass.
[04:03:22] Rinzlit1: has joined #RubyOnRails
[04:03:45] annlewis: has joined #RubyOnRails
[04:04:34] TPBallbag: has joined #RubyOnRails
[04:04:59] dionysus69: oh I see, anyways whatever kind of teaching material you will create instead (if you will), will be curious to look at :D
[04:06:41] safety_cut: has joined #RubyOnRails
[04:07:09] Aeyrix: dionysus69: I hear there's an interpretive dance version of what would be Rails 5 in Action.
[04:07:20] Aeyrix: It's not ready yet, but the team behind the current Lion King stage play are working on it.
[04:07:36] Aeyrix: I don't know much but I saw a sneak preview of Act 3: "Why the fuck is Turbolinks still a thing"
[04:07:44] matthewd: Which version does the book cover? 4.1ish?
[04:07:46] Aeyrix: Act 6: "Fuck Spring" is a pretty good one too
[04:08:14] safety_c_: has joined #RubyOnRails
[04:08:25] sevenseacat: ruby 2.2. (2.1.6 for windows)
[04:08:50] sevenseacat: whatever versions were current when I was doing the proofing in the first week of April.
[04:09:20] sevenseacat: one of the things I wish we'd had time and space to include
[04:09:54] braincrash: has joined #RubyOnRails
[04:10:08] upsell5: has joined #RubyOnRails
[04:10:16] blackhuey: has joined #RubyOnRails
[04:11:14] creature: has joined #RubyOnRails
[04:12:17] paradisaeidae: has joined #RubyOnRails
[04:12:21] Radar: TL;DR: Use Sidekiq instead.
[04:12:26] ur5us_: has joined #RubyOnRails
[04:12:34] Radar: Dunno why you'd invest in using ActiveJob when it's typically easy enough to convert between queuing libraries.
[04:12:39] Radar: And Sidekiq is king now
[04:13:05] tubbo: activejob rules
[04:13:19] creature: So, let's say I have two very similar items. Books, for instance. If I use `resources :paperbacks, controller: "books"; resources :ebooks, controller: "books"` in my routes.rb then both /paperbacks/123 and /ebooks/456 will be handled by my BooksController. But what's the best way for my controller to detect which way it was invoked?
[04:13:22] sevenseacat: i'm not sure its a case of 'investing' in activejob
[04:13:37] sevenseacat: it should be straighforward to replace your queueing calls with AJ-compatible ones
[04:14:22] matthewd: Personally, I'd say if you're "investing" == "actually need to use multiple features of your queueing system", yeah, go ahead and use sidekiq directly
[04:14:22] sevenseacat: but it is yet another layer of abstraction, in case rails didnt have enough of them
[04:15:05] matthewd: If you just want to say "do this somewhere else plz", then AJ seems a pleasant way to make that problem just go away
[04:15:33] tubbo: creature: why the separation? aren't they both just formats of a single book?
[04:16:40] creature: tubbo: My system isn't actually doing stuff with books; books are an easier-to-explain stand-in for the actual thing I'm building.
[04:17:06] creature: tubbo: But, the crux of it is, the data's very similar but the behaviour isn't. Ebook#deliver_to_customer is going to be very different to Paperback#deliver_to_customer, for instance.
[04:17:22] tubbo: creature: so why are you using the same controller for both?
[04:17:25] sevenseacat: why does that make a difference to the controller?
[04:17:33] sevenseacat: isnt the controller just calling @book.deliver_to_customer ?
[04:18:09] creature: sevenseacat: It needs to know whether to instantiate an instance of Ebook or Paperback.
[04:18:44] creature: Both /paperbacks/123 and /ebooks/456 are going to invoke BooksController#show, and set params[:id] to 123 or 456 respectively.
[04:18:52] sevenseacat: mmmm no it doesnt, your STI should cover that
[04:19:16] sevenseacat: oh or are you not using STI
[04:19:39] tubbo: creature: i highly suggest that if you have multiple models and multiple endpoints, you should have multiple controllers.
[04:20:06] creature: I'm not. I _do_ have an abstract Book class.
[04:20:47] creature: tubbo: Well, one of the appealing things about taking this tack was that right now, all of my controllers are going to be basically identical and I can avoid that duplication. And when I get to the stage that I want to split it out into its own controller, my routes won't change.
[04:21:12] tubbo: an "abstract Book class"
[04:21:24] tubbo: oh wait are you using that AbstractModel thing
[04:22:02] tubbo: err, abstract_class
[04:22:12] DLSteve: has joined #RubyOnRails
[04:22:36] creature: I just have `self.abstract_class = true` in my Book class. And then my Paperback and Ebook models are "class Paperback < Book".
[04:23:12] sevenseacat: so you are using STI
[04:23:16] tubbo: honestly i think the easiest thing would be to infer the model class name from the controller class name.
[04:23:30] sevenseacat: so you have a type field on the model that says what type of book it is, right?
[04:23:33] matthewd: sevenseacat: That's not STI
[04:23:37] tubbo: self.class.name.gsub(/Controller/, '').constantize :)
[04:24:18] sevenseacat: matthewd: unless there's more code, both of those models are being stored in the books table, so it kinda is
[04:24:24] matthewd: abstract_class means "don't use me for the table name; use the subclass name directly"
[04:24:38] tubbo: "If you are using inheritance with ActiveRecord and don't want child classes to utilize the implied STI table name of the parent class, this will need to be true."
[04:24:42] tubbo: http://api.rubyonrails.org/classes/ActiveRecord/Inheritance/ClassMethods.html#attribute-i-abstract_class
[04:24:46] northfurr: has joined #RubyOnRails
[04:25:01] creature: sevenseacat: No, I don't have a Type field. I've got a paperbacks table, and an ebooks table. While the data's similar, it's not the same.
[04:25:12] sevenseacat: yeah okay thats weird
[04:25:23] tubbo: it's basically another way of mixing code into multiple different models.
[04:25:35] tubbo: whereas most people use modules and include them, for example (or concerns)
[04:25:42] sevenseacat: composition over inheritance
[04:25:57] fedexo: has joined #RubyOnRails
[04:26:11] tubbo: this is either a relic from pre-Concern ActiveSupport, or it's a "DHH Special"
[04:26:17] matthewd: Yeah, the only time I've really seen it used is to share a (secondary) common DB connection between a set of models
[04:26:18] tubbo: in the sense that it's used in Basecamp
[04:26:34] tubbo: matthewd: that's actually not a bad use case
[04:26:52] matthewd: i.e., it's for when you want to do something in the vicinity of tweaking AR::Base, not so much for a more "concrete" abstract class
[04:27:04] tubbo: i can see someone doing that for importing legacy data using AR classes somehow
[04:27:06] creature: I'm aware I am in slightly weird waters, but I'm OK with that for now. This is just a personal side project I'm knocking around, I'm not commiting crimes against code yet.
[04:27:14] matthewd: (not to say it won't work here, of course)
[04:27:36] pontiki: if it's your own stuff, then do experiment
[04:27:55] creature: I feel like we're getting a little away from my original question. My models work fine; I'm very happy with them. I'm trying to do weird things with my controller. :)
[04:28:18] dmarr: trying to add an index to a binary column but its throwing this https://gist.github.com/08f90ac63ca4e814ef41
[04:28:56] matthewd: creature: I think you can set an extra (static) parameter in your route... I just don't remember exactly what you need to do, nor whether it works with resourceful routes
[04:28:57] pontiki: what i would avoid doing is creating a controller that's tied to an abstract class
[04:29:47] creature: I could just create a separate controller for all my various book types, but they're all going to be exactly the same CRUD logic for title, author, category, etc. Rather than create controllers that differ only by the model type they instantiate, right now I'd rather have one controller that picks up on its type.
[04:30:16] pontiki: so have a concern
[04:30:34] creature: pontiki: Well, right now the *only* difference is the model that it instantiates. But the routes are all type-specific. So when I do start hitting those trickier differences, it's super-easy to break that bit out into a dedicated type-specific controller.
[04:30:37] matthewd: creature: Abstract controller to match your abstract model? :D
[04:30:45] shock_one: has joined #RubyOnRails
[04:31:02] pontiki: and that's *exactly* the point; controllers map to routes, routes to controllers
[04:31:16] pontiki: keep your controller wafer thin
[04:31:40] matthewd: I'm actually not sure whether I'm joking about that... given the context, it might actually be the more reasonable choice
[04:32:21] creature: matthewd: It's more like a polymorphic controller. It's dealing with specific types, after all.
[04:32:48] matthewd: creature: I'm suggesting you create a BooksController and also an EbooksController < BooksController (then route the latter)
[04:32:49] pontiki: here's my suggestion: write it both ways, see which moves forward as you make changes giving you an easier maintenance and growth path
[04:33:57] creature: pontiki: Well, kind of the whole point here is that I don't know how to write it the first way. :) I don't know the best way to let my controller figure out if it was invoked via /paperbacks/123 or /ebooks/456.
[04:34:10] matthewd: If you want to do it with the route, I think maybe `resources :ebooks, controller: 'books', defaults: { book_type: 'ebook' }` might do a thing, perhaps?
[04:35:00] creature: matthewd: I guess I could do the inheritance route. I'd end up with a `def get_model; Paperback; end` in each controller, I guess?
[04:35:18] matthewd: But it really feels like you're setting yourself up for a fight against conventions every step of the way :/
[04:35:58] tubbo: don't fight the framework :)
[04:35:58] maxzda: has joined #RubyOnRails
[04:35:59] creature: I'm definitely not trying to fight against conventions.
[04:36:00] matthewd: What's your existing Rails experience/skill level?
[04:36:45] matthewd: Not wanting to draw huge conclusions from a tiny thing, but `get_` implies to me that it's not high enough to be going down a fight-the-power track
[04:37:01] creature: I would say "not bad", and that might be my British understatement.
[04:37:09] rickmasta: has joined #RubyOnRails
[04:37:32] creature: I only prefixed it with `get_` because I could imagine `model` being a reserved word, or otherwise likely to cause confusion.
[04:38:14] SteenJobs: has joined #RubyOnRails
[04:38:47] creature: Honestly, this isn't a case of me trying to fight the framework, it's me trying to avoid a whole bunch of duplicated code. The example with books has 2 very similar models in it; my real-world one has 4 or 5.
[04:39:12] creature: And having 5 identical-except-for-one-detail isn't very DRY.
[04:39:49] matthewd: It's not sounding like a terribly DRY DB schema either, though :|
[04:41:41] tubbo: creature: could you maybe store everything in one model and use something like hstore or jsonb to store the differentiating data?
[04:42:33] ngscheurich: has joined #RubyOnRails
[04:42:56] creature: matthewd: That's a fair comment. I'm choosing a simpler model over strict DRY in the DB.
[04:43:13] willardg: has joined #RubyOnRails
[04:43:18] creature: tubbo: I am highly allergic to storing data blobs in relational databases. And, sadly, some of the differentiating data is relational.
[04:43:35] matthewd: It sounds like AR's trying to push you into STI
[04:44:01] creature: And while I _could_ stick foreign keys into hstore or jsonb, that also seems gross.
[04:44:07] matthewd: Which leaves you with 4+ always-empty columns per row (depending on the type).. so obviously all trade-offs
[04:44:12] tubbo: creature: well, hstore is a bit more structured. it can be queried upon.
[04:44:42] tubbo: i don't really see the difference except that you can't index those foreign keys in the hstore
[04:46:32] matthewd: tubbo: You can't define a belongs_to on an hstore field?
[04:46:46] tubbo: no, but you could replicate it pretty easily
[04:47:15] tubbo: def my_belongs_to; SomeAssociatedModel.find hstore_blob['some_associated_model_id']; end
[04:47:19] matthewd: Weren't we advocating *not* fighting the framework? ;)
[04:47:30] creature: matthewd: I'll definitely give STI some more thought.
[04:47:56] tubbo: STI is the subprime mortgage of technical debt
[04:48:35] creature: I don't want to invite more scrutiny on my Rails chops, but I think the main reason I was avoiding that was because if I wanted one of my subtypes to have a field, then not only do all the others get an empty field but they could also easily get it filled & that might make things fragile.
[04:48:42] matthewd: creature: If your models are similar enough that it would often be handy to just pass a Book around, then it's likely equally useful (as in the routing example, in fact) to be able to pass a Book ID
[04:49:02] creature: Eg. an ebook might want to have a file_size, which makes no sense for a Paperback.
[04:49:25] matthewd: (and with abstract models / separate tables, a "Book ID" is actually a class name + id pair)
[04:51:17] matthewd: tubbo: Is it STI though, or model inheritance?
[04:51:34] northfurr: has joined #RubyOnRails
[04:51:43] willardg: has left #RubyOnRails: ("Textual IRC Client: www.textualapp.com")
[04:51:56] qejk: has joined #RubyOnRails
[04:52:06] tubbo: matthewd: mostly STI. my problem is based on the coupling it introduces and the problems that arise from "wide" tables with lots of data in them
[04:52:43] tubbo: source: i've had to deal with STI tables and they are always the most painful to update, the hardest to reason about, the source of the most bugs, and generally the best candidates for "God" objects in your app. which is a code smell.
[04:52:44] creature: The _other_ reason I kinda favour my weird-routing thing over STI is that it's way easier for me to hit a point & say "Oh, this is really twisty, I need Ebooks to have their own dedicated controller" than it is to say "Oh, this is really twisty, Ebooks should really have their own table."
[04:52:47] dionysus69: autotest runs but it doesnt run tests on file save. rspec runs though so what am I missing?
[04:52:51] Pazician: has joined #RubyOnRails
[04:53:39] tubbo: creature: perhaps instead of having your controllers update models directly, Ebook and Paperback could be implemented as service objects that abstract the actual model stuff away. but it really seems like you have differentiating data, but similar logic.
[04:53:59] tubbo: so maybe it's better to decouple your logic code from the objects that implement your data model
[04:54:31] matthewd: creature: It feels like you're trying too hard to hedge your bets, and will end up creating now-pain for future flexibility
[04:54:42] tubbo: i think Ebook and Paperback should be totally separate models
[04:55:02] creature: I'm pretty familiar with the service object pattern, and I think that's going to be an abstraction too far for this right now.
[04:55:52] matthewd: Either your controllers are so identical that they should all be in one (and YAGNI the "but I might want to split one out later"), or they seem likely to diverge, in which case they can just be separate now, and skip the attempted abstraction
[04:56:53] matthewd: It's true the basic CRUD is likely to be quite similar... but it's also going to be pretty similar across all your other models, yet you wouldn't try to unify everything into a single controller
[04:57:37] ngscheurich: has joined #RubyOnRails
[04:57:59] tubbo: my point mostly was to decouple the classes that perform your logic from the classes that form your data model (models)
[04:58:02] krainboltgreene: Radar: Hey, I have a sitaution that you've probably run into. I want to take a record, modify the associated records in memory (including subsets of those associations), and then be able look at that soft application without re-evaluating associations.
[04:58:07] tubbo: the "service object pattern" is less relevant
[04:58:56] krainboltgreene: This is in the context of an advanced promotion code system, where I want to "soft apply" the promotion mutations, and then offer up the soft-applied cart (and related items). Problem: Every time I look at the relationships on the soft applied object, it redoes the SQL.
[04:59:20] tubbo: krainboltgreene: !code
[04:59:20] helpa: krainboltgreene: 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.
[04:59:39] pawnbox_: has joined #RubyOnRails
[05:00:06] rhizome: the quotes around "soft apply" guarantee we will have no idea what you're talking about
[05:00:36] matthewd: krainboltgreene: Can you just stick it in a transaction, make the changes, let the SQL rerun etc, then rollback?
[05:00:40] krainboltgreene: I'm betting radar will get it.
[05:01:21] krainboltgreene: matthewd: I'd rather not touch the database at all, I just want to modify the object graph.
[05:01:30] creature: matthewd: I definitely see your point, and I don't think I'll be able to convince you that I'm on the right track with my invented-for-discussion example. But sadly, I definitely will need the differences in the models later, & the CRUD is almost certainly going to stay identical.
[05:01:56] simkessy: Is it possible that a heroku db copy and move might break associations? For example, if we moved from one PostGres tier to another then did a back up restore?
[05:01:58] creature: FWIW I added a `defaults: { book_class: Paperback }` etc. to my routes, and that's working nicely.
[05:02:32] matthewd: Don't do that... params should be strings
[05:02:53] matthewd: I'm not sure exactly what/how/when, but I'm sure something will bite you later if you pass a class directly
[05:03:19] tubbo: ?book_class=ActiveRecord::Base.connection? :D
[05:03:23] matthewd: For a start, I'm sure we don't guarantee that in the API, so there's a good chance it'll break on an upgrade
[05:04:31] annlewis: has joined #RubyOnRails
[05:05:49] creature: They are now strings.
[05:06:19] matthewd: You should also check the thing tubbo was hinting towards
[05:06:40] matthewd: I don't *think* it's possible to override a default with a querystring param, but you probably want to be sure.
[05:06:49] creature: You can't. The documentation promises so.
[05:07:09] creature: http://guides.rubyonrails.org/routing.html#defining-defaults yellow box at the bottom of that section.
[05:07:31] krainboltgreene: Anyone know a gem that'll give me the diff between two active record object graphs?
[05:07:49] rhizome: any two, arbitrary?
[05:08:15] Radar: krainboltgreene: Busy. Sorry.
[05:08:24] krainboltgreene: rhizome: record.diff(record.clone)
[05:08:27] krainboltgreene: Radar: No worries.
[05:09:05] krainboltgreene: (That would return an empty diff, but eh)
[05:09:13] matthewd: krainboltgreene: I suspect your best bet would be hashdiff
[05:09:33] matthewd: (with appropriate logic to produce a relevant hash)
[05:09:41] krainboltgreene: Radar: If I get to FOSS this project I think it would be valuable for spree, fwiw.
[05:09:47] rhizome: that may be the sticky part
[05:10:04] Radar: krainboltgreene: I don't work at Spree. Haven't done so in a year.
[05:10:09] krainboltgreene: matthewd: Yeah, that's probably going to be my next step. Recursive #attributes.
[05:10:18] krainboltgreene: radar: Oh shit, I had no idea!
[05:10:48] Radar: krainboltgreene: I moved onto LIFX (fancy lightbulb people) from July last year until Jan, now I'm at Marketplacer.
[05:10:49] matthewd: I think you would need app-specific logic in the hashification... otherwise you're likely to end up traversing the entire DB
[05:10:54] Radar: And today, EVERYBODY wants my attention.
[05:11:12] krainboltgreene: Heh, fancy lightbulb people.
[05:11:30] krainboltgreene: matthewd: I bet I could use #changed
[05:11:35] krainboltgreene: Oh shit I bet that would work well.
[05:11:38] krainboltgreene: recursive changed.
[05:12:40] matthewd: You still have to traverse associations to find their changed attributes, even if the association itself is unchanged
[05:13:00] krainboltgreene: matthewd: Still, thanks! I think this might be close enough.
[05:13:09] matthewd: You *could* do something to only walk already-loaded associations
[05:13:10] creature: tubbo: By the way, I have a nagging mental thing that I owe you a "thank you" for a previous question, though I can't for the life of me remember what it was. Several weeks ago, for sure.
[05:13:17] matthewd: But I don't think we have public API that tells you that
[05:13:45] krainboltgreene: matthewd: Amusingly I think identity-map would have helped?
[05:14:00] matthewd: .. and I don't imagine we particularly want to expose such an API, either ;)
[05:14:01] krainboltgreene: I mean the big issue is that AR is doing the right thing: I'm asking for all associations and it can't tell what I had in memory.
[05:14:36] matthewd: I guess it'd help in the sense that it would be impossible to create a "differing" object graph in the first place? :)
[05:14:54] krainboltgreene: Well I wouldn't need it at that point, right?
[05:15:08] krainboltgreene: Cus cart.items would return identity-mapped objects and new objects.
[05:15:43] ur5us: has joined #RubyOnRails
[05:17:11] matthewd: Maybe you can "just" identity re-map the `items` collection, in the place you need it?
[05:17:57] agent_white: has joined #RubyOnRails
[05:18:26] agent_white: Evenin' ladies and gents :)
[05:21:07] gmond071: has joined #RubyOnRails
[05:23:34] sarink: has joined #RubyOnRails
[05:24:21] ja: protip: don't parse arel sql with regexp
[05:24:50] matthewd: protip: don't parse sql ;)
[05:27:21] jobewan: has joined #RubyOnRails
[05:29:06] alex88: has joined #RubyOnRails
[05:29:21] framling: has joined #RubyOnRails
[05:29:50] yfeldblum: has joined #RubyOnRails
[05:32:52] Aeyrix: Had a moment of blank
[05:33:06] Aeyrix: what's the method to obtain the error when you try and @object.save?
[05:33:44] Aeyrix: Cheers. :>
[05:35:36] krainboltgreene: matthewd: So for record's sake, I solved the issue by using #includes and dropping scopes for ruby enumerable methods.
[05:36:14] krainboltgreene: The includes puts things in memory, then (if you're using no scopes) it makes no sql calls, which doesn't bust the object graph.
[05:36:41] krainboltgreene: Sadly it means a scope is done in Ruby rather than SQL, mainly because I don't think I can do scopes in #includes.
[05:37:30] matthewd: You might be able to do something with merge.. maybe.
[05:38:08] shibabu: has joined #RubyOnRails
[05:38:38] matthewd: User.all.eager_load(:posts).merge(Post.published)
[05:39:05] alb12: has joined #RubyOnRails
[05:39:31] vigintas: has joined #RubyOnRails
[05:39:52] pawnbox_: has joined #RubyOnRails
[05:41:01] pawnbox_: has joined #RubyOnRails
[05:41:15] dionysus69: does nesting like this work? https://gist.github.com/webzorg/b16f389cc1403730ca6e
[05:42:28] matthewd: dionysus69: That method doesn't sound likely to do what you want, but yes you can put a loop inside another loop
[05:42:29] agoldboi: has joined #RubyOnRails
[05:42:54] dionysus69: matthewd: whty doesn't it sound like it ? :D
[05:43:01] sevenseacat: has joined #RubyOnRails
[05:43:20] matthewd: What does it do?
[05:43:45] dionysus69: if sum of any 2 elements equal to n then its true
[05:44:14] dionysus69: looks good to me but doesnt work :\ tests are failing
[05:44:16] matthewd: Walk me through it
[05:44:29] matthewd: Line 3 grabs the first element of the array
[05:44:30] matthewd: What's next?
[05:44:36] recurrence: has joined #RubyOnRails
[05:45:02] dionysus69: then line 4 grabs first element of array too and then second until last
[05:45:20] matthewd: You didn't mention line 5
[05:45:21] dionysus69: then outer array grabs second array and inner goes to through all again
[05:45:44] dionysus69: oh damn it you are right the false is surplus :))
[05:46:11] matthewd: Bonus tip: Enumerable#any?
[05:46:32] dionysus69: ?? what would
[05:46:47] dionysus69: i am not familiar with enums you suggest I use them?
[05:47:11] matthewd: array.any? {|x| array.any? {|y| x + y == n } }
[05:47:13] creature: dionysus69: You might also like to think about whether you really want your `return` there.
[05:47:47] creature: matthewd, tubbo, pontiki: I've gotta go now, but thanks for taking the time to talk through my architecture & for the pointers towards the defaults option in routes.rb. I appreciate it.
[05:47:50] Axsuul: has joined #RubyOnRails
[05:49:08] dionysus69: so matthewd that is called enumerable?
[05:49:13] matthewd: dionysus69: Or even `array.any? {|x| array.include?(n - x) }`, for teh speeds
[05:49:37] matthewd: any? and include? are methods on Enumerable
[05:51:19] dionysus69: oh and how are they different from a lambda? just because they are specific to any or include?
[05:51:57] matthewd: http://ruby-doc.org/core-2.2.3/Enumerable.html
[05:52:12] agoldboi: has left #RubyOnRails: ()
[05:52:15] tetraktys: has joined #RubyOnRails
[05:52:17] iateadonut: has joined #RubyOnRails
[05:52:28] dionysus69: haha thanks ok will investigate it all out xD
[05:52:41] SteenJobs: has joined #RubyOnRails
[05:53:15] creature: arr.permutation(2).any? { |a, b| a + b == n }
[05:53:55] creature: (Not as elegant as matthewd's, nor as efficient, but maybe a little clearer)
[05:54:34] dionysus69: ok thanks creature you too ))
[05:55:26] krainboltgreene: I wish Ruby's Array had non-mutating methods
[05:55:27] matthewd: I like that better
[05:55:57] matthewd: ... though it behaves differently if a unique element == n/2
[05:56:33] bruno-_: has joined #RubyOnRails
[05:59:57] chrissonar: has joined #RubyOnRails
[06:02:49] shock_one: has joined #RubyOnRails
[06:07:03] TPBallbag: has joined #RubyOnRails
[06:10:03] krainboltgreene: This would be much easier if changed reported relationship changes.
[06:12:46] gusrub: has joined #RubyOnRails
[06:13:07] DanielN: has joined #RubyOnRails
[06:13:20] baweaver: has joined #RubyOnRails
[06:13:23] recurrence: has joined #RubyOnRails
[06:14:52] raunicolae: has joined #RubyOnRails
[06:17:34] noobda: has joined #RubyOnRails
[06:17:58] raunicolae: has left #RubyOnRails: ()
[06:18:50] shock_one: has joined #RubyOnRails
[06:19:32] bmalum: has joined #RubyOnRails
[06:19:47] krz: has joined #RubyOnRails
[06:22:54] benlieb: has joined #RubyOnRails
[06:24:43] kerunaru: has joined #RubyOnRails
[06:26:25] krainboltgreene: Here's an abstract of my problem, if anyone's interested: https://gist.github.com/krainboltgreene/65d92982bf10b7ac1e85
[06:28:20] darutoko: has joined #RubyOnRails
[06:30:56] norc: has joined #RubyOnRails
[06:31:33] lxsameer: has joined #RubyOnRails
[06:31:33] lxsameer: has joined #RubyOnRails
[06:31:51] nya: has joined #RubyOnRails
[06:34:32] rhizome: i don't get it
[06:34:57] stannard: has joined #RubyOnRails
[06:40:45] krainboltgreene: What don't you get?
[06:40:47] bricker: has joined #RubyOnRails
[06:41:31] tagrudev: has joined #RubyOnRails
[06:41:38] vigintas: has joined #RubyOnRails
[06:43:35] aganov: has joined #RubyOnRails
[06:44:58] lxsameer: has joined #RubyOnRails
[06:45:48] owenjones: has joined #RubyOnRails
[06:48:51] Dreamer3: has joined #RubyOnRails
[06:50:09] desmondhume: has joined #RubyOnRails
[06:51:35] sevenseacat: an abstract of a problem usually has some mention of a problem in it
[06:52:37] build22_: has joined #RubyOnRails
[06:53:11] Olipro_: has joined #RubyOnRails
[06:53:35] bricker: has joined #RubyOnRails
[06:53:35] Pazician: has joined #RubyOnRails
[06:53:59] PlasmaStar: has joined #RubyOnRails
[06:54:00] hcicek: has joined #RubyOnRails
[06:54:18] dionysus69: has joined #RubyOnRails
[06:57:19] jessemcgilallen: has joined #RubyOnRails
[06:57:21] MartinElvar: has joined #RubyOnRails
[06:59:27] nogic: has joined #RubyOnRails
[07:01:42] Radar: what sevenseacat said
[07:01:47] Radar: I am also too braindead to be useful here.
[07:01:52] Radar: Today has been harrddd
[07:02:08] Radar: For reason 1 of about fifty, see: http://ryanbigg.com/2015/11/active-record-change_column-and-scales/
[07:03:37] agent_white: ACTION rubs Radar's shoulders
[07:03:42] SteenJobs: has joined #RubyOnRails
[07:07:25] ja: ???No real data was harmed in the writing of this blog post.??? lol
[07:08:43] yardenbar: has joined #RubyOnRails
[07:09:18] ja: Radar: jeez, that is _not_ handy
[07:09:56] sinkensabe: has joined #RubyOnRails
[07:10:31] build22: has joined #RubyOnRails
[07:10:51] Cork: is there a rake test method similar to assert_nothing_raised but where any exception will make the test fail?
[07:11:08] Cork: or rather make the assert fail
[07:11:09] iateadonut: has joined #RubyOnRails
[07:11:29] kerunaru: has joined #RubyOnRails
[07:12:01] sevenseacat: isnt that what assert_nothing_raised does, fail if something is raised?
[07:12:07] scmx: has joined #RubyOnRails
[07:12:09] rgtk: has joined #RubyOnRails
[07:12:34] Cork: if fails if one of the exceptions in the list is raised
[07:12:41] sevenseacat: which is a bit pointless because any uncaught exception is an insta-fail
[07:12:48] desmondhume: has joined #RubyOnRails
[07:13:17] Cork: well i need to test separate things and would prefer to have the multiple output of what part of the test that failed
[07:13:18] sevenseacat: Cork: only if you give it a ist
[07:13:21] Cork: instead of stop at the first
[07:13:28] sevenseacat: if you dont, any exception will make it fail
[07:13:28] p1k: has joined #RubyOnRails
[07:13:48] Cork: ah... (would have been nice if the documentation mentioned that)
[07:13:53] Cork: sevenseacat: thx
[07:14:09] jas02: has joined #RubyOnRails
[07:14:36] willardg: has joined #RubyOnRails
[07:14:52] sevenseacat: http://ruby-doc.org/stdlib-2.1.1/libdoc/test/unit/rdoc/Test/Unit/Assertions.html#method-i-assert_nothing_raised does mention it
[07:15:05] p1k: what determines that arel will generate two queries rather than one
[07:15:18] sevenseacat: I don't know what version of test unit you're using though, so maybe your version doesnt list it
[07:15:21] dionysus69: how do this (array.empty? && n.zero?) || array.permutation(2).any? {|a,b| a+b ==n} return false if array has only 1 element? it does return false I just don't get how
[07:15:36] Cork: sevenseacat: nice, haven't been able to find that one; have been going of http://guides.rubyonrails.org/testing.html
[07:16:42] sevenseacat: dionysus69: break the expression down - that's a lot to do on one line
[07:17:01] arBmind: has joined #RubyOnRails
[07:17:08] sevenseacat: either the left side or the right side is false
[07:17:16] shock_one: has joined #RubyOnRails
[07:17:33] sevenseacat: actually, both must be
[07:17:43] sevenseacat: ACTION is having a blonde moment
[07:18:07] dionysus69: i am having a blonde moment lol
[07:18:17] pawnbox_: has joined #RubyOnRails
[07:18:29] dionysus69: I have a problem to solve and this solves it I copied it from stackexchange, thanks if you think I wrote that
[07:18:41] sarink: has joined #RubyOnRails
[07:19:09] sevenseacat: I knew you didnt because you admitted to not having a clue how it works
[07:19:54] Radar: ja: It's very shit and something that future-Radar will have to fix.
[07:19:56] dionysus69: this doesn't look like a ternary operator, thats the only case I know when there is implicit returns
[07:20:17] sevenseacat: its a logical OR
[07:20:23] Radar: dionysus69: Follow sevenseacat's good advice. Split it into multiple lines.
[07:20:46] dionysus69: so it assumes by default that if non of them are true then it skips the block and returns false?
[07:20:50] ja: thank you, future-Radar! I'm sure everyone using decimals will appreciate it
[07:20:53] sevenseacat: for an OR operator to return true, one of its operands must be true
[07:20:57] ja: it isn't already fixed in Rails 5?
[07:21:06] ja: ?????or maybe you were testing in Rails 5?
[07:21:12] sevenseacat: so if it returns false, both the left and right side must be false
[07:21:21] AzaToth: has joined #RubyOnRails
[07:21:31] ss_much: has joined #RubyOnRails
[07:21:48] dionysus69: hmm I guess I didn't look at it that way, that enum block confused me, thanks :D
[07:21:56] sevenseacat: the block is part of the right hand side
[07:22:02] krainboltgreene: sevenseacat radar: Fair enough I guess, the problem is that calling the last line breaks the object graph in memory, killing the change of the brand value.
[07:22:43] dmarr: if anyone has any ideas https://github.com/hiromipaw/localpic/issues/1 im getting TypeError (0 is not a symbol nor a string): app/controllers/api/v1/pictures_controller.rb:22:in `create' during upload
[07:23:43] sevenseacat: dmarr: so whats on that line?
[07:24:00] dmarr: @picture = Picture.new(picture_params)
[07:24:22] krainboltgreene: Which means that soft applying changes to the object graph becomes impossible with scopes, possible with eager loading and no scopes. Eager loading has it's own problems in that saving the root object doesn't save changed nested objects in the graph.
[07:24:29] craigp: has joined #RubyOnRails
[07:24:42] krainboltgreene: Also, you know, eager loading.
[07:24:45] sevenseacat: dmarr: and whats in picture_params ?
[07:24:53] dmarr: sevenseacat: could be something im doing wrong with refile
[07:25:02] dmarr: @picture = Picture.new(picture_params)
[07:25:07] dmarr: err, params.require(:picture).permit(:title, :image)
[07:25:23] Radar: ja: I was testing in Rails 4.2.2. I will need to test in Rails 5 as well as in PostgreSQL tomorrow to get a clearer picture.
[07:25:26] sevenseacat: dmarr: can you gist a full backtrace?
[07:25:26] Radar: krainboltgreene: Might do you to put an example of what you're seeing vs what you're expecting to see in that gist
[07:25:38] sevenseacat: as the error isnt from either of those lines of code
[07:25:47] ja: Radar: Roger, cool!
[07:26:05] dmarr: https://gist.github.com/65d0e7323b6d1086fd8e
[07:26:29] sevenseacat: dmarr: that's not the full backtrace
[07:26:33] Ergo: has joined #RubyOnRails
[07:26:35] desmondhume: has joined #RubyOnRails
[07:26:36] sevenseacat: dmarr: go to your browser and press 'full trace'
[07:26:44] dmarr: ah, i'm doing this from curl
[07:26:52] norc: All this debugging makes me said. :)
[07:27:41] dmarr: sevenseacat: that is also whats in the development.log
[07:28:01] Radar: dmarr: Do you have an app that we can look at to reproduce this issue?
[07:28:46] dmarr: Radar: just whats there https://github.com/marr/localpic2
[07:28:52] infamos: has joined #RubyOnRails
[07:29:18] dmarr: u will need a s3 bucket and secrets.yml, however
[07:30:21] dmarr: in the form of https://gist.github.com/e1b92eecb9e1c3b6d34f
[07:31:30] krainboltgreene: radar: https://gist.github.com/krainboltgreene/65d92982bf10b7ac1e85
[07:31:44] Radar: [18:01:51] <Radar> I am also too braindead to be useful here.
[07:31:45] pawnbox_: has joined #RubyOnRails
[07:32:22] Pazician: has joined #RubyOnRails
[07:32:35] krainboltgreene: Anyways, that's the issue. relationship scopes break in-memory object graphs.
[07:33:38] fcser_: has joined #RubyOnRails
[07:34:52] arup_r: has joined #RubyOnRails
[07:36:06] nya: has joined #RubyOnRails
[07:36:24] supergeek: has joined #RubyOnRails
[07:36:33] cogsbox: has joined #RubyOnRails
[07:36:57] voker57: has joined #RubyOnRails
[07:37:42] notnoyyyyy: has joined #RubyOnRails
[07:38:52] arup_r: why the error is coming ? I am not able to run my rake task using Cap https://gist.github.com/aruprakshit/6bf0ed23f931916b7383
[07:39:36] rvanlieshout: has joined #RubyOnRails
[07:39:59] shibabu: has joined #RubyOnRails
[07:41:35] dhjondoh: has joined #RubyOnRails
[07:43:04] rgtk: has joined #RubyOnRails
[07:43:08] arBmind: has joined #RubyOnRails
[07:45:04] ashishsingh173: has joined #RubyOnRails
[07:46:52] owenjones: has joined #RubyOnRails
[07:47:51] rgtk: has joined #RubyOnRails
[07:50:26] freezevee: has joined #RubyOnRails
[07:51:01] solars: has joined #RubyOnRails
[07:52:57] agent_white: has joined #RubyOnRails
[07:53:34] krainboltgreene: Okay so this is cool af: https://github.com/apotonick/disposable
[07:53:49] krainboltgreene: And basically lets me solve this issue. Woo.
[07:54:22] rgtk: has joined #RubyOnRails
[07:56:12] build22_: has joined #RubyOnRails
[07:56:57] sevenseacat: transpec, you are my new best friend
[07:57:55] bruno-: has joined #RubyOnRails
[07:59:55] rgtk: has joined #RubyOnRails
[08:00:33] Rinzlit: has joined #RubyOnRails
[08:01:35] pawnbox_: has joined #RubyOnRails
[08:03:36] x-light: has joined #RubyOnRails
[08:03:48] njero: has joined #RubyOnRails
[08:05:10] teclator: has joined #RubyOnRails
[08:06:58] njero: has joined #RubyOnRails
[08:07:41] TPBallbag: has joined #RubyOnRails
[08:09:33] quazimodo: has joined #RubyOnRails
[08:09:35] th0m_: has joined #RubyOnRails
[08:13:53] solars: has joined #RubyOnRails
[08:14:13] chrissonar: has joined #RubyOnRails
[08:14:40] rakm: has joined #RubyOnRails
[08:15:07] tyl: has joined #RubyOnRails
[08:15:26] Spami_: has joined #RubyOnRails
[08:15:35] moeabdol: has joined #RubyOnRails
[08:15:40] tyl: are the connections in the rails database pool kept for the lifetime of the app or are refreshed very quickly?
[08:17:15] rvanlieshout: that depends on your connection adapter
[08:17:17] rvanlieshout: and your settings
[08:17:21] desmondhume: has joined #RubyOnRails
[08:17:25] rvanlieshout: and the rails server instances
[08:17:32] tyl: by default are they lifetime?
[08:17:47] tyl: postgresql
[08:17:50] rvanlieshout: only exclude your settings
[08:18:02] zpe: has joined #RubyOnRails
[08:18:06] tyl: nvm thanks
[08:18:59] rvanlieshout: and that also is related to the pg development stuff you've got installed
[08:19:52] MartinElvar: has joined #RubyOnRails
[08:21:03] kimegede: has joined #RubyOnRails
[08:22:58] tvw: has joined #RubyOnRails
[08:27:47] pydave6367: has joined #RubyOnRails
[08:29:43] vigintas: has joined #RubyOnRails
[08:29:48] adac: has joined #RubyOnRails
[08:29:58] njero: has joined #RubyOnRails
[08:30:24] benlieb: has joined #RubyOnRails
[08:32:56] artto: has joined #RubyOnRails
[08:34:35] futilegames: has joined #RubyOnRails
[08:39:29] arup_r: has joined #RubyOnRails
[08:41:53] quazimodo: has joined #RubyOnRails
[08:41:55] ibouvousaime: has joined #RubyOnRails
[08:44:09] SPYGAME: has joined #RubyOnRails
[08:45:23] Cervajz: has joined #RubyOnRails
[08:46:21] xhoy: has joined #RubyOnRails
[08:46:54] xhoy_: has joined #RubyOnRails
[08:48:09] SPYGAME: hey guys, i'm using carrierwave to upload and generate previews of images. i'm uploading around 300-400 images at once. the image size is not that big however < 3MB. however the process is kinda slow and i'm not sure how can i optimize it. any suggestions
[08:48:48] owenjones: has joined #RubyOnRails
[08:49:18] lipoqil: has joined #RubyOnRails
[08:49:52] RegulationD: has joined #RubyOnRails
[08:50:01] rvanlieshout: why would you want to upload 300 / 400 images in 1 go?
[08:50:02] artto: has joined #RubyOnRails
[08:50:09] rvanlieshout: that's never going to be fast
[08:50:12] rvanlieshout: so fix a progress bar :)
[08:50:44] shock_one: has joined #RubyOnRails
[08:50:46] defsdoor: has joined #RubyOnRails
[08:51:40] njero: rvanlieshout: how about using different connection for image upload?
[08:52:21] desmondhume: has left #RubyOnRails: ()
[08:52:31] __desmondhume: has joined #RubyOnRails
[08:53:07] __desmondhume: multithreading?
[08:53:20] Cervajz: has joined #RubyOnRails
[08:53:51] rvanlieshout: a browser typically won't make > 2 or 4 connections to a single host
[08:54:03] rvanlieshout: but even if they are 1 mb each it's around 300 to 400 mb
[08:54:28] __desmondhume: yeah, the bottleneck is the client->server step, not the server work itself
[08:54:49] Coldblackice_: has joined #RubyOnRails
[08:55:08] arup_r: why rake db:setup runs migration randomly..? https://gist.github.com/aruprakshit/be80140aca392e07a37e It is not starting from first to last, but random
[08:55:15] agoldboi: has joined #RubyOnRails
[08:55:33] vigintas: has joined #RubyOnRails
[08:55:43] __desmondhume: the db:setup task calls db:schema:load
[08:55:44] rvanlieshout: arup_r: it didn't run migrations?
[08:55:57] srinidhi: has joined #RubyOnRails
[08:56:02] __desmondhume: which just creates the database from the schema file
[08:56:11] arup_r: but not synchronous way..
[08:56:27] __desmondhume: it's faster, but I always recommend db:create db:migrate
[08:56:29] arup_r: not like first first, second, third ...
[08:56:32] arup_r: it is random
[08:56:40] sevenseacat: no, its loading the schema
[08:56:43] sevenseacat: not running the migrations
[08:56:55] __desmondhume: It's just "running the migrations" needed to reproduce the schema file
[08:57:01] arup_r: check my gist migration tables and the output of the rake tasks
[08:57:03] sevenseacat: no, its not running the migrations
[08:57:08] norc: arup_r: setup does create, schema:load, seed
[08:57:08] sevenseacat: it's loading the schema.rb file
[08:57:18] tyl: has left #RubyOnRails: ("Textual IRC Client: www.textualapp.com")
[08:57:26] norc: arup_r: it is just a shortcut for these three tasks in that order.
[08:57:45] __desmondhume: I think it's the most misunderstood rake task lol
[08:57:48] srinidhi1: has joined #RubyOnRails
[08:58:07] __desmondhume: also db:reset is pretty misleading
[08:58:37] treaki: has joined #RubyOnRails
[08:58:49] arup_r: cool. what is the advantage of loading from schema.rb file instead from rerunning migrations..
[08:58:57] norc: arup_r: Speed.
[08:59:10] rvanlieshout: arup_r: how often do you need to see that it's not runnin migrations?
[08:59:13] __desmondhume: lots of migrations, especially the oldest ones, are going to be pretty useless at some point
[08:59:16] arup_r: first time I used this task.. and misread the task defn
[08:59:42] arup_r: makes sense.. and why it increase the speed also clear to me
[08:59:47] rvanlieshout: and it's not only speed
[08:59:59] xhoy: has joined #RubyOnRails
[09:00:05] rvanlieshout: it's also prevents changes from a to b to c.. it just applies c
[09:00:10] arup_r: because we can have obsolete migrations but the schema.rb file has actual db image which is in use so better to load from there
[09:00:21] arup_r: rvanlieshout: I don
[09:00:30] rvanlieshout: true, but your migrations should also always work
[09:00:33] arup_r: t get the a->b>c thing
[09:00:34] xhoy_: has joined #RubyOnRails
[09:00:35] sevenseacat: yes, they should
[09:00:43] rvanlieshout: that's why you have to include model code if you're using plain models in it
[09:00:50] sevenseacat: but usually they stop working after people refer to models in them
[09:01:07] __desmondhume: i also tend to trust the migrations more than the schema
[09:01:20] arup_r: what you guys are now talking about ? Please go slow :(
[09:01:21] __desmondhume: you know, colleagues not versioning the schema, stuff like that...:D
[09:01:31] rvanlieshout: __desmondhume: reject their pull request?
[09:01:39] rvanlieshout: correct schema.rb is crucial when using apartment gem
[09:01:44] __desmondhume: rvanlieshout: you're living the dream lol
[09:01:55] __desmondhume: my team always commit schema.rb
[09:02:04] rvanlieshout: we don't accept merge requests with incorrect schema.rb
[09:02:06] __desmondhume: but I don't know, following the whole migrations path makes me more confident lol
[09:02:13] rvanlieshout: and with migrations that access models, but don't include them in the migration file
[09:02:18] __desmondhume: do you know if there's any way to check it when CI-ing?
[09:02:19] jsrn_: has joined #RubyOnRails
[09:02:21] arup_r: oh yes, I have some code in migrations that runs after creating table.. which is not possible with `reset` task
[09:02:40] rvanlieshout: arup_r: you _should_ include the model code required for that code _in_ the migration file
[09:03:09] arup_r: you didn't get me .. :/
[09:03:15] rvanlieshout: happens quite often :)
[09:03:21] arup_r: yes.. I know
[09:03:41] DEA7TH: has joined #RubyOnRails
[09:04:06] arup_r: if I load tables from schema.rb file. then Ruby code I have with migrations will not run.. but If I run rake db:migrate all is safe this is what I meant
[09:04:15] MartinElvar: has joined #RubyOnRails
[09:04:23] rvanlieshout: arup_r: what should be executed then?
[09:04:28] rvanlieshout: cause loading a schema doesn't include data
[09:05:00] arup_r: yes, I have some with migrations to do data fix.. 3 migrations have like that..
[09:05:08] trosborn: has joined #RubyOnRails
[09:05:20] __desmondhume: oh, and never, ever change older migrations
[09:05:21] TPBallbag: has joined #RubyOnRails
[09:05:35] rvanlieshout: arup_r: but there is no data when creating a new db
[09:05:43] arup_r: some people created enum filed which has no default, lot of nil .. so I fixed those later using migration and using not null constraint
[09:05:54] rvanlieshout: so that can't be an issue
[09:06:12] arup_r: yes, seems no issues..
[09:06:39] arup_r: good things making sense to me now way better
[09:07:41] arup_r: well I have a dev server.. so I am planing to do data refresh their.. I mean full clean up. so I am going to choose it like rake db:setup db:fixtures:load
[09:07:48] arup_r: with my Cap task
[09:08:05] kitsuneyo: has joined #RubyOnRails
[09:08:34] arup_r: I had some confusion before because the random migrations and then code inside migrations.. now things are clear. I got it, what is going on.. seems safe
[09:08:58] arup_r: only problem is fixtured load task cleaning seed data :(
[09:09:06] arup_r: how to tackle this ^^ ?
[09:09:20] arup_r: Again running the seed taks after fixture load ?
[09:10:11] sevenseacat: fixtures? huh?
[09:10:27] teclator: has joined #RubyOnRails
[09:10:32] sevenseacat: seeds and fixtures run in different environments - seeds are for dev/prod/whatever, fixtures are for test
[09:10:38] SteenJobs: has joined #RubyOnRails
[09:10:43] arup_r: yes.. I tested. once it is loaded no seeds in the table.. it is cleaning all data from table before load new data
[09:11:14] arup_r: yes, I know. for now I am doing it like that.. it is just a week too.. so I am loading data from there
[09:11:19] sevenseacat: you need to be clearer about what you're doing and where
[09:12:31] czerasz: has joined #RubyOnRails
[09:12:40] arup_r: I know what I am doing.. I am just saving some time to up and run my server... then I will slowly migrate everything to seeds.rb
[09:12:49] defsdoor: has joined #RubyOnRails
[09:12:51] DoubleMalt: has joined #RubyOnRails
[09:12:55] sevenseacat: you're not telling us what you're doing, so how are we supposed to help?
[09:12:57] arup_r: I now need data to test features and
[09:12:57] rvanlieshout: i wouldn't fail if you would know what you were doing :)
[09:13:24] arup_r: I thought I already said.
[09:16:18] arup_r: thanks.. I found out my solution..:) thanks folks
[09:18:03] marr: has joined #RubyOnRails
[09:18:19] dhjondoh: has joined #RubyOnRails
[09:19:33] shock_one: has joined #RubyOnRails
[09:21:21] futilegames: has joined #RubyOnRails
[09:23:05] xaviergmail: has joined #RubyOnRails
[09:23:20] __desmondhume: lol never use seeds in test env
[09:23:33] xaviergmail: I wanted to apologize for viewing the Rails logo as a tentacle for over two years now
[09:24:06] xaviergmail: It just now appeared to me that it was supposed to be a railroad track
[09:26:25] neanderslob: has joined #RubyOnRails
[09:26:34] xaviergmail: So I've been using Django for a few months now and I've been wanting to try out Rails as well just to say I have it in my toolbelt if needed and possibly even switch to using rails completely
[09:26:48] mark2: has joined #RubyOnRails
[09:27:06] xaviergmail: But I have one question... Does Ruby start making more sense after a while of staring at it? I find its syntax to be quite spooky
[09:27:21] FailBit: yes, it does
[09:27:30] FailBit: but the syntax doesn't get less weird as you get better
[09:27:40] sevenseacat: the syntax is awesome
[09:27:50] FailBit: let's agree to disagree
[09:28:09] erbesharat: has joined #RubyOnRails
[09:28:22] xaviergmail: FailBit: I have a lot of experience twisting Lua's syntax to certain extremes so I can understand
[09:28:41] qnsi: has joined #RubyOnRails
[09:34:26] youngbaks: has joined #RubyOnRails
[09:37:00] comrad: has joined #RubyOnRails
[09:38:13] shock_one: has joined #RubyOnRails
[09:40:17] nfk|laptop: has joined #RubyOnRails
[09:41:02] build22: has joined #RubyOnRails
[09:41:31] stannard: has joined #RubyOnRails
[09:42:34] blackmesa: has joined #RubyOnRails
[09:42:48] dideler: has joined #RubyOnRails
[09:43:08] tetraktys: has joined #RubyOnRails
[09:46:03] it_tard: has joined #RubyOnRails
[09:47:53] Megamos: has joined #RubyOnRails
[09:49:34] owenjones: has joined #RubyOnRails
[09:49:53] Megamos: has joined #RubyOnRails
[09:51:07] allyraza: has joined #RubyOnRails
[09:53:18] vigintas: has joined #RubyOnRails
[09:53:29] njero: has joined #RubyOnRails
[09:53:53] i: has joined #RubyOnRails
[09:54:03] czerasz: has joined #RubyOnRails
[09:57:28] stamina: has joined #RubyOnRails
[09:58:35] rodfersou: has joined #RubyOnRails
[09:58:58] futilegames: has joined #RubyOnRails
[09:59:31] __desmondhume: has joined #RubyOnRails
[09:59:44] bruno-: has joined #RubyOnRails
[10:00:55] solars: refactoring question: I've got actions like this: https://gist.github.com/solars/22125f7c824a30b0c3cc and I'd like to abstract out this block, however I don't know how because if I put it into a method it will only return from that method.. is a filter the way to go?
[10:01:24] yuujinlee: has joined #RubyOnRails
[10:01:58] Papierkorb: solars: For stuff like that, I raise (custom) error which I catch in the AppController and then render something nice out of it for the client
[10:02:37] Papierkorb: then it could be: raise AccessError, 'Access denied' unless allowed?
[10:02:57] solars: hmm yeah that would be an option
[10:03:09] yuujinlee: guys, i have a site that displays famous animals on the web. I am little confused on how to set up my Models. There will be many diferent dogs and cats......Do I create a model for Animal, and another model for Cat & Dog ?
[10:03:10] solars: but isn't a filter nicer? I'm unsure if it works in the way I think
[10:03:27] Papierkorb: That also works great with when you refactor that into new methods
[10:03:37] rgtk: has joined #RubyOnRails
[10:03:45] solars: hm yeah right
[10:04:03] Papierkorb: solars: I don't like filters that much. too much magic. the code which says if it will be invoked is somewhere completely different than that. it's also more error prone because of that. and it's security. No half solutions.
[10:04:49] solars: yeah, I see
[10:04:51] futilegames: has joined #RubyOnRails
[10:04:53] solars: I'll try it like that
[10:05:12] njero: yuujinlee: different models for each will be a bad idea.. you will become nuts :)
[10:05:46] yuujinlee: n_e_o, but when I create an item for 'grumpy the cat', how would I categorize it as Cat ?
[10:06:00] njero: yuujinlee: how about classifying and grouping under animal model itself or some class of animals
[10:06:07] toomus: has joined #RubyOnRails
[10:06:53] yuujinlee: n_e_o, not sure i follow - new to Rails here
[10:07:29] Papierkorb: yuujinlee: having a model for types of animals is over-engineering. A database model isn't a Java class hierarchy.
[10:08:20] toomus: What is the best way to eager load polymorphic associations, to prevent N+1 queries?
[10:08:50] __desmondhume: includes(:related_model)?
[10:09:33] toomus: __desmondhume: but is this work for polymorphic?
[10:09:37] arBmind1: has joined #RubyOnRails
[10:09:45] __desmondhume: I'm using it on a project
[10:09:53] __desmondhume: where Picture is a polymorphic model
[10:10:00] __desmondhume: belonging to other models
[10:10:50] njero: yuujinlee: how about four legged or reptiles with animal name and feature list as attribute.. i can't break exactly bcz i'm not familiar with animal classification
[10:10:56] __desmondhume: toomus: SELECT "pictures".* FROM "pictures" WHERE "pictures"."subject_type" = 'Estate' AND "pictures"."subject_id" IN (1) ORDER BY pictures.position ASC
[10:11:12] __desmondhume: this is the query if I call `Estate.includes(:pictures)`
[10:11:57] toomus: __desmondhume: Ah, OK :)
[10:12:41] __desmondhume: toomus: so yeah, it eager loads polymorphic related just by includes :D
[10:14:09] toomus: __desmondhume: so there is a one query for each of polymorphic type
[10:14:35] __desmondhume: yeah, it basically runs 1 query for each included model
[10:14:57] __desmondhume: so it's going to be 1 + N, where N is the number of related models :)
[10:17:34] Ergo^: has joined #RubyOnRails
[10:17:50] __desmondhume: toomus: of course it's the average rule, you would have more queries if you have many to many, but you get the idea :)
[10:18:36] arBmind: has joined #RubyOnRails
[10:22:03] ubersapiens: has joined #RubyOnRails
[10:23:32] ubersapiens: hello rails world. quick question. i have a products table on my schema, but no model to go with it. how can i check the last product i created on the rails console. Product.last not working.
[10:23:46] rvanlieshout: ubersapiens: you've gat a broken app
[10:25:59] rvanlieshout: cause you'll need a Product model if you want to use Product.all
[10:27:00] ubersapiens: so no way of inspecting the last created Product?
[10:27:06] ubersapiens: model is absolutely necessary
[10:27:48] __desmondhume: rails c class Product < ActiveRecord::Base; end
[10:27:53] rvanlieshout: snice you've just told me this is spree
[10:27:57] rvanlieshout: it might be a namespaced model
[10:28:42] __desmondhume: Spree::Product.last
[10:29:20] DEA7TH: has joined #RubyOnRails
[10:29:22] ubersapiens: let me try that desmond
[10:29:38] __desmondhume: ubersapiens: LOL
[10:29:58] __desmondhume: spoiler -> i used spree before
[10:33:01] avelldiroll: has joined #RubyOnRails
[10:33:14] Peg-leg: has joined #RubyOnRails
[10:38:33] wethu: has joined #RubyOnRails
[10:38:40] noobda: has joined #RubyOnRails
[10:39:02] blackmesa: has joined #RubyOnRails
[10:39:21] arBmind: has joined #RubyOnRails
[10:40:03] noobda: hey all, is it possible to maintain a "user" array instead of querying the database, for every new request? and if yes, would it be faster or slower or same?
[10:40:36] suchness: noobda: What are you talking about?
[10:42:01] noobda: right now, whenever my webapp requests for a user, it sends a query to database to get his details and verify. But wouldn't it be faster if I created an array and stored all the user data there? (it maybe in the RAM i think)
[10:42:21] suchness: noobda: I am just going to say no.
[10:42:44] noobda: ohh lol. Well I tried to do that, haha and it's a nightmare tbh
[10:42:53] suchness: noobda: For good reason.
[10:43:16] noobda: okay well, there goes 20 hours down the drain
[10:49:50] youngbaks: has joined #RubyOnRails
[10:50:28] owenjones: has joined #RubyOnRails
[10:52:33] ldnunes: has joined #RubyOnRails
[10:53:16] sinkensabe: has joined #RubyOnRails
[10:53:38] build22: has joined #RubyOnRails
[10:54:49] apotry: has joined #RubyOnRails
[10:54:55] sarink: has joined #RubyOnRails
[10:56:15] beauby: has joined #RubyOnRails
[10:57:43] Palsson: has joined #RubyOnRails
[10:58:53] platzhirsch: has joined #RubyOnRails
[10:59:07] platzhirsch: How can I use cursor iteration on a SQL query execution ?
[10:59:43] platzhirsch: there's not find_each_by_sql
[11:00:41] bruno-: has joined #RubyOnRails
[11:00:49] platzhirsch: or would it use the cursor if I call .each upon it?
[11:02:25] __desmondhume: has joined #RubyOnRails
[11:02:25] rvanlieshout: iirc it would, but you might also want to check find_in_batches
[11:03:34] MartinElvar: has joined #RubyOnRails
[11:04:38] raunicolae: has joined #RubyOnRails
[11:04:44] platzhirsch: rvanlieshout: stuck to Rails 2.3 :[
[11:04:56] platzhirsch: but thanks for future references :)
[11:05:40] lubekpl: has joined #RubyOnRails
[11:05:50] noodle: has joined #RubyOnRails
[11:07:02] pawnbox_: has joined #RubyOnRails
[11:09:02] dhjondoh: has joined #RubyOnRails
[11:09:56] dionysus69: has joined #RubyOnRails
[11:10:42] lubekpl: has joined #RubyOnRails
[11:13:14] craigp: has joined #RubyOnRails
[11:13:14] pydave6367: has joined #RubyOnRails
[11:15:05] alb12: has joined #RubyOnRails
[11:17:43] glaksmono: has joined #RubyOnRails
[11:17:59] glaksmono: guys, if I say .includes(payment_refunds: [:user]), what does that mean?
[11:18:02] dionysus69: has joined #RubyOnRails
[11:18:10] glaksmono: is that joining to :user table right?
[11:18:20] baweaver: has joined #RubyOnRails
[11:18:22] njero: has joined #RubyOnRails
[11:18:40] Hates_: has joined #RubyOnRails
[11:18:41] lacrymology: has joined #RubyOnRails
[11:19:16] Hates_: noobda: depending on what/why, you could store user ids in something like redis
[11:19:45] norc: I feel like Im missing some useful AR methods here. Is there a more elegant way to do this model method? http://pastie.org/10548290
[11:19:49] CodingWolf: has joined #RubyOnRails
[11:20:13] raidiant: has joined #RubyOnRails
[11:20:31] rickmasta: has joined #RubyOnRails
[11:20:38] noobda: Hates_: actually I have another doubt as well. Umm, my users data structure has non-primitive field in it. (It contains "progress", a user-defined datatype) How do I store all this in a database?
[11:20:56] htmldrum: has joined #RubyOnRails
[11:21:40] noobda: Should I convert the progress field into a string and then store it?
[11:22:13] Hates_: noobda: what is progress originally?
[11:22:28] marr: has joined #RubyOnRails
[11:22:37] pontiki: norc: i don't think so.
[11:22:58] pontiki: norc: also, that's pretty understandable the way it is
[11:23:02] noobda: progress is a data-type I defined. It has 3 fields: (int)percentage, (string)status, (string)current_question
[11:23:12] noobda: Hates_: ^
[11:24:08] Hates_: noobda: ah, maybe it's best to break that out into it's own model and table
[11:24:17] norc: pontiki: Mm alright.
[11:24:33] noobda: Hates_: so that would be 2 tables, one for user, other for progress?
[11:24:58] Hates_: noobda: or you can use composed_of
[11:24:59] pontiki: norc: it's also 5am here and i'm not sure why i'm awake :D
[11:26:22] Hates_: noobda: if you used composed_of you'd add those three columns to your user table, then it return you a value object
[11:26:49] noobda: Hates_: ookay that's interesting
[11:26:52] Hates_: noobda: http://api.rubyonrails.org/classes/ActiveRecord/Aggregations/ClassMethods.html
[11:27:21] norc: pontiki: http://pastie.org/10548298
[11:27:31] norc: A bit more sensible with the enumerators at least. :)
[11:27:51] norc: Beats my weird block chaining with reject
[11:28:26] norc: And I can do one better I think.
[11:28:37] pontiki: the method is doing more than one thing. i mean if you're refactoring/golfing
[11:29:30] norc: Looking from the action it is doing only one thing: Making sure that my rollout zone has one of each task specified.
[11:29:54] norc: and only those tasks
[11:30:19] pontiki: sure, i get that; it's a two step process
[11:30:30] pontiki: it's still two things
[11:30:41] pontiki: it still makes sense
[11:31:00] dionysus69: has joined #RubyOnRails
[11:31:07] beauby: has joined #RubyOnRails
[11:33:33] pontiki: norc: out of curiousity, why do you raise an error if you're passed in a set of categories where one might not be saved?
[11:34:06] pontiki: is that some internal consistency checking?
[11:35:12] norc: pontiki: Indeed. I directly pass an array from my strong params to that method, so I don't know whether the specified categories actually exist.
[11:35:38] RTG`: in light of consistency, shouldn't the create call have a bang?
[11:35:57] antgel: has joined #RubyOnRails
[11:36:13] Cervajz_: has joined #RubyOnRails
[11:37:04] pontiki: ah, so handling user input
[11:37:53] pontiki: do you have a way of sorting out the different possible exceptions?
[11:38:08] norc: RTG`: validates_associated should handle this I think.
[11:39:27] stamina: has joined #RubyOnRails
[11:39:51] norc: pontiki: Nope. But the semantics behind it along with the tests Im writing should ensure I don't need to worry about it.
[11:40:06] norc: pontiki: The possible input gets automatically generated. This is just some sanity check for tests.
[11:40:10] pontiki: i guess i meant to be able to tell the user something useful
[11:40:26] blackmesa: has joined #RubyOnRails
[11:40:39] pontiki: but i'm assuming a ton of context
[11:41:01] norc: Yeah, no its fine. Basically I generate a set of checkboxes that select the types of tasks you want to attach.
[11:42:13] norc: So the user does not have "direct" control over the parameters anyway. An uncaught exception that somehow ends up in a 404 for bug is fine by me - just should not happen to begin with. :)
[11:42:22] pontiki: ACTION nods 
[11:44:05] avril14th: has joined #RubyOnRails
[11:44:41] tetraktys: has joined #RubyOnRails
[11:44:44] avril14th: Hello, what is the expected syntax in strong parameters to require the presence of a nested_attribute?
[11:45:00] avril14th: I'm trying params.require(:flows).require(:flows => [:item_id])
[11:46:34] dionysus69: has joined #RubyOnRails
[11:47:23] bobbobbins: has joined #RubyOnRails
[11:48:02] youngbaks: has joined #RubyOnRails
[11:48:04] andrew9184: has joined #RubyOnRails
[11:48:19] shibabu: has joined #RubyOnRails
[11:48:47] rvanlieshout: i would only expect permit once
[11:49:16] rvanlieshout: but you'll have to review the docs in allowing array or hash arguments
[11:49:26] rvanlieshout: that just doesn't seem to stay persistend in my brain yet :)
[11:50:03] dionysus70: has joined #RubyOnRails
[11:50:17] raunicolae: has left #RubyOnRails: ("Once you know what it is you want to be true, instinct is a very useful device for enabling you to know that it is")
[11:50:35] cac: has joined #RubyOnRails
[11:50:53] owenjones: has joined #RubyOnRails
[11:51:07] tvw: has joined #RubyOnRails
[11:52:34] jamo: has joined #RubyOnRails
[11:53:00] tetraktys: has joined #RubyOnRails
[11:53:21] DEA7TH: has joined #RubyOnRails
[11:57:32] nya: has joined #RubyOnRails
[12:00:08] gavit: is there a rails gem that allows me to manipulate tables by allowing the user to hide colomns
[12:00:26] rvanlieshout: gavit: you need a gem for that?
[12:02:26] norc: If I update a record with #update and execute more code, can I interrogate the object to see whether everything was persisted properly to the database?
[12:03:17] freezevee: has joined #RubyOnRails
[12:04:18] gavit: rvanlieshout: I don't like reinventing wheels.
[12:04:29] gavit: rvanlieshout: I found what I was looking for btw: https://datatables.net/extensions/responsive/
[12:04:39] gavit: rvanlieshout: thanks anyway
[12:04:51] rvanlieshout: you didn't tell us you were already using datatables
[12:04:53] rgtk: has joined #RubyOnRails
[12:06:46] gavit: rvanlieshout: I wasn't. I'm going to now though
[12:07:01] krz: has joined #RubyOnRails
[12:08:04] rvanlieshout: i would just add a simle thing to hide or show a column over datatables though
[12:09:07] britter: has joined #RubyOnRails
[12:09:22] gavit: rvanlieshout: I'll probably manipulate more than simple hide/show eventually, might as well start using datatables
[12:09:29] gavit: I like the sorting, the paginating
[12:10:30] Spami_: has joined #RubyOnRails
[12:10:32] lxsameer: has joined #RubyOnRails
[12:10:53] platzhirsch: has joined #RubyOnRails
[12:11:01] beauby: has joined #RubyOnRails
[12:11:33] wethu: has joined #RubyOnRails
[12:11:47] gavit: rvanlieshout: I am using scss, and everytime I add a gem it seems to prefer *= require(I believe this is less) over the @import(of sass), do you know why this is?
[12:11:55] Pazician: has joined #RubyOnRails
[12:12:21] gavit: datatables being one of them (the generate install didn't add the css to my scss)
[12:14:27] rvanlieshout: don't know actually
[12:14:56] chipotle: has joined #RubyOnRails
[12:16:04] Pazician: has joined #RubyOnRails
[12:17:04] gavit: rvanlieshout: do you have the same experience? /me just manually adds the @import
[12:17:20] gavit: but I can hardly believe the gem creators made such a mistake
[12:17:51] shibabu: has joined #RubyOnRails
[12:18:55] rvanlieshout: i don't use generators that often
[12:18:59] rvanlieshout: just add those few lines myself
[12:19:16] youngbaks: has joined #RubyOnRails
[12:19:38] baweaver: has joined #RubyOnRails
[12:19:56] arup_r: has joined #RubyOnRails
[12:20:08] Pazician: has joined #RubyOnRails
[12:20:26] infamos: has joined #RubyOnRails
[12:20:38] TvL2386: has joined #RubyOnRails
[12:21:06] arup_r: If you look my data, the search terms are inserted but why then no records.. cming
[12:21:58] cac: has joined #RubyOnRails
[12:23:37] ddv: arup_r: ?
[12:23:47] ddv: arup_r: engrish? :)
[12:24:09] arup_r: I am using https://github.com/Casecommons/pg_search#multisearchable .. After importing data to the table using `PgSearch::Multisearch.rebuild(User)`, when searching the table the term "admin", it is giving me `nil`. I am expecting records from it..https://gist.github.com/aruprakshit/b601dd192e831c5bd9b3
[12:24:17] njero: has joined #RubyOnRails
[12:24:38] ddv: arup_r: start debugging?
[12:24:43] syath: has joined #RubyOnRails
[12:25:02] arup_r: do you want my console? :)
[12:25:14] ddv: arup_r: no?
[12:27:34] ddv: I already have a console
[12:28:24] arup_r: mine is freaking awesome.. wanna to try..
[12:29:12] wethu: has joined #RubyOnRails
[12:30:42] quazimodo: has joined #RubyOnRails
[12:31:40] defsdoor: has joined #RubyOnRails
[12:32:57] Guest58448: has left #RubyOnRails: ()
[12:33:20] i: has joined #RubyOnRails
[12:34:57] ddv: arup_r: ok
[12:35:00] ddv: arup_r: show me
[12:35:06] kitsuneyo: has joined #RubyOnRails
[12:35:17] yuujinlee: If I made a model Animal, and now I need the ability to create/edit/delete animals, do I now create a controller, animals ?
[12:35:58] arup_r: I have added this config in initializer.. https://gist.github.com/aruprakshit/b601dd192e831c5bd9b3 not getting type cast error
[12:36:16] arup_r: How to use this gem :(
[12:36:23] ddv: yuujinlee: please
[12:36:38] ddv: yuujinlee: http://guides.rubyonrails.org/getting_started.html
[12:36:58] yuujinlee: probably right, need to read the doc
[12:37:03] wwalker: has joined #RubyOnRails
[12:37:43] parus: has joined #RubyOnRails
[12:37:58] timmyBsd: has joined #RubyOnRails
[12:38:14] LiamW: has joined #RubyOnRails
[12:38:33] __desmondhume: has joined #RubyOnRails
[12:41:24] FailBit: should I place custom validators in app/models/validators/ ?
[12:42:42] arup_r: FailBit: that is ok after that one more directory where you will put ypur validation class
[12:42:59] arup_r: and your all classes will be loaded automatically
[12:43:05] tbuehlmann: FailBit, if the validator is domain specific, either in app/models/validators or in app/validators. if the validator is not domain specific, I'd take lib/validators
[12:43:34] arup_r: sorry.. yes app/validators/<class_name.rb>
[12:45:53] ValicekB: has joined #RubyOnRails
[12:46:24] MuffinPimp: has joined #RubyOnRails
[12:46:25] Sigfrid: has joined #RubyOnRails
[12:47:19] arup_r: I am on Potgres9.4 .. to use PgSearch.multisearch I need to enable the extenson as the post did
[12:47:27] arup_r: http://stackoverflow.com/a/13835894/2767755
[12:47:40] bruno-: has joined #RubyOnRails
[12:48:51] bobbobbins: has joined #RubyOnRails
[12:49:10] bvbrandon: has joined #RubyOnRails
[12:49:58] tbuehlmann: arup_r, cool?
[12:50:11] dhjondoh: has joined #RubyOnRails
[12:50:30] sunya7a__: has joined #RubyOnRails
[12:50:34] ddv: poor arup_r :p
[12:50:53] ddv: arup_r: learn to ask good questions
[12:51:13] RegulationD: has joined #RubyOnRails
[12:51:33] arup_r: no. I am embrassed .I asked the question already.. so I am on the context
[12:51:50] owenjones: has joined #RubyOnRails
[12:52:07] arup_r: this pg_search is not working,. I follow the readme .. but something is wrong
[12:52:36] ddv: arup_r: Yes.
[12:53:23] __desmondhume: has joined #RubyOnRails
[12:56:30] Megamos: has joined #RubyOnRails
[12:59:59] arup_r: ddv: and you are here not to help people rather bugging people :p
[13:01:58] maxz: has joined #RubyOnRails
[13:02:24] ddv: most people in here don't even understand your questions
[13:02:37] ddv: to be honest
[13:03:14] arup_r: its ok. But then be silent. don't bug me further
[13:03:19] arup_r: just DON'T
[13:03:23] nya: has joined #RubyOnRails
[13:03:51] arup_r: this is my 3rd language problem.
[13:04:20] arup_r: You speak in 1 language.. but I have to more than 1..
[13:04:22] rvanlieshout: arup_r: it would really help if you just didn't wrote 'not working'
[13:04:24] scmx: has joined #RubyOnRails
[13:04:24] rvanlieshout: or 'something is wrong'
[13:04:27] rvanlieshout: and leave it at that
[13:04:36] ddv: arup_r: assumptions
[13:04:38] rvanlieshout: my native language isn't English too
[13:04:46] arup_r: everything I wrote above, and I was continuing with my search and attempts
[13:05:33] arup_r: I didn't know I have to write everything with my each question what I already said.
[13:06:00] arup_r: ddv: it is a lack of manners. to be honest!
[13:06:06] hardtail: has joined #RubyOnRails
[13:06:08] rvanlieshout: well.. i agree with ddv on this one
[13:06:09] Cervajz_: has joined #RubyOnRails
[13:06:18] rvanlieshout: most people here are not just waiting for a question
[13:06:24] rvanlieshout: they are at work or doing varous other things
[13:06:34] rvanlieshout: so they can't remember or read everything written in here
[13:08:06] __desmondhume: rvanlieshout: totally agree
[13:11:53] arup_r: anyway, I resolved it. I had to enable some extensions to work with pg-search gem ( http://stackoverflow.com/questions/10875055/where-do-i-put-pgsearch-multisearch-options/13835894#13835894 ) now working
[13:12:01] arup_r: thanks everyone
[13:12:19] tknz: has joined #RubyOnRails
[13:12:33] tbuehlmann: arup_r, fyi, there's a method for enabling extensions: http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/AbstractAdapter.html#method-i-enable_extension
[13:12:54] jkamenik: has joined #RubyOnRails
[13:13:42] arup_r: tbuehlmann: Nice. going to rollback mine one :) https://gist.github.com/aruprakshit/b601dd192e831c5bd9b3
[13:14:50] atomical: has joined #RubyOnRails
[13:17:31] njero: has joined #RubyOnRails
[13:18:35] brendan-: has joined #RubyOnRails
[13:18:39] curses: has joined #RubyOnRails
[13:19:13] sankaber: has joined #RubyOnRails
[13:20:43] defsdoor: has joined #RubyOnRails
[13:20:52] gavit: I have a view with several tables which use the same variables in some kind of calculations. Do I add all those variables in my controller, or do I keep fetching them in my model?
[13:21:14] roxtrongo: has joined #RubyOnRails
[13:22:42] mxrguspxrt: has joined #RubyOnRails
[13:23:37] baweaver: has joined #RubyOnRails
[13:25:44] mwlang: has joined #RubyOnRails
[13:25:55] build22: has joined #RubyOnRails
[13:28:18] mwlang: I have started my development environment with thin ???start --ssl -a 192.168.1.42 --ssl-disable-verify??? (and port-forwarded 3000 on my router). When I hit my app in my desktop???s browser, it works as expected, but when I hit it from another computer, I get this: Cannot render console from 192.168.1.1! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
[13:28:28] mwlang: any idea how to work around?
[13:29:14] mwlang: For what it???s worth, I???m attempting to test integration with Amazon???s Mechanical Turk using the turkee gem.
[13:30:48] teclator: has joined #RubyOnRails
[13:30:58] pawnbox__: has joined #RubyOnRails
[13:31:35] rvanlieshout: mwlang: if you want a remote debugging console, you'll need to allow that network
[13:36:57] kitsuneyo: has joined #RubyOnRails
[13:38:22] CodingWolf: has joined #RubyOnRails
[13:39:49] goodcodeguy: has joined #RubyOnRails
[13:39:53] Megamos: has joined #RubyOnRails
[13:40:33] coffeejunk: has joined #RubyOnRails
[13:40:37] parus: has joined #RubyOnRails
[13:40:46] Megamos: has joined #RubyOnRails
[13:41:10] daivyk: has joined #RubyOnRails
[13:45:14] mwlang: rvanlieshout: is that OSX or thin setting?
[13:47:02] dstarh: has joined #RubyOnRails
[13:48:18] rvanlieshout: it's the console gem you're using
[13:48:41] bvbrandon_: has joined #RubyOnRails
[13:49:10] ayonkhan: has joined #RubyOnRails
[13:49:18] filipechagas: has joined #RubyOnRails
[13:49:26] mwlang: rvanlieshout: this one? web-console (2.2.1)
[13:49:32] mwlang: (grepped Gemfile.lock)
[13:49:51] bvbrandon__: has joined #RubyOnRails
[13:50:07] stannard: has joined #RubyOnRails
[13:50:07] njero: has joined #RubyOnRails
[13:50:33] mwlang: ah. First Rails 4.2 project???.new gems to learn.
[13:52:25] owenjones: has joined #RubyOnRails
[13:53:04] sankaber: has joined #RubyOnRails
[13:53:25] dllnl: has joined #RubyOnRails
[13:54:07] GeorgesLeYeti: has joined #RubyOnRails
[13:55:40] roxtrongo: has joined #RubyOnRails
[13:57:13] bvbrandon: I have a textarea in my edit page, is there a way to make it show current values?
[13:57:15] GeorgesLeYeti: I have an Article which belongs to a User. And i want to create an article with actvie admin. But i have now i have more and more users and my select list is pretty long. So I want to add an autocompletation.
[13:57:28] rvanlieshout: bvbrandon: !gist controller and model
[13:57:28] helpa: bvbrandon: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[13:57:43] rvanlieshout: and view i mean :)
[13:58:47] pawnbox_: has joined #RubyOnRails
[13:58:56] GeorgesLeYeti: My problem is simple. I just want to create my article with the right user_id while i now create it with the user email
[13:59:06] sankaber: has joined #RubyOnRails
[13:59:25] dsimon: GeorgesLeYeti, i'm not really following you there, can you rephrase?
[14:00:13] n1ck7: has joined #RubyOnRails
[14:00:14] GeorgesLeYeti: In my form in active admin in my user_id field i now enter the user email
[14:00:41] __desmondhume: by default active admin uses a select for "belongs_to" relations
[14:01:18] mikecmpbll: has joined #RubyOnRails
[14:01:18] GeorgesLeYeti: yes but the select list is way too long so I replace it with a autocompletation.
[14:01:22] bvbrandon: has left #RubyOnRails: ()
[14:01:37] lacrymology: has joined #RubyOnRails
[14:01:41] __desmondhume: maybe this? https://github.com/activeadmin/activeadmin/issues/1754
[14:02:16] GeorgesLeYeti: __desmondhume, i use this for the filter it works well
[14:02:43] GeorgesLeYeti: but now i want to add it in my form
[14:03:20] sinkensabe: has joined #RubyOnRails
[14:04:41] Megamosaren: has joined #RubyOnRails
[14:04:54] drbayer: has joined #RubyOnRails
[14:05:36] vasilakisFiL: has joined #RubyOnRails
[14:05:43] rgtk: has joined #RubyOnRails
[14:05:46] vasilakisFiL: what's the difference between http://api.rubyonrails.org/classes/ActiveRecord/QueryMethods.html#method-i-extending and ruby extend ?
[14:07:11] rvanlieshout: that you can call that first one on a collection
[14:07:14] sevenseacat: has joined #RubyOnRails
[14:08:15] tvw: has joined #RubyOnRails
[14:08:53] toomus: has joined #RubyOnRails
[14:08:59] Guest53: has joined #RubyOnRails
[14:09:13] cfinley: has joined #RubyOnRails
[14:10:08] youngbaks: has joined #RubyOnRails
[14:11:12] MartinElvar: has joined #RubyOnRails
[14:12:04] toomus: I have question about eager loading
[14:12:32] allyraza: has joined #RubyOnRails
[14:12:59] toomus: exactly about preloading polymorphic associations
[14:13:21] dllnl: has joined #RubyOnRails
[14:13:52] CodingWolf: has joined #RubyOnRails
[14:14:19] toomus: I know I can do SomeModel.includes(:some_polymorphic_association)
[14:15:17] toomus: No, wait eg. SomeModel.where(some_column: "some_value").includes(:some_polymorphic_association)
[14:15:29] maxz: has joined #RubyOnRails
[14:15:53] toomus: But how to preload associations of this polymorphic model?
[14:16:00] ramortegui: has joined #RubyOnRails
[14:16:18] __desmondhume: you mean nested associations?
[14:16:32] __desmondhume: like PolymorphicModel has_many :anotherModel ?
[14:16:33] toomus: __desmondhume: yes
[14:16:34] filipechagas: has joined #RubyOnRails
[14:16:54] __desmondhume: SomeModel.where(some_column: "some_value").includes(some_polymorphic_association: [:nested_association])
[14:16:57] __desmondhume: should work fine
[14:17:52] __desmondhume: of course, being that an array, you can do fancy stuff like .includes(some_polymorphic_association: [:nested_association, :such_associated], :omg_related)
[14:18:09] blackmesa: has joined #RubyOnRails
[14:18:11] toomus: __desmondhume: hmmm OK, but what if there are few polymorphic models, and each has another association?
[14:18:18] filipechagas: has joined #RubyOnRails
[14:18:43] toomus: I mean one has eg. author, second has founder, third has user etc?
[14:18:52] pawnbox_: has joined #RubyOnRails
[14:18:56] fschuindt1: has joined #RubyOnRails
[14:19:33] toomus: is it possible to preload something like this?
[14:19:34] __desmondhume: you mean you have several polymorphic models, each one related to a different model?
[14:19:44] mag42c: has joined #RubyOnRails
[14:19:47] toomus: __desmondhume: yes :)
[14:19:52] __desmondhume: the model is polymorphic, so you should have some sort of :subject
[14:20:01] __desmondhume: being it author, user, founder
[14:20:06] __desmondhume: doesn't matter
[14:20:53] __desmondhume: how does your polymorphic model look like? I mean, the belongs_to/has_many symbol
[14:21:30] infamos: has joined #RubyOnRails
[14:21:47] toomus: eg. belongs_to :author, class_name: "User"
[14:21:49] momomomomo: has joined #RubyOnRails
[14:21:57] __desmondhume: ok, but this is not polymorphic
[14:22:41] __desmondhume: if you want it to be polymorphic, you have to delegate the "self-identifying" job to the parent model
[14:22:51] __desmondhume: so let's say you have this Post polymorphic model
[14:23:01] __desmondhume: which can belong to several type of Users
[14:23:20] __desmondhume: you would have `belongs_to :owner, polymorphic: true` in your Post polymorphic model
[14:23:46] __desmondhume: and then, for Author, User, Founder etc models, you have to set
[14:23:55] __desmondhume: `has_many :posts, as: :owner`
[14:24:04] ubersapiens: has joined #RubyOnRails
[14:25:01] __desmondhume: rails will then link the dots by itself, as usual
[14:25:23] __desmondhume: and will basically fill the `owner_type` and `owner_id` columns accordingly
[14:25:34] lacrymology: has joined #RubyOnRails
[14:25:36] cfinley: that good 'ole Rails ~magic~
[14:26:00] toomus: __desmondhume: I know what you mean
[14:26:05] toomus: __desmondhume: but
[14:26:17] based_pdev_: has joined #RubyOnRails
[14:26:34] null__: has joined #RubyOnRails
[14:27:02] null__: has joined #RubyOnRails
[14:27:03] __desmondhume: the includes would then look like User.includes(posts: [:owner])
[14:27:07] __desmondhume: (if it makes sense :D )
[14:27:44] toomus: __desmondhume: I have some model, which has associated few polymorphic models, and each of associated model has author or owner or founder
[14:28:19] toomus: and I want to preload each of model with author, owner or founder
[14:28:45] rclanan_: has joined #RubyOnRails
[14:28:46] __desmondhume: so the polymorphic model is not polymorphic towards the author/owner/founder
[14:28:51] sarink: has joined #RubyOnRails
[14:29:22] toomus: author, owner and found is class User
[14:29:33] lacrymol1gy: has joined #RubyOnRails
[14:29:53] __desmondhume: ok, but your polymorphic model belongs_to :author, class: "User"
[14:30:02] __desmondhume: which means it's not polymorphic towards author
[14:30:12] __desmondhume: because you're already specifying a class
[14:30:59] __desmondhume: it means that you basically have an author_id column in the table of this polymorphic table
[14:31:55] toomus: __desmondhume: thx for your time and help, but my brain have enaugh for today ;) I will back tomorrow :)
[14:32:20] njero: has joined #RubyOnRails
[14:32:24] __desmondhume: toomus: ok :') let me know if I'm just not getting the point :)
[14:33:22] The_Phoenix: has joined #RubyOnRails
[14:33:43] cfinley: Polymorphic relations in Rails can be super tricky. I often get to that point and just decide on a different strategy.
[14:34:31] __desmondhume: cfinley: i agree, but I've found myself achieving pretty weird stuff with them, and avoiding creating tons of fields and relations between models
[14:34:53] cfinley: It does keep the tables cleaner for sure.
[14:35:02] cfinley: and models for that matter
[14:36:16] __desmondhume: I once used this kind of approach for a Label
[14:36:17] Scient: whats tricky about them
[14:36:30] Scient: its a regular relation, with a dynamic class name
[14:36:58] erichu: has joined #RubyOnRails
[14:37:10] SPYGAME: has joined #RubyOnRails
[14:37:11] __desmondhume: it is in fact, but if you have many to many through a polymorphic model
[14:37:34] __desmondhume: this kind of relation can get tricky, at least in a first time, when you have to setup models
[14:37:46] __desmondhume: especially guessing the "automagic" naming of rails
[14:40:49] darrencauthon: has joined #RubyOnRails
[14:41:03] th0m_: has joined #RubyOnRails
[14:42:43] norc_: has joined #RubyOnRails
[14:42:59] drbayer: has joined #RubyOnRails
[14:43:10] t4nkD: has joined #RubyOnRails
[14:44:37] norc: I am using this simple_form. However, if no radio button is selected, I do not get params[:call_survey] (which fails my strong params.require(:call_survey) http://pastie.org/10548587
[14:44:56] norc: What is the right approach here? Can I force the form to submit that key anyway? Or should I include a hidden tag?
[14:45:08] dtordable: has joined #RubyOnRails
[14:45:17] mostlybadfly: has joined #RubyOnRails
[14:46:00] Tempesta: has joined #RubyOnRails
[14:46:06] defsdoor: norc, set it in the controller if it's not posted
[14:46:24] norc: defsdoor: That would defy the point of my strong params requiring that.
[14:46:29] dtordable: do all hear me?
[14:46:35] rvanlieshout: norc: you could permit it and not require it
[14:46:49] rvanlieshout: dtordable: yes
[14:47:09] defsdoor: norc, params.require isnt validation
[14:47:16] funnel: has joined #RubyOnRails
[14:47:22] dtordable: ah, ok, thanks
[14:47:39] __desmondhume: also, does anyone know an elegant way to have default params?
[14:47:41] norc: rvanlieshout: guess I could. Though I really would prefer an empty hash :)
[14:47:47] stannard: has joined #RubyOnRails
[14:47:48] __desmondhume: I know grape has a good way to handle this
[14:48:05] defsdoor: if your form allows no radio selection why are you insisting it's present ?
[14:48:11] eggoez: has joined #RubyOnRails
[14:48:17] __desmondhume: but I often find myself doing shitty stuff like params.fetch(:lol) { 'default_value' }
[14:48:48] rvanlieshout: norc: then add a hidden input before
[14:48:54] melter: has joined #RubyOnRails
[14:49:06] rvanlieshout: __desmondhume: params[:foobar] || :default
[14:50:10] rvanlieshout: or if you don't even want to allow ""
[14:50:13] norc: rvanlieshout: Mmm. Is that just HTML behaviour then?
[14:50:13] __desmondhume: this is pretty different
[14:50:15] rvanlieshout: params[:foobar].presence || 'default'
[14:50:21] __desmondhume: params[:foobar] || :default is not params.fetch
[14:50:31] Scient: params.fetch(:foobar, "default")
[14:50:32] __desmondhume: params[:foobar] could be false and it would default
[14:50:34] umgrosscol: has joined #RubyOnRails
[14:50:44] stannard: has joined #RubyOnRails
[14:50:46] nfk|laptop: has joined #RubyOnRails
[14:50:55] __desmondhume: params[:foobar].presence would return true the same way
[14:51:05] __desmondhume: i think fetch is the best way to go, even if the block is "expensive"
[14:51:13] aamax: has joined #RubyOnRails
[14:51:16] rvanlieshout: yeah, didn't know was that it was about true or false
[14:51:19] rvanlieshout: but what Scient wrote
[14:51:42] __desmondhume: the other way could be (params[:lol].present?) ? params[:lol] : 'default'
[14:51:46] __desmondhume: but fetch is more concise
[14:52:16] theblang: has joined #RubyOnRails
[14:52:53] __desmondhume: yeah Scient is correct if the value does not need fancy stuff
[14:53:04] bruno-: has joined #RubyOnRails
[14:53:25] owenjones: has joined #RubyOnRails
[14:53:37] nibbo: has joined #RubyOnRails
[14:53:38] __desmondhume: https://github.com/ruby-grape/grape#parameter-validation-and-coercion
[14:53:42] __desmondhume: i like this so much
[14:54:23] __desmondhume: now, that's way too much stuff for average rails use case, but it'd be good to use validation/coercion in controllers actions
[14:54:38] __desmondhume: I usually do this in before_action callbacks
[14:54:49] __desmondhume: but this dsl-ish way is more elegant and clean
[14:55:00] ubersapiens: has joined #RubyOnRails
[14:55:37] n1ck7: has joined #RubyOnRails
[14:56:38] rvanlieshout: i find it quite some overhead where that fetch or || would do fine
[14:57:11] stannard: has joined #RubyOnRails
[14:57:30] __desmondhume: rails has enough sugar on its own lol
[14:58:48] futilegames: has joined #RubyOnRails
[14:58:51] RegulationD: has joined #RubyOnRails
[14:59:06] jkamenik1: has joined #RubyOnRails
[15:00:00] aamax: hi all. I'm seeing a really weird thing I haven't seen before. Rails 4.2.1, ruby 2.2.2p95. in my views and in rails console all DateTime fields show up as nil. but in psql the values are fine. this include created_at fields etc.... I don't see this in my other apps (probably not same rails version) and it's got me scratching my head. any ideas?
[15:00:30] rvanlieshout: aamax: !gist model, controller, view, log output and generated html
[15:00:30] helpa: aamax: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[15:01:25] daivyk: has joined #RubyOnRails
[15:01:36] aamax: rvanlieshout, I will make a gist for it - there's nothing special here and it applies to all my models across the system. basic user model with devise for example...
[15:01:52] rvanlieshout: and in a console?
[15:01:56] rvanlieshout: how are you displaying them in the view?
[15:02:05] stannard: has joined #RubyOnRails
[15:02:06] sarink: has joined #RubyOnRails
[15:02:10] lindii_: has joined #RubyOnRails
[15:03:04] dionysus69: has joined #RubyOnRails
[15:03:45] alex88: has joined #RubyOnRails
[15:03:51] fschuindt: has joined #RubyOnRails
[15:03:53] arthurix: has joined #RubyOnRails
[15:04:58] aamax: Here's the gist (and thanks for looking) https://gist.github.com/aamax/8183d7df1415f87defbc
[15:05:43] aamax: in the console - just do SystemLog.first and look at what is returned. you can see how I do it in the index in my gist
[15:06:04] mary5030: has joined #RubyOnRails
[15:06:11] aamax: in other projects, the console shows the values fine. and I've never had trouble in views with this either... very odd
[15:06:38] rvanlieshout: so it also doesn't work in the console?
[15:06:53] aamax: rvanlieshout, yes, it shows nil in rails console too
[15:07:18] rvanlieshout: and the full output for your console session?
[15:07:19] aamax: rvanlieshout, but if i go into postgres using psql and query the fields - they show up fine and have values
[15:07:27] mary5030: has joined #RubyOnRails
[15:07:42] aamax: rvanlieshout, can't find anything like it googling so far
[15:08:29] momomomomo: has joined #RubyOnRails
[15:08:32] shapeshifter: Hi. I have some a decorator which is definitely working (it adds an after_action), yet it also adds an include and it seems like it doesn't have any effect. How can I debug this? Can I somehow use the rails console to see if the include is present or something?
[15:08:40] aamax: __desmondhume, very. It's probably something really stupid I'm doing of course
[15:09:00] rvanlieshout: aamax: can you gist that console output?
[15:09:23] agoldboi: has left #RubyOnRails: ()
[15:10:13] aamax: sure... I updated it with the output
[15:10:23] aamax: rvanlieshout, updated...
[15:10:57] rvanlieshout: and just using the pg gem?
[15:10:58] aamax: rvanlieshout, this has been built quickly using scaffolding - nothing fancy
[15:11:03] aamax: rvanlieshout, yes
[15:11:42] aamax: rvanlieshout, and the symptom is across my whole project. All models. I haven't found any that show datetime values
[15:12:22] rvanlieshout: did you configure local timezone?
[15:13:05] rvanlieshout: or do you have a config.active_record.default_timezone?
[15:13:10] rvanlieshout: in your config/application.rb
[15:13:56] aamax: rvanlieshout, oops... yes I did. I wondered if that might be related. now that you mention it, it probably is. I extended the gist to include the relevant part of the application.rb
[15:14:20] ynonp: has joined #RubyOnRails
[15:14:37] rvanlieshout: you might need to use :local for that second line
[15:14:39] rvanlieshout: or just remove it
[15:14:48] rvanlieshout: there are good reasons to store times in utc in the db
[15:15:24] joshkovach: has joined #RubyOnRails
[15:15:46] i: has joined #RubyOnRails
[15:16:01] pawnbox_: has joined #RubyOnRails
[15:16:44] aamax: rvanlieshout, hmmm....OK. I commented it out and now the dates show up correctly. I'm going to have to visit some of the logic I have that is doing a calc on time...
[15:17:14] dopie: has joined #RubyOnRails
[15:17:22] aamax: rvanlieshout, Thanks. I knew it was something stupid like that. any idea why that messes things up so badly?
[15:17:27] pawnbox_: has joined #RubyOnRails
[15:17:38] orolo: has joined #RubyOnRails
[15:18:24] aamax: rvanlieshout, well you definitely got me over the hump. Thanks!
[15:19:05] rvanlieshout: another day completed. back tomorrow
[15:19:34] centrx: has joined #RubyOnRails
[15:19:42] axl_: has joined #RubyOnRails
[15:19:51] __desmondhume: what?? cest and leaving at 4:20?
[15:20:12] alex88: has joined #RubyOnRails
[15:20:15] momomomomo: what is cest
[15:20:27] griffindy: has joined #RubyOnRails
[15:20:31] rvanlieshout: yeah. started early enough :)
[15:20:33] __desmondhume: central european summer time
[15:20:41] __desmondhume: aka it's 4pm here in europe lol
[15:20:42] rvanlieshout: oh right.. we're at cet now
[15:20:52] __desmondhume: good rvanlieshout
[15:20:56] __desmondhume: see you tomorrow then :D
[15:22:01] alex88_: has joined #RubyOnRails
[15:23:11] rclanan: has joined #RubyOnRails
[15:23:51] naftilos76: has joined #RubyOnRails
[15:24:19] eyck: has joined #RubyOnRails
[15:24:25] rclanan: has joined #RubyOnRails
[15:25:02] __desmondhume: has joined #RubyOnRails
[15:25:58] naftilos76: Hi, rails 4.2 creates a server.pid file in ../tmp/pids dir but i cannot find any pid in case of rails 2.1.1 . Does anybody remember if rails 2.x creates a pid when running with webrick?
[15:26:21] HalcyonicStorm: has joined #RubyOnRails
[15:26:39] jgpawletko: has joined #RubyOnRails
[15:27:00] kerunaru: has joined #RubyOnRails
[15:28:21] EminenceHC: has joined #RubyOnRails
[15:28:38] goodcodeguy: has joined #RubyOnRails
[15:29:10] jkamenik: has joined #RubyOnRails
[15:30:14] infamos: has joined #RubyOnRails
[15:31:07] alex88: has joined #RubyOnRails
[15:31:07] d08z: has joined #RubyOnRails
[15:31:19] d08z: does anyone know how to get rid of: Warning: Running `gem pristine --all` to regenerate your installed gemspecs (and deleting then reinstalling your bundle if you use bundle --path) will improve the startup performance of Spring.
[15:31:35] __desmondhume: gem pristine --all
[15:31:36] d08z: (of course i did try gem pristine --all ....)
[15:32:07] d08z: i have read each SO post on the subject to no avail
[15:32:55] DEA7TH: has joined #RubyOnRails
[15:35:18] teclator: has joined #RubyOnRails
[15:35:29] craigp_: has joined #RubyOnRails
[15:35:49] kies: has joined #RubyOnRails
[15:36:29] waka: has joined #RubyOnRails
[15:36:33] d08z: anyone? :)
[15:36:35] mloy: has joined #RubyOnRails
[15:37:55] joshkovach: has joined #RubyOnRails
[15:38:45] SteenJobs: has joined #RubyOnRails
[15:38:48] roxtrongo: has joined #RubyOnRails
[15:39:53] guillaume-rb: has joined #RubyOnRails
[15:40:07] baweaver: has joined #RubyOnRails
[15:41:26] kitsuneyo: has joined #RubyOnRails
[15:41:30] veloutin: in rails 3.1, is it normal that errors using url_for in templates cause 404 errors instead of 500 ?
[15:43:19] krz: has joined #RubyOnRails
[15:43:20] Fire-Dragon-DoL: has joined #RubyOnRails
[15:44:33] alex88_: has joined #RubyOnRails
[15:45:17] disgrntld: has joined #RubyOnRails
[15:45:20] haltEnigma: has joined #RubyOnRails
[15:46:50] freezevee: has joined #RubyOnRails
[15:47:34] guillaume-rb: has joined #RubyOnRails
[15:48:07] sinkensabe: has joined #RubyOnRails
[15:48:16] codeurge: has joined #RubyOnRails
[15:48:25] kitsuneyo: suppose i have a controller with URLs localhost/country/state/city. but some of my location records don't have a state. i'm not sure how to deal with that. do i just save a dummy value like 'no_state' for all the records with no state, or is there a better way?
[15:48:35] fedexo: has joined #RubyOnRails
[15:49:12] kitsuneyo: routes, not controller
[15:49:37] johnflux_: has joined #RubyOnRails
[15:49:37] johnflux_: has joined #RubyOnRails
[15:51:40] codeurge: has joined #RubyOnRails
[15:52:50] dllnl: has joined #RubyOnRails
[15:53:09] polishdub: has joined #RubyOnRails
[15:54:10] owenjones: has joined #RubyOnRails
[15:54:22] The_Phoenix: has joined #RubyOnRails
[15:59:29] veloutin: kitsuneyo: you could route /country/city
[15:59:40] lacrymology: has joined #RubyOnRails
[15:59:50] kitsuneyo: thanks veloutin, can you do conditional routing like that?
[16:00:08] kitsuneyo: could i still route country/state for locations with a state value?
[16:00:33] kitsuneyo: ideally i wanna do both
[16:01:37] smathy: has joined #RubyOnRails
[16:01:39] veloutin: kitsuneyo: I don't see why you couldn't have /country/state/city search in country/state/city and the other serach with state nil
[16:03:09] alex88: has joined #RubyOnRails
[16:03:25] infamos: has joined #RubyOnRails
[16:04:42] bricker: has joined #RubyOnRails
[16:05:48] naftilos76: where can i find evidence of a rails 4.2 app running with passenger/apache? Is there a pid file in the rails tree (not found so far) or a pid created by passenger?
[16:05:52] kitsuneyo: then how does the URL look for the show action of a record with state value nil?
[16:06:16] rgtk: has joined #RubyOnRails
[16:08:36] cschneid_: has joined #RubyOnRails
[16:08:41] baweaver: has joined #RubyOnRails
[16:09:46] Yomero3: has joined #RubyOnRails
[16:10:05] DanielN: has joined #RubyOnRails
[16:11:00] pawnbox_: has joined #RubyOnRails
[16:12:13] Guest53: has joined #RubyOnRails
[16:12:58] matthewd: veloutin: That does sound somewhat familiar
[16:13:34] chouhoul_: has joined #RubyOnRails
[16:14:50] alex88_: has joined #RubyOnRails
[16:16:13] sebstrax: has joined #RubyOnRails
[16:16:16] jahbrewski: has joined #RubyOnRails
[16:17:57] bruno-: has joined #RubyOnRails
[16:18:52] tubbo: naftilos76: ps -ef | grep Passenger
[16:19:19] Rodya_: has joined #RubyOnRails
[16:19:25] baweaver: has joined #RubyOnRails
[16:19:59] naftilos76: tubbo, figured it out with pgrep -f .....
[16:20:25] bmalum_: has joined #RubyOnRails
[16:20:31] haltEnigma: has joined #RubyOnRails
[16:22:27] nfk|laptop: has joined #RubyOnRails
[16:23:12] guillaume-rb: has joined #RubyOnRails
[16:23:42] vasilakisFiL: I have a query that I apply order BY and takes 5 seconds, and another without the order by and takes 0.08 seconds
[16:23:47] vasilakisFiL: why such a big difference ?
[16:23:52] vasilakisFiL: https://gist.github.com/vasilakisfil/66d91ec835419cd6105a
[16:24:08] vasilakisFiL: maybe it's not the right channel but any help appreciated
[16:24:12] tubbo: naftilos76: ooh, didn't know about pgrep...makes things a lot easier :)
[16:25:26] pawnbox_: has joined #RubyOnRails
[16:25:29] EminenceHC: has joined #RubyOnRails
[16:26:06] pawnbox_: has joined #RubyOnRails
[16:26:18] blackmesa: has joined #RubyOnRails
[16:27:18] alb12: has joined #RubyOnRails
[16:27:18] Fire-Dragon-DoL: has joined #RubyOnRails
[16:27:46] polishdub: has joined #RubyOnRails
[16:29:25] matthewd: vasilakisfil: Does analyzing your tables help?
[16:29:40] matthewd: The row estimates on followings are pretty far off
[16:30:07] __desmondhume: index on the order_by column?
[16:30:34] vasilakisFiL: I have index there
[16:30:53] guillaume-rb: has joined #RubyOnRails
[16:31:06] vasilakisFiL: maybe running a vacuum would help
[16:32:48] hashpuppy: has joined #RubyOnRails
[16:33:38] __desmondhume: (i'm not an expert of db, but i'm interested to know more)
[16:35:01] vasilakisFiL: it will take about a couple of hours since I have millions of rows
[16:35:07] vasilakisFiL: btw this helped a lot: SELECT * from (SELECT "users".* FROM "users" INNER JOIN "followings" ON "users"."id" = "followings"."user_id" WHERE "followings"."following_id" = 3198216 AND ((followings.user_id = 3198216 OR followings.following_id = 3198216) OR followings.state = 'approved') LIMIT 50 OFFSET 0 ) AS T1 ORDER BY username;
[16:35:15] vasilakisFiL: but how do you run that in rails? :O
[16:35:24] centrx: vasilakisfil, Look up "composite index", an index on multiple columns
[16:35:52] annlewis: has joined #RubyOnRails
[16:36:46] matthewd: vasilakisfil: That has a very different result
[16:37:24] nfk: has joined #RubyOnRails
[16:37:29] andrepollard: has joined #RubyOnRails
[16:37:51] vasilakisFiL: yes indeed you are right
[16:38:09] vasilakisFiL: centrx which columns do you suggest ?
[16:38:14] __desmondhume: because it's ordering after the limit 50, right?
[16:38:20] vasilakisFiL: what am I saying, you have no idea :)
[16:38:56] __desmondhume: i can't get the point of ` WHERE "followings"."following_id" = 3198216` AND `... OR followings.following_id = 3198216`
[16:40:05] centrx: yeah it's definitely a weird query
[16:40:28] __desmondhume: is it generated from AR?
[16:40:36] centrx: vasilakisfil, You can make an index tailored for this query, but you have to keep in mind the big picture of all the queries that run on the tables
[16:40:36] matthewd: It seems unremarkable to me
[16:40:54] matthewd: Has anyone read the explain?
[16:41:10] matthewd: The right indexes already exist. As does at least one multi-column index.
[16:41:18] Maletor: has joined #RubyOnRails
[16:41:31] __desmondhume: couldn't it be it's just a slow query because of the huge table?
[16:41:38] matthewd: The problem is the statistics on the index are wrong... hopefully an analyze will fix it; otherwise you may need to bump the statistics targets.
[16:41:46] dopie: has joined #RubyOnRails
[16:42:03] Cache_Money: has joined #RubyOnRails
[16:42:38] lemur: has joined #RubyOnRails
[16:43:57] roxtrongo: has joined #RubyOnRails
[16:45:05] andrepollard: has joined #RubyOnRails
[16:45:11] conanbatt: has joined #RubyOnRails
[16:45:32] mostlybadfly: has joined #RubyOnRails
[16:45:33] marr: has joined #RubyOnRails
[16:46:00] SteenJobs: has joined #RubyOnRails
[16:46:25] krz: has joined #RubyOnRails
[16:46:26] lacrymology: has joined #RubyOnRails
[16:47:08] DoubleMalt: has joined #RubyOnRails
[16:47:42] lacrymology: when I get an extra column with a scope like select("device_groups.*, COUNT(device_groups_devices.id) as device_count") I actually get an attribute on the object, device_group.device_count
[16:48:05] lacrymology: The thing is that I want to test for existence of that field
[16:48:49] DoubleMalt: has joined #RubyOnRails
[16:49:03] lacrymology: I tried read_attribute(:device_count) and it's not working
[16:49:27] Ergo^: has joined #RubyOnRails
[16:49:43] __desmondhume: try adding a attr_readable :device_count
[16:50:19] matthewd: lacrymology: respond_to?
[16:50:55] matthewd: Though I guess I don't see why read_attribute wouldn't do what you want too ??\_(???)_/??
[16:51:08] Foss_: has joined #RubyOnRails
[16:51:59] njero: has joined #RubyOnRails
[16:52:24] simplyianm: has joined #RubyOnRails
[16:52:24] dllnl_: has joined #RubyOnRails
[16:52:30] Cervajz: has joined #RubyOnRails
[16:53:08] lacrymology: matthewd: respond_to doesn't seem to be present on the instance
[16:53:10] lacrymology: just the class
[16:53:16] lacrymology: unless... let me see
[16:54:04] lacrymology: matthewd: I'd forgotten the ?
[16:54:18] mikecmpbll: eugh, if anyone uses redis in production, read this: http://antirez.com/news/96
[16:54:51] wldcordeiro: has joined #RubyOnRails
[16:54:51] mikecmpbll: i set up redis by following their instructions, on their website, and it made no mention that the default configuration is completely fucking insecure.
[16:55:26] [Butch]: has joined #RubyOnRails
[16:55:28] mikecmpbll: now, instead of making it secure, maintainer decides to just tell everyone it's insecure instead.
[16:56:51] dopie: has joined #RubyOnRails
[16:57:22] njero: that's ridiculous.. however he got the balls to say it and attract solutions :)
[16:57:39] mikecmpbll: the solution is pretty obvious, don't bind to all interfaces by default :/
[16:58:38] veloutin: rescue_from Exception, with: lambda { |exception| render_error 500, exception }
[16:58:39] mikecmpbll: not much fun sshing on to your server to find you no longer have sudo access
[16:58:41] veloutin: rescue_from ActionController::RoutingError, ActionController::UnknownController, ::AbstractController::ActionNotFound, ActiveRecord::RecordNotFound, with: lambda { |exception| render_error 404, exception }
[16:58:45] erbse: memcached even not have password authentication, bind to localhost is the correct way
[16:58:53] mikecmpbll: then spending the next 5 hours trying to work out why.
[17:00:00] SteenJobs: has joined #RubyOnRails
[17:00:34] atlantaman: has joined #RubyOnRails
[17:01:11] towski_: has joined #RubyOnRails
[17:01:23] Axsuul: has joined #RubyOnRails
[17:02:08] veloutin: mikecmpbll: this incident will be reported ;)
[17:02:54] SteenJobs: has joined #RubyOnRails
[17:03:11] mikecmpbll: reported to the dude who just connected to my redis instance and wrote over my authorized_keys file, probably
[17:03:53] Foss_: has joined #RubyOnRails
[17:05:30] tubbo: that sucks
[17:06:59] conanbatt: I have an issue preloading 2 instances of the same model with the class level utility preload_associations: they dont load associations on both objects. : https://gist.github.com/conanbatt/28542a0dce95726aeb60
[17:07:02] bmalum: has joined #RubyOnRails
[17:07:22] mikecmpbll: seriously though, networked server software that isn't secure by default
[17:07:50] safety_cut: has joined #RubyOnRails
[17:07:56] __desmondhume: but is it a redis concern?
[17:08:07] __desmondhume: I mean, that level of security
[17:08:07] bricker: has joined #RubyOnRails
[17:08:13] dsimon: better to have a conservative firewall in general
[17:08:14] creature: "I put a server on the public internet, and all I got was this lousy rootkit."
[17:08:35] __desmondhume: or is it delegated to conscious devops?
[17:09:11] mikecmpbll: sure you can say that, it's kind of a pointless argument because it doesn't say why that's better than secure by default
[17:09:39] mikecmpbll: however, even if you were to have insecure by default, it'd be a good thing to make that _damned clear_
[17:09:46] troyready: has joined #RubyOnRails
[17:09:47] matthewd: Don't most OS packages include a secure-by-default config?
[17:10:06] mikecmpbll: credit to antirez though he did change the quickstart guide with security info about 15 mins after i commented about it
[17:10:51] creature: I don't know if it's reasonable to expect someone to say "Hold on, I just connected my app to Redis & didn't need a username or password or anything like that. I should check if that's exposed on the internet too..."
[17:10:51] mikecmpbll: matthewd: not sure, i build it myself like _the guide suggests_
[17:11:02] mikecmpbll: "The suggested way of installing Redis is compiling it from sources as Redis has no dependencies other than a working GCC compiler and libc. Installing it using the package manager of your Linux distribution is somewhat discouraged as usually the available version is not the latest."
[17:11:24] tubbo: mikecmpbll: i typically firewall redis so it can't be accessed outside of the app server's subnet.
[17:11:29] tubbo: same with the database
[17:11:39] tubbo: why make it open to the public if your app is the only consumer of its services?
[17:11:50] srinidhi: has joined #RubyOnRails
[17:11:55] mikecmpbll: tubbo: fortunately all our work servers use iptables whitelisting for all connections
[17:12:07] mikecmpbll: one of my personal servers that was hacked :<
[17:12:38] __desmondhume: do you guys know if there's any resource on this kind of setup?
[17:12:49] __desmondhume: I'm looking for some kind of devops checklist to make apps secure
[17:12:52] maxz: has joined #RubyOnRails
[17:13:02] __desmondhume: or, at least, secure at a minimum level :'D
[17:13:31] __desmondhume: I know it's a noob question, but I'm mostly a rails dev, and i have to get devops done on our production servers
[17:13:50] mikecmpbll: nah, many of us are in the same boat.
[17:13:52] SteenJobs: has joined #RubyOnRails
[17:14:29] matthewd: __desmondhume: 1. whitelist the ports you allow external connections on; 2. individually investigate the security implications of exposing each thing you've whitelisted
[17:14:55] creature: I did just have a brief moment of "Oh, hang on, I run Redis on my laptop. I should check that..."
[17:15:02] teclator: has joined #RubyOnRails
[17:15:07] craigp: has joined #RubyOnRails
[17:15:54] lacrymology: how do I add a DB constraint?
[17:16:13] lacrymology: I mean, I gather it's done in migrations, so I guess the question is, how do I add a new migration?
[17:16:17] pawnbox_: has joined #RubyOnRails
[17:16:29] creature: You can use "rails generate migration NameOfMigration".
[17:18:21] slash_nick: lacrymology: what creature gave you will generate an empty migration... see this guide for doing the column operations you're talking about: http://edgeguides.rubyonrails.org/active_record_migrations.html#changing-columns
[17:18:41] slash_nick: so what creature said is step 1, that guide would help with step 2
[17:18:41] momomomomo: has joined #RubyOnRails
[17:19:06] lacrymology: slash_nick: yes, I was reading that, trying to figure out how to make a unique-together migration
[17:19:11] lacrymology: s/migration/constraint/
[17:19:21] dllnl: has joined #RubyOnRails
[17:20:36] atlantaman: has left #RubyOnRails: ()
[17:21:15] slash_nick: lacrymology: what do you mean unique-together?
[17:21:19] CodingWolf: has joined #RubyOnRails
[17:21:30] lacrymology: slash_nick: to make a pair of columns together
[17:21:42] lacrymology: to make a pair of columns to be unique
[17:21:43] Jasaka: has joined #RubyOnRails
[17:21:56] __desmondhume: isn't it a rails feature?
[17:22:15] __desmondhume: don't know if it's implement as a db constraint
[17:22:22] __desmondhume: not in the migrations at least
[17:22:28] slash_nick: __desmondhume: rails does offer server side validations, yes... but he's looking for something at the db
[17:22:40] lacrymology: apparently add_index :table [:one_column, :another_column] should work
[17:22:45] slash_nick: lacrymology: yup
[17:22:56] slash_nick: , unique: true
[17:23:12] __desmondhume: cool, didn't know about this
[17:25:54] lacrymology: add_index :device_groups_device, [:device_group_id, :device_id], unique: true << does this look good? it's for a many to many relation table
[17:26:09] lacrymology: linking device_groups to devices
[17:26:27] tubbo: __desmondhume: just keep up to date with the security news...check out HN...and follow some best practices like using firewalls and whitelisting open ports.
[17:27:06] tubbo: __desmondhume: but yeah, that's why ops people are paid full-time to do this kind of work. they keep up with the news, know how to throw fixes in fast and reliably, and they follow similar sets of best practices to us
[17:27:30] tubbo: your question is similar to asking a rails room "can i just get a list of all possible best practices for all programming languages"
[17:28:09] __desmondhume: yeah, i agree with you, sorry for that
[17:28:42] __desmondhume: i was just asking if there are some *basic* practices to know about when setting up a production machine
[17:29:02] __desmondhume: if you have no ops people in your team
[17:29:36] tubbo: __desmondhume: yeah i mean, i try to firewall as much as possible. so you really can't access the box on anything other than ports 22, 80 and 443.
[17:30:16] __desmondhume: and about database, for example, restricting access to the localhost
[17:30:24] __desmondhume: so that it can't be accessed from the outside, right?
[17:30:53] __desmondhume: oh, i do it by db ports to the public
[17:32:58] __desmondhume: *closing db ports
[17:33:09] tubbo: __desmondhume: correct. you don't want your DB to be accessible to anything that doesn't live on that app server box.
[17:33:26] tubbo: yeah that's about it :)
[17:33:34] __desmondhume: i feel so n00b, gosh...
[17:33:39] tubbo: i mean, there's other stuff you have to take care of but that's the basic 101 of it all
[17:33:54] tubbo: all the other shit is more dependent on your use case
[17:34:12] __desmondhume: "the other shit" is pretty accurate
[17:34:57] mikecmpbll: going to have to do a full security review now
[17:35:14] Or1on: has joined #RubyOnRails
[17:35:14] Or1on: has joined #RubyOnRails
[17:37:24] The_Phoenix: has joined #RubyOnRails
[17:41:04] alb12: has joined #RubyOnRails
[17:41:23] blackmesa: has joined #RubyOnRails
[17:41:30] SteenJobs: has joined #RubyOnRails
[17:42:22] darrencauthon: has joined #RubyOnRails
[17:45:01] roxtrongo: has joined #RubyOnRails
[17:46:03] Fire-Dragon-DoL: has joined #RubyOnRails
[17:46:58] baweaver: has joined #RubyOnRails
[17:47:04] adaedra: why is the sky blue?
[17:47:10] djbkd: has joined #RubyOnRails
[17:47:13] greengriminal: has joined #RubyOnRails
[17:47:18] dtordable: how do I integrate CKEditor in Rails?
[17:47:28] bruno-: has joined #RubyOnRails
[17:47:43] dtordable: seen 2 gems around...
[17:48:22] andrew9184: has joined #RubyOnRails
[17:48:45] kitsuneyo: has joined #RubyOnRails
[17:49:00] benlieb: has joined #RubyOnRails
[17:49:11] shathoma: has joined #RubyOnRails
[17:49:56] shathoma: trying to route to a new action, not working like I thought: https://gist.github.com/codejoy/d4d0e811c0c2e81e7e6d
[17:50:04] shathoma: by new action i mean a diff action
[17:50:28] shathoma: I think I am wrong on how I think the conventions work for naming things.
[17:52:21] shathoma: if I hover over that url its written right (thought I don't want the URL to be written) but hovering over it shows its going to link to /providers/1 not /providers/1/add_location with a params id that I can use to know what to do next in that view.
[17:52:43] EminenceHC: has joined #RubyOnRails
[17:52:49] mrtomme: has joined #RubyOnRails
[17:53:19] jhn: has joined #RubyOnRails
[17:53:33] nickenchuggets: has joined #RubyOnRails
[17:53:47] th0m_: has joined #RubyOnRails
[17:54:42] hahuang65: has joined #RubyOnRails
[17:55:05] lacrymology: I'd like to be able to access device_count by that name whether the records were fetched with .for_customer or not, how can I do that? http://dpaste.com/2D3BH8S
[17:56:15] arup_r: has joined #RubyOnRails
[17:57:00] arup_r: has joined #RubyOnRails
[17:57:24] rhizome: lacrymology: is the spelling intentional?
[17:58:23] recurrence: has joined #RubyOnRails
[17:59:18] lacrymology: rhizome: the g?
[18:00:21] lacrymology: rhizome: it was just to test, to be able to access both the device_count added by for_customer and that method
[18:00:31] User458764: has joined #RubyOnRails
[18:00:41] rakm: has joined #RubyOnRails
[18:00:48] lacrymology: rhizome: that's what I want to fix, actually :)
[18:00:54] SteenJobs: has joined #RubyOnRails
[18:01:02] tubbo: dtordable: use the gems
[18:01:04] matthewd: shathoma: link_to wants two parameters
[18:01:10] tubbo: dtordable: well, use one of the gems. not both.
[18:01:12] railsknight: has joined #RubyOnRails
[18:02:11] dtordable: get the gem and configure it?
[18:02:17] tubbo: dtordable: sure why not
[18:02:28] lacrymology: I've got a plan b: rename the column set by the scope to _device_count
[18:03:03] lacrymology: plan A would be to somehow add it to the model in a way that retrieves the whole thing in a single query
[18:03:08] sonofdirt: has joined #RubyOnRails
[18:03:10] nogic: has joined #RubyOnRails
[18:06:17] romdi: has joined #RubyOnRails
[18:06:39] momomomomo: has joined #RubyOnRails
[18:07:15] goodcodeguy: has joined #RubyOnRails
[18:07:33] colleenmcguckin: has joined #RubyOnRails
[18:11:03] RegulationD: has joined #RubyOnRails
[18:11:36] njero: has joined #RubyOnRails
[18:11:45] seedinger: has joined #RubyOnRails
[18:13:45] yardenbar: has joined #RubyOnRails
[18:14:38] raunicolae: has joined #RubyOnRails
[18:14:59] Megamos: has joined #RubyOnRails
[18:15:07] platzhirsch: Can I do value interpolation on a raw SQL query execution with connection.execute?
[18:15:25] shathoma: thanks matthewd! I just didn't see it and assumed I did something wrong in the routing. When it passes it in, I have it in the controller as params[:id], how do I use that to grab the object again. A find where id=:id seems excessive?
[18:16:05] slash_nick: platzhirsch: did you try it and find it didn't work? or are you asking if it's wise? do you have an example?
[18:16:29] platzhirsch: slash_nick: only thing I have found is to do this beforehand: updates = ActiveRecord::Base.send(:sanitize_sql_array, ["name = ? and category = ?", name, category])
[18:16:42] shathoma: like a faster more elegant way
[18:16:43] platzhirsch: and then pass the values with String interpolation
[18:17:10] platzhirsch: which I find a bit hacky, I like the convenience of find_by_sql where you can define a hash of values in the second array position
[18:17:38] shathoma: i guess im saying is there a quick acessor or helper method... but really I think i just want to read up on the active record querying.
[18:18:43] erbse: has left #RubyOnRails: ()
[18:19:10] manuelmesson: has joined #RubyOnRails
[18:20:04] cfinley: has joined #RubyOnRails
[18:20:34] Foss_: has joined #RubyOnRails
[18:20:59] cac: has joined #RubyOnRails
[18:21:34] SteenJobs: has joined #RubyOnRails
[18:21:46] cnk: has joined #RubyOnRails
[18:21:54] Guest53: has joined #RubyOnRails
[18:22:19] slash_nick: platzhirsch: what's the query you want to write?
[18:22:26] raunicolae: has left #RubyOnRails: ("Once you know what it is you want to be true, instinct is a very useful device for enabling you to know that it is")
[18:23:01] platzhirsch: slash_nick: https://gist.github.com/platzhirsch/98bd5552b503bd9f2af1
[18:23:51] slash_nick: all the colons are where you want interpolation?
[18:25:14] platzhirsch: sanitize is one thing, but it also converts for instance the Date/Time types appropriately
[18:25:34] njero: has joined #RubyOnRails
[18:25:41] njero: hey,,, any idea how to save time(without date) only column for schedules in a day?
[18:25:59] mikecmpbll: has joined #RubyOnRails
[18:26:13] slash_nick: platzhirsch: does the approach in the second code block work for you (http://apidock.com/rails/ActiveRecord/Querying/find_by_sql)?
[18:27:00] platzhirsch: plus_with_duration? slash_nick
[18:27:14] SteenJobs: has joined #RubyOnRails
[18:27:20] platzhirsch: I am on Rails 2.3 unfortunately
[18:27:41] matthewd: platzhirsch: I think I'd write that using AR::Relation#sum... though you'd still need to hand-escape the parameters to LEAST/GREATEST
[18:28:02] matthewd: ... oh. Good luck with that. :)
[18:28:30] platzhirsch: ah there's a select_all which takes bindings
[18:29:20] cac: has joined #RubyOnRails
[18:30:36] njero: i need just time schedule for week day only not a datetime
[18:31:04] shathoma: What does this error mean 'To respond to a custom format, register it as a MIME type first: http://guides.rubyonrails.org/action_controller_overview.html#restful-downloads. If you meant to respond to a variant like :tablet or :phone, not a custom format, be sure to nest your variant response within a format response: format.html { |html| html.tablet { ... } }'
[18:31:13] slash_nick: matthewd: platzhirsch i'd be most worried about escaping variables that a user can pass in... i'd feel much better with interpolating `foo` after `foo = case params[:foo]; when 0; 0; else; 1;end`... then if params[:foo] were `"') OR 1=1--'"` or something, it'd just evaluate to `1`
[18:31:13] shathoma: I got it just by trying to create an object with nothing in it to test my validates in the model.
[18:31:18] slash_nick: sorry so wordy
[18:31:40] cac: has joined #RubyOnRails
[18:31:46] dionysus69: has joined #RubyOnRails
[18:32:24] dllnl: has joined #RubyOnRails
[18:33:51] diegoviola: has joined #RubyOnRails
[18:33:51] aderium: has joined #RubyOnRails
[18:33:56] malcolmva: has joined #RubyOnRails
[18:34:11] njero: has joined #RubyOnRails
[18:34:53] shathoma: maybe cause my view in the form has a few date fields like f.date_field ?
[18:35:38] User458764: has joined #RubyOnRails
[18:35:49] shathoma: bah cut and paste strikes again.
[18:37:27] shathoma: hmmm so I had a few fields as date_field that are text in the database. changed those correctly so now date fields are date fields... but it seems I still get the error above on mime types?! just by trying to create (knowing it will fail i fill nothing out, wanted to see the flash notice that you needed to have first /last name )
[18:38:20] platzhirsch: ActiveRecord::Base.connection.execute ListenEvent.send(:sanitize_sql, (["SELECT started_at FROM listen_events WHERE started_at < ? LIMIT 1", Time.now]))
[18:38:24] platzhirsch: this works, super ugly
[18:39:08] drbayer: has joined #RubyOnRails
[18:39:19] shathoma: my model has validates :first_name, presence: true
[18:39:19] shathoma: , it is causing my mime type issue, i remove it it creates a blank object no matter what i fill out the fields with in the form.
[18:39:25] teclator: has joined #RubyOnRails
[18:39:46] baweaver: has joined #RubyOnRails
[18:39:54] Foss_: has joined #RubyOnRails
[18:40:08] SloggerKhan1: has joined #RubyOnRails
[18:41:31] chubijs: has joined #RubyOnRails
[18:44:07] lemur: has joined #RubyOnRails
[18:45:15] shathoma: ahh old strong parameters
[18:45:48] roxtrongo: has joined #RubyOnRails
[18:46:55] bmalum: has joined #RubyOnRails
[18:47:20] EvilEpoch: has joined #RubyOnRails
[18:52:57] Maletor: has joined #RubyOnRails
[18:53:17] cornerma1: has joined #RubyOnRails
[18:54:29] craigp: has joined #RubyOnRails
[18:54:31] dionysus69: has joined #RubyOnRails
[18:56:04] alex88: has joined #RubyOnRails
[18:56:13] simplyianm: has joined #RubyOnRails
[18:57:03] SteenJobs: has joined #RubyOnRails
[18:57:51] __desmondhume: has joined #RubyOnRails
[18:58:04] shathoma: So my validates ive tested on the model work b ut when working through the view i get errors all detailed here: https://gist.github.com/codejoy/b59f9e8a2187e0449880
[18:58:23] willardg: has joined #RubyOnRails
[18:58:46] kenelliott: has joined #RubyOnRails
[18:59:43] matthewd: shathoma: It's pointing you right at the line with the problem
[18:59:53] dnewkerk: has joined #RubyOnRails
[19:00:35] kies: has joined #RubyOnRails
[19:01:09] DEA7TH: has joined #RubyOnRails
[19:01:36] kenelliott: hello, using rack-cors is there a way to get it to respond with the preflight options request with a 503 status code? I'm working locally to test our front-end application against our servers 'maintenance' mode. Which responds with 503 on all requests including the cors options request at the nginx layer.
[19:02:05] kenelliott: ACTION is not a rails guy
[19:03:22] njero: has joined #RubyOnRails
[19:03:36] kenelliott: or get rails s to respond with 503 for all requests.
[19:04:21] matthewd: kenelliott: You could insert a rack middleware to do it... but wouldn't it be easier to just run up nginx locally?
[19:05:16] kenelliott: been a couple years since I ran an nginx server - sounds easier to me to meddle with the current api.
[19:05:24] kenelliott: but that makes sense.
[19:06:23] ur5us: has joined #RubyOnRails
[19:06:30] matthewd: Maybe https://github.com/tilsammans/rack-maintenance is relevant to your interests
[19:06:33] t4nkD: Just an FYI, the appropriate response is 403
[19:06:37] chrisja: has joined #RubyOnRails
[19:06:43] kenelliott: oh yeah sorry meant 403 :D
[19:06:54] kenelliott: thanks matthewd
[19:07:11] matthewd: No, the appropriate response is 503
[19:07:41] t4nkD: For disallowed preflight option header? Pretty sure you're wrong about that
[19:08:16] matthewd: For "this server is in maintenance mode"
[19:08:17] kenelliott: we are using 503 actually.
[19:09:13] t4nkD: Yeah, 503 is "this server is in maintenance mode" but that's not normally what you'd expect back from an unauthorized CORS request
[19:09:33] matthewd: .. which is the point.
[19:10:03] t4nkD: Yeah, I'm obviously missing information and don't actually care what that is sooooo
[19:10:07] t4nkD: Lets just call this a wash, good talk
[19:11:21] platzhirsch: has left #RubyOnRails: ()
[19:12:38] njero: guys how to handle time(without date) only columns in rails.. is there a way i can save 24 hr format time
[19:13:49] schu: has joined #RubyOnRails
[19:14:32] kitsuneyo: has joined #RubyOnRails
[19:14:40] lagweezle: n_e_o: Don't confuse the value being saved with how it is being formatted for display...
[19:14:48] baweaver: has joined #RubyOnRails
[19:16:45] drbayer: has joined #RubyOnRails
[19:18:21] __desmondhume: n_e_o: is right...I'm currently just saving Time.zone today with the correct 24hr time
[19:18:33] __desmondhume: and hiding the date in the view
[19:18:54] njero: lagweezle: not that.. I'm trying to save open hours for week day,, but when t.time column is specified and fixture give a value 10:00 its throwing mysql statement invalid error with value 3600 trying to insert in time column
[19:19:25] __desmondhume: otherwise you can do weird stuff like saving minutes from the beginning of the day, like 11:30 am => 690 (mins)
[19:19:57] drbayer: has joined #RubyOnRails
[19:19:58] lagweezle: n_e_o: Have the model and fixture available on git, or a gist?
[19:21:21] __desmondhume: oh, didn't know Time was h:m:s
[19:21:47] infamos: has joined #RubyOnRails
[19:22:31] dmarr: if anyone has any ideas https://github.com/hiromipaw/localpic/issues/1 im getting TypeError (0 is not a symbol nor a string): app/controllers/api/v1/pictures_controller.rb:22:in `create' during upload
[19:22:38] sye: has joined #RubyOnRails
[19:23:12] njero: lagweezle: https://gist.github.com/NeoElit/93df9c53d32dd90a62dd
[19:24:06] blackmesa: has joined #RubyOnRails
[19:24:43] rhizome: dmarr: you should probably put somewhere the controller that the error message mentions having an error on line 22
[19:24:54] njero: __desmondhume: so should i save it as datetime and use time part for logic?
[19:25:24] crankharder: has joined #RubyOnRails
[19:25:33] __desmondhume: n_e_o: i'm doing like that, yes
[19:25:36] dmarr: rhizome: in the issue you mean?
[19:25:48] njero: __desmondhume: k
[19:26:13] rhizome: i don't know what "in the issue" means, but your post displays an error message that points to a specific file. do you see that?
[19:26:39] dmarr: oh you want to see whats on line 22 of the controller?
[19:26:41] __desmondhume: also active_admin automatically knows it
[19:26:49] __desmondhume: that datetime == hours + minutes
[19:26:52] sarink: does anyone know where i am supposed to put the capybara.save_and_open_page_path ?
[19:26:58] sarink: or if i don't put one what the deafult is?
[19:27:19] njero: lagweezle: any ideas?
[19:27:37] dmarr: rhizome: https://github.com/marr/localpic2/blob/master/app/controllers/api/v1/pictures_controller.rb#L22 thats the line its complaining about but i don't think its what is throwing the type error
[19:28:09] lagweezle: lagweezle: Just got back to desk. Hmm.
[19:28:28] __desmondhume: n_e_o: are you sure 10:00 is correctly interpreted while parsing fixture?
[19:29:02] manuelmesson: has joined #RubyOnRails
[19:29:41] apotry: has joined #RubyOnRails
[19:29:44] lagweezle: I think __desmondhume are pondering the same thing...
[19:29:47] rhizome: dmarr: Picture.new isn't even saved, so you should probably look in that model, right?
[19:30:08] __desmondhume: Time.zone.parse("10:00") might do the trick
[19:30:12] rhizome: assert Picture.new
[19:30:18] njero: __desmondhume: let me check
[19:31:31] arBmind: has joined #RubyOnRails
[19:31:49] __desmondhume: it's yml, maybe you need some evaluation tag
[19:32:08] __desmondhume: <%= Time.zone.parse("10:00") %>
[19:32:16] Radar: Time.zone.parse would take an entire time, with a date too.
[19:32:24] Radar: Time.zone.parse("2015-11-11 10:00")
[19:32:35] Radar: I don't think it'll work with just a time there.
[19:32:46] __desmondhume: it sets the date to today
[19:32:53] __desmondhume: if you pass just a time string
[19:33:10] njero: __desmondhume: nothing gd..
[19:33:25] lagweezle: http://stackoverflow.com/questions/4350127/rails-dates-time-and-fixtures relates some to the question at hand, but I'm not sure where to look yet for a 'time' thing.
[19:33:32] __desmondhume: i think fixtures do not handle Timezone...
[19:33:34] Radar: Rightio then.
[19:33:40] Guest53: has joined #RubyOnRails
[19:33:49] moei: has joined #RubyOnRails
[19:34:18] __desmondhume: how about <%= Time.now.utc %>
[19:34:27] Megamos: has joined #RubyOnRails
[19:34:39] njero: __desmondhume: Time contains date part rt?
[19:34:55] rclanan: has joined #RubyOnRails
[19:35:06] njero: that's making issue with mysql time
[19:35:25] lagweezle: Oh .. interesting. "YAML.dump Time.now.utc" gives me --> "--- 2015-11-10 19:34:57.486786000 Z\n...\n"
[19:35:27] meoblast001: has joined #RubyOnRails
[19:35:51] __desmondhume: that's correct i guess
[19:36:06] njero: may be i should go ahead and use datetime :(
[19:36:14] __desmondhume: don't give up!
[19:36:21] __desmondhume: if you achieve this i'll switch to time fields too
[19:36:31] njero: __desmondhume: :)
[19:36:33] __desmondhume: the problem here is fixtures
[19:36:41] __desmondhume: they suck so much man...
[19:36:47] willardg: has left #RubyOnRails: ("Textual IRC Client: www.textualapp.com")
[19:36:55] __desmondhume: fire up a rails console
[19:36:55] __desmondhume: and try from there
[19:36:59] dmarr: rhizome: seems ok but i don't know how to pass in an image attachment in the model test
[19:37:17] __desmondhume: 'cause if it's a fixture problem, then you can jump right into 2015 and use FactoryGirl lol
[19:37:28] __desmondhume: just kidding, try from the console btw
[19:38:00] njero: ya.. one sec
[19:38:12] th0m_: has joined #RubyOnRails
[19:39:18] __desmondhume: just noticed that mysql is actually converting that 10:00 into seconds from the beginning of the day as integer lol
[19:39:25] Radar: dmarr: How can I reproduce this issue in your app?
[19:40:28] Radar: Oh I see there's some steps in that issue.
[19:40:30] Radar: let me take a look
[19:40:35] th0m_: has joined #RubyOnRails
[19:40:55] meoblast001: has joined #RubyOnRails
[19:41:18] lagweezle: FactoryGirl is awesome.
[19:41:27] __desmondhume: lagweezle: i agree
[19:41:38] lagweezle: Where the heck are the different model attribute/field types hidden?
[19:41:40] __desmondhume: it has so much sugar i could die for diabete
[19:41:42] Fire-Dragon-DoL: has joined #RubyOnRails
[19:41:47] dllnl: has joined #RubyOnRails
[19:42:04] th0m_: has joined #RubyOnRails
[19:42:15] __desmondhume: you mean how does it know what type each field is?
[19:42:21] matthewd: Pure/date-less time is rarely a good idea, FWIW... TZs, and DST in particular, are likely to hurt you
[19:42:48] __desmondhume: matthewd: i agree
[19:42:58] __desmondhume: full date is never a problem
[19:43:00] njero: :| console is fine
[19:43:05] lagweezle: __desmondhume: Well, kind of. I'm wanting to find out what are available, and what 't.time' actually means for n_e_o's code
[19:43:15] dmarr: Radar: I just updated the readme here as well https://github.com/marr/localpic2
[19:43:18] __desmondhume: man, just drop fixtures
[19:43:22] matthewd: (though at least it's not as bad as timetz... that one's truly crazytown)
[19:43:36] User458764: has joined #RubyOnRails
[19:44:26] __desmondhume: lagweezle: afaik, n_e_o needs to store opening times, so like 9-12 am
[19:44:37] njero: lagweezle: open hour for a weekday like? start_time: 10:00 , end_time: 18:00
[19:44:40] __desmondhume: as opening hour / closing hour
[19:44:54] lagweezle: __desmondhume: I'm not after the fixtures just yet. I'm just trying to figure out what the heck the options for a model's fields are in Rails. What object types are supported w/o neeidng to do my own work on it.
[19:45:17] Radar: dmarr: Works fine for me without the AWS config.
[19:45:25] Radar: I'm about to head off so I don't have time to setup the AWS config.
[19:45:26] Radar: Maybe later.
[19:45:33] Radar: at least that narrows it down a smidge
[19:45:37] __desmondhume: http://stackoverflow.com/a/11894584/1491613
[19:45:42] __desmondhume: lagweezle: there you go
[19:45:49] __desmondhume: the best I could find in months lol
[19:46:01] dmarr: ok thanks Radar
[19:46:06] root_____: has joined #RubyOnRails
[19:47:23] njero: __desmondhume: i ended in same link just 20 mins ago what the heck is the issue with time only thing
[19:47:52] njero: let me kill fixtures LP
[19:48:00] __desmondhume: n_e_o: I think it's just the YML thing
[19:48:15] njero: __desmondhume: yeah
[19:48:50] __desmondhume: i could be wrong, but if the console is fine, probably you can go confident using a decent library for fixtures
[19:48:54] __desmondhume: like FactoryGirl
[19:49:14] __desmondhume: which is plain ruby, so you can evaluate blocks and so on
[19:49:34] dmarr: does silvia puglisi (hiromipaw) hang here?
[19:49:45] __desmondhume: Time fields are always a big pain in the ass
[19:50:15] manuelmesson: has joined #RubyOnRails
[19:50:26] lagweezle: __desmondhume: Damned good link ... why it isn't somewhere obvious in Rails docs somewhere O.o
[19:50:33] seank_: has joined #RubyOnRails
[19:50:35] njero: __desmondhume: yeah.. but i need to change a lot rt? .. time ticking over ma head. can't go with that change.. I'll generate it in the tests itself for now.. Let's see how it goes
[19:50:52] __desmondhume: > I'll generate it in the tests itself for now
[19:51:02] __desmondhume: i hope your test suite is small
[19:51:23] __desmondhume: getting started with factory girl should take too long
[19:51:38] lagweezle: n_e_o: Actually, FactoryGirl doesn't require a lot of work to get working. Go check out https://github.com/thoughtbot/factory_girl_rails
[19:51:40] __desmondhume: *shouldn't lol
[19:52:13] njero: :) .. Yeah. Will check it out
[19:52:23] __desmondhume: yes, it's like 2 mins configuration, and then you just port your fixtures to different files
[19:52:44] njero: __desmondhume: will the same test work on that too?
[19:53:15] __desmondhume: are you using rspec?
[19:53:16] korbenD: has joined #RubyOnRails
[19:53:33] njero: __desmondhume: nope..
[19:53:51] Foss_: has joined #RubyOnRails
[19:53:51] njero: ActiveSupport::TestCase
[19:54:02] arup_r: so can I write the below expression more beautiful way? {a: "", b: ""}.values.all(:blank?) .When all values are blank I want return as 'true` or `false`
[19:54:09] adac: has joined #RubyOnRails
[19:54:43] njero: __desmondhume: minitest yeah
[19:55:09] __desmondhume: arup_r: you're missing a ? and a &
[19:55:16] dtordable: did a migration myself
[19:55:21] __desmondhume: {a: "", b: ""}.values.all?(&:blank?)
[19:55:49] dmarr: I wish i knew what this mean 0 is not a symbol nor a string
[19:55:59] arup_r: I know.. i am asking any shorthand method is there to do the same.. The main question has typo
[19:56:01] colleenmcguckin: has joined #RubyOnRails
[19:56:15] arup_r: sorry for the typo
[19:56:22] __desmondhume: oh sorry, i misread it
[19:56:32] gavit: How do I do the followin: salaries.where(['end_date >=?', requested_date]) with a "or end_date.nil?"
[19:56:42] arup_r: __desmondhume: Yes, I always don't ask quest worst.. sometime though :D
[19:56:48] x-light: has joined #RubyOnRails
[19:57:34] __desmondhume: n_e_o: i'm reading the docs
[19:57:46] __desmondhume: i think you can achieve what you need without porting it to factory girl right now
[19:58:13] arup_r: I checked API nothing is there. Need to do it by hand.. anyway thanks
[19:58:23] njero: __desmondhume: awesome .. which doc are you looking? can i get a link
[19:58:35] hardtail: has joined #RubyOnRails
[19:59:04] __desmondhume: it's the rails official doc
[19:59:06] __desmondhume: http://guides.rubyonrails.org/testing.html
[19:59:19] __desmondhume: got to the "2.3.3 ERB'in It Up" section
[19:59:43] __desmondhume: the same thing you do in the console, parsing the "10:00", can be achieved in rails fixtures
[19:59:50] baweaver: has joined #RubyOnRails
[20:00:20] chouhoulis: has joined #RubyOnRails
[20:00:59] njero: __desmondhume: i tried <%= xx %> thing
[20:01:36] __desmondhume: what did you write exactly?
[20:02:14] njero: __desmondhume: <%= Time.zone.parse("14:00") %>
[20:02:33] __desmondhume: try with <%= Time.parse("14:00") %>
[20:02:40] __desmondhume: i think fixtures have problems with Time.zone
[20:02:57] rhizome: in what way?
[20:03:41] SteenJobs: has joined #RubyOnRails
[20:03:50] njero: __desmondhume: it worked..
[20:03:58] njero: __desmondhume: awesome
[20:04:13] __desmondhume: now, port it to FactoryGirl lol
[20:04:20] Scriptonaut: has joined #RubyOnRails
[20:04:28] njero: __desmondhume: come town.. dinner on me .. lol
[20:04:30] Scriptonaut: does anyone know how I can get the root_url inside a model?
[20:04:34] __desmondhume: read here http://technopragmatica.blogspot.it/2014/01/timezone-in-rails.html
[20:04:36] Scriptonaut: without passing it in from the controller
[20:04:46] arthurix_: has joined #RubyOnRails
[20:05:00] __desmondhume: Scriptonaut: it's not a good practice, but you could just include helpers
[20:05:07] cac: has joined #RubyOnRails
[20:05:24] rhizome: Scriptonaut: you don't want to do that. you think you do, but you don't.
[20:05:35] Scriptonaut: I guess I'll hardcode a few urls then
[20:05:42] tubbo: Scriptonaut: yeah it's called '/' :P
[20:05:46] Scriptonaut: I'm creating short_urls
[20:05:59] tubbo: Scriptonaut: why can't you pass the URL data you need from the view?
[20:06:03] Scriptonaut: and I need to send the service the url I want to shorten
[20:06:33] matthewd: If you're going to use URLs, use the helpers. But models generally shouldn't be dealing with URLs in the first place.
[20:06:34] Scriptonaut: it's an api call
[20:06:41] rhizome: we're doing this four words at a time, ok
[20:06:53] Scriptonaut: I'm making an api call to api.awe.sm
[20:06:59] matthewd: Why in a model?
[20:07:12] Scriptonaut: my_model_instance.short_urls
[20:07:12] rhizome: __desmondhume: don't laugh, look at your scrollback
[20:07:22] Scriptonaut: either returns them if they exist or get's them from awe.sm
[20:07:34] Scriptonaut: I'll hardcode urls for prod, staging, beta, and dev
[20:07:36] Scriptonaut: it's all good
[20:07:40] tubbo: Scriptonaut: here's an example of how i did it with bit.ly https://gist.github.com/tubbo/40683a89fb15d761799d
[20:07:59] rgtk: has joined #RubyOnRails
[20:07:59] roxtrongo: has joined #RubyOnRails
[20:08:22] tubbo: it's incomplete because you can't see Brotherly::Service, just assume that all it does is save a "remote model" (representing the thing created on the service) and then update the "local model" (my AR model) with the newer data.
[20:08:45] __desmondhume: rhizome: i know, sorry, i'll try to condens messages.
[20:10:12] rhizome: the trick is to have an actual thought worth typing
[20:10:48] safety_cut: has joined #RubyOnRails
[20:10:50] __desmondhume: i tend to speak like it's face to face, my fault
[20:11:00] hardtail: has joined #RubyOnRails
[20:12:01] matthewd: shathoma: Read the rules
[20:13:04] matthewd: (particularly, #12)
[20:13:53] drbayer: has joined #RubyOnRails
[20:14:12] dmarr: I thought awe.sm was all but dead
[20:14:49] dmarr: I know most of their devs have left at least..
[20:15:07] Scriptonaut: it probably is
[20:15:15] Scriptonaut: this project I'm working on was very poorly maintained
[20:16:49] tubbo: dmarr: they were acquired.
[20:16:55] tubbo: pretty sure
[20:18:01] baweaver: has joined #RubyOnRails
[20:18:06] shathoma: sorry matthewd I was responding to your earlier pm (i was afk and came back)
[20:18:32] matthewd: I did not PM you
[20:19:33] EminenceHC: has joined #RubyOnRails
[20:19:36] matthewd: shathoma: But, to return to the topic at hand: as I said, it's pointing right at the line
[20:20:09] matthewd: Read the line, with the knowledge that it's telling you there's a problem there, and I'm agreeing with it
[20:21:29] sparr: has joined #RubyOnRails
[20:24:01] yfeldblum: has joined #RubyOnRails
[20:24:04] podman: has joined #RubyOnRails
[20:24:42] yaewa: has joined #RubyOnRails
[20:25:05] czerasz: has joined #RubyOnRails
[20:25:10] shathoma: okay. So it knows it didn't save right, it runs the else block. Say to go back to the new action, since the scaffolding wrote this I didn't think there was an issue with this.
[20:27:24] newb: has joined #RubyOnRails
[20:27:37] bruno-: has joined #RubyOnRails
[20:27:45] moei: has joined #RubyOnRails
[20:27:51] shathoma: oh good lord.
[20:27:52] shathoma: i found it.
[20:28:14] Coldblackice_: has joined #RubyOnRails
[20:28:21] Megamos: has joined #RubyOnRails
[20:31:45] arup_r: I am using pg search gem. I am in trouble. I am trying to search phones with their mac address which contains. But my query giving me only those phones whose number start with 3, but not including any records which has 3 in between. https://gist.github.com/aruprakshit/e874c54e4ecc08eb938f
[20:31:48] shathoma: thanks matthewd! and sorry bout the PM thought it was acting like a mention
[20:31:49] arup_r: how to fix it /
[20:32:42] colleenmcguckin: has joined #RubyOnRails
[20:34:42] rhizome: arup_r: sounds like you could do some reading on what those to_* functions are
[20:36:42] futilegames: has joined #RubyOnRails
[20:36:44] shibabu: has joined #RubyOnRails
[20:37:26] slash_nick: i imagine the point of using the gem is to not think about those details
[20:38:43] arup_r: :) I just went through the README and did what they said.. didn't go deeper.
[20:40:32] arup_r: rhizome: I can use there options with the Gem, and can't probably insert my own sql. still going through the Postgres doc
[20:40:36] slash_nick: arup_r: look at the README again, pay attention to the prefix: true option
[20:40:59] arup_r: yes slash_nick I used it.. because it was doing other wise full word search
[20:41:06] arup_r: I was needed the substring search
[20:41:17] EminenceHC: has joined #RubyOnRails
[20:41:17] slash_nick: well... with prefix: true, and a search for "3", you're only going to get mac addresses that begin with 3
[20:41:56] arup_r: makes sense.. but what is the option to do substring search.. reading the readme again
[20:42:40] indignatio: has joined #RubyOnRails
[20:44:01] blackmesa: has joined #RubyOnRails
[20:44:40] djbkd: has joined #RubyOnRails
[20:44:40] adac: has joined #RubyOnRails
[20:45:03] slash_nick: arup_r: maybe :any_word
[20:45:23] alb12: has joined #RubyOnRails
[20:45:32] slash_nick: you way want trigram vs t_search
[20:45:33] arup_r: :) May be trigram need to be added there http://stackoverflow.com/a/12875764/2767755
[20:45:41] arup_r: yes true you are
[20:45:44] newmanships: has joined #RubyOnRails
[20:46:05] willardg: has joined #RubyOnRails
[20:46:25] arup_r: let me try
[20:46:38] recurrence: has joined #RubyOnRails
[20:46:43] chouhoulis: has joined #RubyOnRails
[20:46:52] arup_r: this whole shits are new.. I will read the full postgres doc to understand this. :/
[20:48:18] colleenmcguckin: has joined #RubyOnRails
[20:48:59] arup_r: no that is not helpful either
[20:49:01] n1ck7: Is it possible to have 2 different directories for controllers/models etc in Rails? I have a legacy app and I want to move the current contents of the app folder into "classic" and have any URL that is namespaced with "classic" use this folder? is it possible?
[20:49:36] arthurix: has joined #RubyOnRails
[20:50:31] smathy: n1ck7, !try
[20:50:31] helpa: n1ck7: Why don't you try it and find out for yourself?
[20:51:13] seank_: has joined #RubyOnRails
[20:51:29] n1ck7: smathy, helpa I've been researching this for hours, all I wanted to know is if someone knew if it's possible to do in Rails
[20:52:21] n1ck7: smathy, helpa What's the purpose of this IRC chat if people can't ask questions like this?
[20:52:30] smathy: n1ck7, and I'm telling you to stop researching and just try it.
[20:52:31] rhizome: n1ck7: that's not a common way to upgrade code
[20:52:58] VeryBewitching: has joined #RubyOnRails
[20:53:19] dtordable: a question: how do I Create an scaffold with an user_id field?
[20:53:57] smathy: n1ck7, seriously it'll take you 20 seconds, `mkdir app/classic && mv app/{controllers,classic}/foos_controller.rb` and then check to see if your foos controller is still working in your app.
[20:54:08] dtordable: has to be a foreign key in the schema
[20:55:02] n1ck7: rhizome, What would you suggest?
[20:55:15] smathy: dtordable, run `rails g model` to see the help, and search for "references"
[20:56:12] rhizome: n1ck7: in-place, though I have also started with a fresh app and copied code over for big version jumps in rails
[20:57:57] Scriptonaut: has left #RubyOnRails: ()
[20:59:28] baweaver: has joined #RubyOnRails
[21:00:01] jahbrewski: has joined #RubyOnRails
[21:00:06] blackmesa: has joined #RubyOnRails
[21:00:33] hahuang65: has joined #RubyOnRails
[21:00:39] lemur: has joined #RubyOnRails
[21:01:17] dtordable: smathy: g scaffold uses the g model types?
[21:03:07] jsrn_: has joined #RubyOnRails
[21:03:14] veloutin: in rails 3.1, is it normal that errors using url_for in templates cause 404 errors instead of 500 ?
[21:03:31] Radar: veloutin: !rule0
[21:03:31] helpa: veloutin: 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.
[21:04:17] max1: has joined #RubyOnRails
[21:05:08] rhizome: veloutin: i would say "no"
[21:05:09] maxscam1: has joined #RubyOnRails
[21:05:13] alex88: has joined #RubyOnRails
[21:05:44] smathy: dtordable, yes.
[21:05:45] maxscam1: is there a way to compare two encrypted passwords for equality? Currently using bcrypt
[21:06:04] kadoppe: has joined #RubyOnRails
[21:06:26] smathy: maxscam1, they're not encrypted, they're hashed, and no - not if they're both hashed.
[21:06:43] dtordable: smathy: cool, thanks
[21:06:46] rhizome: and duplicate passwords should be ok
[21:06:53] smathy: dtordable, you're welcome.
[21:06:58] maxscam1: thank you smathy is this in true general? i thought it would be more secure to pass application secrets this way, in case somebody intercepted the header
[21:07:14] willardg: has left #RubyOnRails: ("Textual IRC Client: www.textualapp.com")
[21:07:38] smathy: maxscam1, "in general" for any hashing system that uses a unique salt for each password hash (which they all should, because not doing so is insecure).
[21:07:48] slash_nick: the whole secret isn't sent in the headers
[21:07:57] maxscam1: smathy: what about client side encryption?
[21:08:17] smathy: maxscam1, encryption is totally different to hashing.
[21:08:31] maxscam1: slash_nick ohh ok. That's important because I'll use secret instead of a custom set ENV
[21:08:34] Avon: has joined #RubyOnRails
[21:08:38] willardg: has joined #RubyOnRails
[21:08:50] slash_nick: maxscam1: what are you trying to get done?
[21:08:59] smathy: maxscam1, !xy :)
[21:09:00] helpa: maxscam1: It seems like you are asking for a specific solution to a problem, instead of asking about your problem. This often leads to bad solutions and increases frustration for you and those trying to help you. More: http://meta.stackexchange.com/a/66378
[21:09:14] infamos: has joined #RubyOnRails
[21:09:27] djbkd: has joined #RubyOnRails
[21:09:52] maxscam1: slash_nick: Server#1 makes a background request to Server#2. I want to make sure this request isn't processed when it comes from elsewhere
[21:10:26] smathy: maxscam1, make the request over SSL and send an API key.
[21:10:42] __desmondhume: has joined #RubyOnRails
[21:10:56] Megamos: has joined #RubyOnRails
[21:12:07] maxscam1: smathy: yeah, I guess that's simple enough. I forgot that I can trust SSL like that. For example I was going to try and encrypt the password parameter in urls, but I realized with HTTPS there's no need
[21:13:33] richipargo: has joined #RubyOnRails
[21:14:53] Foss_: has joined #RubyOnRails
[21:15:05] darrencauthon: has joined #RubyOnRails
[21:16:16] jahbrewski: has joined #RubyOnRails
[21:16:19] northfurr: has joined #RubyOnRails
[21:17:34] quazimodo: has joined #RubyOnRails
[21:17:52] kies: has joined #RubyOnRails
[21:20:00] matthewd: veloutin: Yes, I think so
[21:21:54] wethu: has joined #RubyOnRails
[21:22:05] user1138: has joined #RubyOnRails
[21:23:34] matthewd: veloutin: Found it: https://github.com/rails/rails/pull/16229 -- fixed in 4.2
[21:24:02] Megamos: has joined #RubyOnRails
[21:26:13] Pazician: has joined #RubyOnRails
[21:26:20] rhizome: innerestin
[21:27:10] matthewd: rhizome: Yeah.. NB "normal" != "intended" :D
[21:29:17] alb12: has joined #RubyOnRails
[21:29:28] blackhuey: has joined #RubyOnRails
[21:29:52] vigintas: has joined #RubyOnRails
[21:30:02] Aherin: has joined #RubyOnRails
[21:32:55] maxscam1: has joined #RubyOnRails
[21:33:42] cac: has joined #RubyOnRails
[21:33:48] Megamos: has joined #RubyOnRails
[21:35:00] Foss_: has joined #RubyOnRails
[21:36:44] iamse7en: has joined #RubyOnRails
[21:37:03] pydave6367: has joined #RubyOnRails
[21:37:41] jgpawletko: has joined #RubyOnRails
[21:37:56] Megamos: has joined #RubyOnRails
[21:38:05] veloutin: matthewd: thanks!
[21:39:56] sarink: can anyone help me out with capybara? i am inside a pry session, and i log page.body, i can see an input with name='contest-title', yet when i type, fill_in('contest-title', :with => 'somevalue') it never fills it in...
[21:39:59] sarink: what is happening?
[21:40:00] trosborn: has joined #RubyOnRails
[21:41:11] helpa: 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.
[21:41:12] rhizome: hard to say
[21:41:16] tds5016: has joined #RubyOnRails
[21:41:25] Foss_: has joined #RubyOnRails
[21:41:43] tds5016: hi all. is there a way to set new_record value on a model by hand?
[21:41:53] slash_nick: sarink: my guess is capybara isn't looking for the name property
[21:42:17] tds5016: I have the values fro a record from a database, and I manually create the model object.
[21:42:33] tds5016: the problem is using .new() creates a model that isn't "saved" int he database.
[21:42:38] tds5016: eventhoguh it is.
[21:42:56] tds5016: is there a way to set the @new_record value for a model outside of the model itself?
[21:43:08] slash_nick: tds5016: can you show us some code that produces what you're describing?
[21:43:29] tubbo: tds5016: it's not a "value", it's a method.
[21:43:35] tds5016: TheModel.new(id: 'x')
[21:43:43] tubbo: tds5016: that doesn't save it to the database.
[21:43:47] tds5016: tubbo: you're right. I want to set the @new_record method.
[21:43:51] tubbo: tds5016: why
[21:43:51] slash_nick: tds5016: what about that?
[21:43:53] tds5016: sorry... value*
[21:44:03] tubbo: tds5016: http://guides.rubyonrails.org/active_record_basics.html
[21:44:14] slash_nick: You want `TheModel.new(id: 'x').new_model?` to return true?
[21:44:16] tds5016: slash_nick: I want to make it look like it's a value I got from the database, and not like a new record.
[21:44:24] tds5016: slash_nick: EXACTLY :-)
[21:44:27] tubbo: tds5016: yeah but why
[21:44:36] slash_nick: yeah but why
[21:44:48] tds5016: because I'm using cequel and I have a lower level API I need to use to get the values because....
[21:44:59] tubbo: tds5016: what is 'cequel'?
[21:45:02] tds5016: I need to grab them async in this case. which cequel doesn't yet support.
[21:45:20] tubbo: tds5016: you're not using active_record so whatever we say is irrelevant :P
[21:45:24] tds5016: it's active record like library for cassandra.
[21:45:28] tubbo: tds5016: cequel != active_record. they have different APis.
[21:45:39] tds5016: tubbo: cequel extends from active_model in this case.
[21:45:41] tds5016: and it works the same way.
[21:45:51] Megamos: has joined #RubyOnRails
[21:45:57] tds5016: I just need to know how to manually set the instance variable @new_record from outside of the class.
[21:46:00] tubbo: tds5016: no it doesn't, because afaik active_model does not implement new_record?, that is implemented by active_record.
[21:46:48] slash_nick: http://api.rubyonrails.org/classes/ActiveRecord/Persistence.html#method-i-new_record-3F
[21:46:49] jessemcgilallen: has joined #RubyOnRails
[21:46:50] tubbo: tds5016: you probably can't, because that jeopardizes the integrity of the ORM.
[21:47:04] tds5016: tube this is what I need to do.
[21:47:17] tds5016: It certainly does jeopardize the integrity of the orm.
[21:47:24] tds5016: but in this case its what I need to do.
[21:47:27] tubbo: tds5016: i highly doubt that, i think you need to solve it in a less lazy way.
[21:47:32] tubbo: s/it/your problem
[21:47:59] tubbo: tds5016: if you need to pretend like 'new_record?' is `true` (in your app), you're probably doing something wrong.
[21:48:11] tds5016: tubbo: if there were another for this one; trust me; I would be using it.
[21:48:21] tds5016: tubbo: we definitely are.
[21:48:28] slash_nick: what does it gain you? i didnt understand what's motivating the desire to do this weird thing... it's kind of
[21:48:30] tds5016: because cequel doesn't support everything we need it to.
[21:48:31] helpa: It seems like you are asking for a specific solution to a problem, instead of asking about your problem. This often leads to bad solutions and increases frustration for you and those trying to help you. More: http://meta.stackexchange.com/a/66378
[21:48:41] Anubix: has joined #RubyOnRails
[21:48:50] tds5016: cequel doesn't do async requests.
[21:48:51] tubbo: tds5016: then why not build your own objects on top of Cequel that delegates to the
[21:48:57] vdmo_: has joined #RubyOnRails
[21:48:57] tds5016: we use the datastax driver.
[21:49:10] tds5016: to get the values in this case.
[21:49:25] tds5016: then we create the cequel model from it.
[21:49:37] tds5016: the thing is it's a real model that does already exist....
[21:49:42] tubbo: tds5016: so instead of querying and updating your model class directly, you have something on top of it that will instantiate a new model and persist it without the caller needing to know how it's being persisted/implemented.
[21:49:43] Radar: "I enjoy making my life hard. I have a problem with the thing that I used to make my life hard. Please help?"
[21:49:46] tds5016: we just can't get it the way cequel wants us to.
[21:49:55] n1ck7: I've added a path scope to all of my routes - "path => 'classic'" so everything is accessed like localhost/classic/foo is there any way that I can move everything inside the app directory into a sub folder of app - "app/classic" and have it still route correctly?
[21:49:57] tds5016: I don't want a new model.
[21:50:01] tds5016: that's the thing.
[21:50:05] tubbo: tds5016: you're not thinking outside the box. use the left half of your brain for once.
[21:50:10] sarink: if i am in a pry session and i do a page.find("input[name='whatever']").set('somevalue') and then i do a save_page and open the page in my browser, should i see the value filled in?
[21:50:16] Radar: sarink: So totally weird that you went quiet after we asked you for information to help you.
[21:50:21] rhizome: you want an existing model that returns what for .new_record? false?
[21:50:23] Radar: sarink: anddd there you are.
[21:50:27] tubbo: tds5016: it's not a "new model", it's a class that manipulates your models.
[21:50:28] rhizome: tds5016: ^
[21:50:35] Radar: sarink: I asked you to show code, and you haven't.
[21:50:44] Anubix: I have url for reporting topics like website.com/topic-name/report . When I load it, then its simple marked as REPORTED and in admin i see that. I added data confirm for clicking on Report button (yes/no). But Google or any other bot is going through website and it loads these report urls. So i have all topics reported by the time when bot go index
[21:50:45] Anubix: my web :smile: don't you know how to solve this?
[21:51:06] Radar: Anubix: !ncnh
[21:51:06] helpa: Anubix: If you don't provide any code, it becomes really difficult for us to help you. Providing code to reproduce the problem increases your chances of getting great, accurate help immensely.
[21:51:09] tubbo: Anubix: http://robotstxt.org
[21:51:13] Radar: Anubix: Show us the report links.
[21:51:14] sarink: Radar: happy to show code, but i'm just trying to make sure i'm not misunderstanding how to use the tool, first.
[21:51:29] sarink: maybe there is no problem and i'm just Doing It Wrong
[21:51:30] Radar: sarink: No you shouldn't see the field filled in.
[21:51:36] tds5016: tubbo; that's basically what I'm trying to do.
[21:51:45] tubbo: tds5016: oh cool. so do it :)
[21:51:52] rhizome: Anubix: does data-confirm work without javascript?
[21:52:04] tds5016: rhizome: yup.
[21:52:05] willardg: has joined #RubyOnRails
[21:52:05] seank_: has joined #RubyOnRails
[21:52:06] tds5016: exactly ;-)
[21:52:10] tubbo: tds5016: you can actually make your own class `include ActiveModel::Model` and allow it to "feel" like an AR model, but actually manipulate Cequel classes under the hood
[21:52:14] trosborn: has joined #RubyOnRails
[21:52:18] rhizome: tds5016: isn't that a find?
[21:52:22] tubbo: it's good shit
[21:52:29] recurrence: has joined #RubyOnRails
[21:52:56] Anubix: rhizome: That's good question
[21:53:31] dllnl: has joined #RubyOnRails
[21:53:48] Anubix: tubbo: problem is my url is always www.website.com/name_of_topic/report so i can't use static url to block robots
[21:53:57] wkoszek: has joined #RubyOnRails
[21:54:07] Radar: Anubix: Code or kick. Please choose.
[21:54:07] wkoszek: What are the best options to get a smart Ruby code completion in Vim ? And by smart I mean: so that it'd be contextual, could see methods etc..
[21:54:17] rhizome: Anubix: well what you're supposed to do is use forms to change the database
[21:54:18] Anubix: Radar: I am working on it...
[21:54:28] Radar: Anubix: Please work on it faster. I am not very patient today.
[21:54:36] darrencauthon: has joined #RubyOnRails
[21:54:40] Radar: Anubix: You can spam the channel with as much text as you like. AFTER you show us the code.
[21:54:40] SteenJobs: has joined #RubyOnRails
[21:54:55] dopie: Im getting this error when I'm trying to run a spec feature test... , I'm also using activeadmin
[21:54:55] dopie: https://gist.github.com/staycreativedesign/4fe9cdc7da34c3d796cb
[21:54:58] dopie: what can be the case?
[21:55:03] Radar: wkoszek: did you try https://github.com/vim-ruby/vim-ruby yet?
[21:55:18] Radar: dopie: Table does not exist in the test database yet. Run rake db:test:prepare.
[21:55:43] Radar: relations in postgresql == tables
[21:56:07] Anubix: Radar: It was spamming? one question
[21:56:13] cac: has joined #RubyOnRails
[21:56:15] dopie: worked perfectly ...
[21:56:20] Radar: Anubix: Code. Please.
[21:56:26] Anubix: Radar: You need view or controller or?
[21:56:37] dopie: Radar, what are you adventuring into now?
[21:56:42] Radar: Anubix: I am not patient enough to debate this with you today. The rules are there so that you can get great help quickly. You're disobeying those rules.
[21:56:44] dopie: as in projects?
[21:57:01] johnflux_: has joined #RubyOnRails
[21:57:01] johnflux_: has joined #RubyOnRails
[21:57:14] Radar: dopie: I work at marketplacer.com on sites like bikeexchange.com.au and in my spare time I'm writing https://leanpub.com/multi-tenancy-rails-2 and also shouting at pathetic recruiting attempts by Google Recruiters.
[21:57:23] Radar: Anubix: !rule0
[21:57:23] helpa: Anubix: 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.
[21:57:24] Radar: Anubix: !rule3
[21:57:24] helpa: Anubix: Clearly explain what is happening and create a Gist (http://gist.github.com), (formatted neatly please: http://bit.ly/1q75oia) of the code that is causing the problem you are encountering, as well as any useful output like stacktraces.
[21:58:21] Radar: Anubix: View and controller, please.
[21:58:32] roxtrongo: has joined #RubyOnRails
[21:58:49] steven: has joined #RubyOnRails
[21:59:24] Anubix: Radar: http://pastie.org/private/yvsadraww9i1nmnuyqwcxq
[21:59:25] cac: has joined #RubyOnRails
[21:59:41] Radar: Anubix: Why is the report action using a GET request? There's your problem.
[21:59:43] sinkensabe: has joined #RubyOnRails
[22:00:02] Radar: <%= button_to 'Report', report_topic_path(@topic), method: 'post' ... %>
[22:00:03] Anubix: Radar: In view is data confirm yes/no (i forgot to include it to pastie)
[22:00:19] Radar: Anubix: Still, bots will try to click on it because it's a link.
[22:00:24] Radar: As in: a link to somewhere.
[22:00:30] Radar: Change it to a button that uses a post
[22:00:38] Anubix: Radar: ok thanks
[22:00:41] kerunaru: has joined #RubyOnRails
[22:00:44] slash_nick: rel='nofollow'
[22:01:07] safety_cut: has joined #RubyOnRails
[22:01:24] iamse7en: I have a beginner question about a custom class method to anyone willing. Would appreciate any assistance! https://gist.github.com/anonymous/94da08c68d137e5ac1d2
[22:02:00] njero: has joined #RubyOnRails
[22:03:21] dideler: has joined #RubyOnRails
[22:03:46] Guest53: has joined #RubyOnRails
[22:04:03] defsdoor: iamse7en, whats up with just doing attr_reader home_team_win_probability etc.. ? and setting @home... @away....
[22:04:07] TheNet: has joined #RubyOnRails
[22:04:28] baweaver: has joined #RubyOnRails
[22:04:33] TheNet: What would be the best way to implement a custom flash? I want to be able to have multiple notices per type, and I want to have an optional header for each notice.
[22:05:12] infamos: has joined #RubyOnRails
[22:05:15] mices: has joined #RubyOnRails
[22:05:15] defsdoor: TheNet, just support flash[:notice] being an array or single value
[22:05:32] TheNet: defsdoor: I think that would conflict with devise though
[22:05:48] defsdoor: who mentioned devise ?
[22:06:31] Anubix: Well i have one more problem with typeahead ajax plugin . Here is code http://pastie.org/private/4grc0uuzbwufbgjxshxyzw
[22:06:32] TheNet: well, I'm using devise
[22:06:57] duncannz: has joined #RubyOnRails
[22:06:59] cac: has joined #RubyOnRails
[22:07:17] Anubix: I dunno how to connect JS and Rails, how to load all towns and include it to JS code etc.
[22:07:33] TheNet: defsdoor: even if I weren't wouldn't it be bad practice since other gems could potentially use flash?
[22:07:48] steven: has left #RubyOnRails: ()
[22:07:50] defsdoor: lord I hope not
[22:08:15] Radar: TheNet: !xy
[22:08:15] helpa: TheNet: It seems like you are asking for a specific solution to a problem, instead of asking about your problem. This often leads to bad solutions and increases frustration for you and those trying to help you. More: http://meta.stackexchange.com/a/66378
[22:08:23] Radar: TheNet: plz explain the why
[22:08:24] defsdoor: flash is a bin for you to use as you like - theres no protocol for what goes in it
[22:08:38] steven: has joined #RubyOnRails
[22:08:40] TheNet: Radar: I did, I want to have multiple notices per type and I want to have an optional header for each notice.
[22:08:42] defsdoor: you just have to render it suitably
[22:08:45] TheNet: it's just a stylistic choice
[22:08:49] Radar: TheNet: That's not the why!
[22:08:51] rgtk: has joined #RubyOnRails
[22:09:00] Radar: TheNet: That's you've come up with a solution and then you want us to tell you how to implement it.'
[22:09:08] iamse7en: defsdoor okay, so add attr_reader home_team_win_probability etc... but how do I access that in the view?
[22:09:52] defsdoor: iamse7en, exactly as you are in your example code
[22:10:04] Anubix: Do you know any good source with connectin JS or JSON and Rails?
[22:11:08] __desmondhume: Anubix: what does it mean?
[22:11:09] dtordable: ckeditor dont load
[22:11:22] TheNet: Radar: I want to display flash messages with a header, that seems like a why to me
[22:11:37] Radar: TheNet: Do you have an example of doing that?
[22:12:03] Anubix: __demondhume: That code? I just need to implement typeahead twitter (replace select box of towns with text field typeahed)
[22:12:16] Stevefaust: has joined #RubyOnRails
[22:12:35] TheNet: "We're sorry we can't apply that discount" "That offer has expired"
[22:12:43] defsdoor: TheNet, https://gist.github.com/defsdoor/b5d4204e66b75c7f3740
[22:12:43] dllnl: has joined #RubyOnRails
[22:12:45] n1ck7: When routing to a controller, does Rails specifically look in the app/controllers folder? I've added some controllers into an app/classic/controllers directory, but they aren't picked up
[22:13:03] defsdoor: thats how I do flash - single or mutliple - where you want a header I have different classes
[22:13:11] Radar: TheNet: Right. Then you might want to do something like flash[:alert] = { title: "We're sorry...", body: "That offer has expired." }
[22:13:11] iamse7en: defsdoor: here is the error I get after adding the attr_reader line. thanks for your help! https://gist.github.com/anonymous/58af8cc56df07c62a960
[22:13:18] Radar: TheNet: thanks for taking the time to explain it.
[22:13:27] __desmondhume: Anubix: "Do you know any good source with connectin JS or JSON and Rails?" <- this
[22:13:28] Radar: n1ck7: Yes it does.
[22:13:32] Anubix: __desmondhume: Because when is in app hundreds of towns, then isn't cool choose from select box (so many options, not friedly)
[22:13:41] Ropeney: has joined #RubyOnRails
[22:13:58] Anubix: __desmondhume: Ah yes. On rails guider there isn't much information about workign with javascript in rails
[22:13:59] TheNet: Radar: but doesn't that conflict with validations?
[22:14:10] Radar: TheNet: huh? Validations are something else entirely.
[22:14:23] Anubix: __desmondhume: So i was googling and didnt found any manual.
[22:14:26] SteenJobs: has joined #RubyOnRails
[22:14:36] defsdoor: TheNet, validations dont update flash
[22:14:44] __desmondhume: Anubix: ok so you need to find a way to get data from rails via js?
[22:14:45] n1ck7: Radar, thanks for the reply. Is there any way to alter this behaviour? I want rails to use the app/controllers directory for regular routes. But any routes that have a namespace of "classic" - use the controllers that are inside of app/classic/controllers
[22:14:47] defsdoor: TheNet, you might on a validation failure
[22:14:51] TheNet: ah, wasn't aware. devise updates flash though
[22:15:01] Radar: n1ck7: Namespace of classic sounds like it should be app/controllers/classic.
[22:15:16] Stevefaust: has joined #RubyOnRails
[22:15:34] Anubix: __desmondhume: I need to load @towns from rails, render it to JS code
[22:15:43] TheNet: I think it's probably better to leave flash alone for other gems, and create my own flash system
[22:15:45] defsdoor: TheNet, are you likely to be appending to flash at the same time as devise ? I'd suspect not
[22:15:50] n1ck7: Radar, Sorry - it's actually "scope(:path => '/classic')"
[22:16:06] defsdoor: TheNet, that's bonkers
[22:16:26] rodfersou: has joined #RubyOnRails
[22:16:44] defsdoor: TheNet, I'd avoid using activerecord and write your own also - to leave it for other gems
[22:16:46] n1ck7: Radar, I want to actually move all sub directories of app (controllers, models, views etc) into this "app/classic" directory
[22:17:00] __desmondhume: Anubix: create an endpoint in your rails app, which return a json with the towns' list, make an AJAX call to that endpoint
[22:17:07] Aeyrix: defsdoor: You should avoid using Warden and write your own
[22:17:10] Aeyrix: to leave it for other gems.
[22:17:23] defsdoor: n1ck7, wouldnt they be better off in app/controllers/classic ?
[22:17:30] tubbo: TheNet: lol why
[22:17:32] n1ck7: Radar, And have rails use this folder for any routes that prefix with "classic", but otherwise route as normal
[22:17:58] gusrub: has joined #RubyOnRails
[22:18:02] mustmodify: has joined #RubyOnRails
[22:18:12] Anubix: __desmondhume: Ye this is exactly what i dunno. Where should I use this JS code? In new.js.erb or mayors.coffee
[22:18:14] tubbo: TheNet: flash is pretty ephemeral. like you could have :notice, :notice2, :info, et. al. all "look the same" in your front-end
[22:18:18] n1ck7: defsdoor, Yeah, they probably would. I've inherited an old application, and I want to re-write it, so I want to temporarily move all of this stuff into a seperate folder
[22:18:22] tubbo: it's not just limited to :alert and :notice
[22:18:52] iamse7en: defsdoor: i've unfortunately got to run, but would appreciate if you could leave your thoughts in the comments or fork it... so much thanks in advance
[22:19:22] bruno-: has joined #RubyOnRails
[22:19:31] __desmondhume: you can create an action in your controller, that renders a json with towns
[22:19:31] matthewd: n1ck7: Do you actually want to run the classic app completely separately from the new one, and just mount it at /classic ?
[22:19:47] matthewd: If you're using separate routes, separate controllers, and separate models... ??\_(???)_/??
[22:19:54] colleenmcguckin: has joined #RubyOnRails
[22:20:03] __desmondhume: so instead of rendering an html, it renders the json, like "format.json { render json: @towns }"
[22:20:15] TheNet: there's also the issue that if I wanted to display multiple notices of the same type I'd have to create an array, then add to it
[22:20:15] Stevefaust: am I good to talk now?
[22:20:18] TheNet: which isn't very clean imo
[22:20:23] n1ck7: matthewd, Yeah, that's what I want to do
[22:20:23] mustmodify: I'm looking at someone else's code. A controller: "class RegistrationsController < Devise::RegistrationsController` in create it does `return super` ... any thoughts about what that might do? When I `raise super.inspect` it tries to render registrations#new, which surprised me.
[22:20:31] __desmondhume: Anubix: http://guides.rubyonrails.org/layouts_and_rendering.html
[22:21:04] __desmondhume: go to "2.2.9 Rendering JSON" section. I don't know how you're crafting the @towns array, but still, this is the way to go
[22:21:13] Anubix: __desmondhume: I have to do that in new action where form is
[22:21:24] njero: has joined #RubyOnRails
[22:21:45] Stevefaust: Guys, I have what is probably a simple question.
[22:22:03] defsdoor: all questions are simple
[22:22:08] defsdoor: it's the answers that are hard
[22:22:12] Stevefaust: How do I set up a new rails application on a test server?
[22:22:30] mustmodify: defsdoor: I don't know, I've seen some questions that looked like they had been passed through an obfuscator.
[22:22:40] Stevefaust: I'm just a front end developer and the back end guy that usually does this quit
[22:22:45] __desmondhume: if the towns list request is limited to the controller you're working on, put it in that controller. Otherwise (I know, it's a bit boilerplat-ish, but at least it's restful) you can create a TownsController, with an index action, returning that list
[22:23:02] defsdoor: Stevefaust, OS ? Database ?
[22:23:24] Stevefaust: Linix and I believe MySQL
[22:23:34] tubbo: Stevefaust: !ubuntu
[22:23:34] helpa: Stevefaust: Ubuntu, Ruby, ruby-install, chruby, Rails setup guide: http://ryanbigg.com/2014/10/ubuntu-ruby-ruby-install-chruby-and-you/ - Gauranteed to work 100% of the time or your money back!
[22:23:42] defsdoor: Stevefaust, simple answer is install all the dependencies and deploy to it
[22:23:58] tubbo: defsdoor: if you're gonna say shit like that don't say anything at all :P
[22:23:59] __desmondhume: Anubix: you just need an endpoint, doesn't need to be the same action the form is rendered by
[22:24:04] annlewis: has joined #RubyOnRails
[22:24:08] n1ck7: matthewd, So you don't think it can be done? These are instructions that have been handed down to me in terms of how they want to go about re-writing this app. Do you have any suggestions as to how we could go about gradually re-factoring everything inside of app
[22:24:21] TheNet: defsdoor: sorry, is that a helper?
[22:24:32] defsdoor: TheNet, aye
[22:24:34] __desmondhume: (new action has only one job, rendering the form to create a new record)
[22:24:46] Stevefaust: defsdoor, I'm brand new to RoR. So you'll have to dumb it down for me, amigo
[22:24:56] bruno-_: has joined #RubyOnRails
[22:24:56] chouhoulis: has joined #RubyOnRails
[22:24:57] tubbo: Stevefaust: !ubuntu
[22:24:57] helpa: Stevefaust: Ubuntu, Ruby, ruby-install, chruby, Rails setup guide: http://ryanbigg.com/2014/10/ubuntu-ruby-ruby-install-chruby-and-you/ - Gauranteed to work 100% of the time or your money back!
[22:25:04] hahuang65: has joined #RubyOnRails
[22:25:28] Stevefaust: cool. thanks helpa and turbo
[22:25:28] colleenmcguckin: has joined #RubyOnRails
[22:25:49] matthewd: n1ck7: It depends what you want to do. I'm still unclear about that... if you want them completely separate, it's easy. But I'm not sure how said plan allows you to them make any gradual transition.
[22:25:50] Anubix: __desmondhume: Well but when I use render json: @towns in MayorsController new action, then it expect json in new.json right?
[22:26:55] matthewd: n1ck7: If you want to be able to later reference things across the divide, they'll need to live in one app, so you probably want app/controllers/classic/* etc
[22:27:10] Anubix: __desmondhume: And then in new.json i copy typeahead code and in local: @towns it will render list of towns to JS code
[22:27:55] mustmodify: so anyone have a clue what 'raise super' might do in a controller?
[22:28:08] __desmondhume: Define a towns action in the MayorsController, put the render json in that action. Use mayors/towns.json as typeahead source and you're done
[22:28:54] __desmondhume: of course create the route for towns, so put `get /towns, to: 'mayors#towns'` in your routes.rb file
[22:29:03] Stevefaust: helpa, I looked at the guide you linked to, and rails is already setup on the server. There are many other applications on the server, but the guy that does this part quit the other day without letting anyone know how to do it.
[22:29:14] n1ck7: matthewd, They were quite specific about having everything that currently exists in the app folder into "app/classic" And from there, whenever a url is prefixed with "classic" - make sure it uses the controllers, models, views inside of "app/classic"
[22:29:22] __desmondhume: Stevefaust: i think helpa is a bot
[22:29:28] __desmondhume: Stevefaust: !ubuntu
[22:29:37] matthewd: mustmodify: Is that a trick question? It'll call super, then (assuming it exists) raise the exception it returns.
[22:29:41] n1ck7: matthewd, Hope that makes sense
[22:29:42] dtordable: how can I set the 'ckeditork' class in my scaffold?
[22:30:12] bruno-_: has joined #RubyOnRails
[22:30:19] dtordable: dont know haml so im lost
[22:30:21] djbkd: has joined #RubyOnRails
[22:30:34] Stevefaust: what do you mean by !ubuntu? other than the OS...
[22:30:56] matthewd: n1ck7: Who is "they"? Experienced Rails developers? Somewhat-technical stakeholders?
[22:31:27] __desmondhume: I thought writing !ubuntu would show that help message about installing rails on ubuntu, but maybe i was wrong lol
[22:31:29] Anubix: __desmondhume: Thanks. Maybe its too late but i still dont get it, when i use action abrakadabra and render json: @towns how rails app know it should load towns.json
[22:31:41] n1ck7: matthewd, Experienced Rails Developers yeah
[22:32:31] Stevefaust: desmondhume, I see. Do you know of a site I could go to that would help me set this up?
[22:32:32] matthewd: n1ck7: Then I'd get more [technical/implementation] details from them, because as a Rails Developer (sic), I don't think that's going to go very well
[22:33:09] jessemcgilallen: has joined #RubyOnRails
[22:33:18] __desmondhume: Stevefaust: https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-puma-and-nginx-on-ubuntu-14-04
[22:33:52] __desmondhume: check out digital ocean step by step guides, they're always copy&paste 100% working
[22:34:00] n1ck7: matthewd, Right okay, I'll copy and paste the exact wording that I have in an email here and maybe it will make a bit more sense: "To do this, we'll need to move everything (models, views and
[22:34:00] n1ck7: controllers) into a sub-directory and make sure Rails knows where to
[22:34:00] n1ck7: look when the namespace in the URL matches this new namespace
[22:34:00] n1ck7: ('classic'). I'm not 100% sure on how Rails will handle this but I'm
[22:34:00] n1ck7: sure there is a sensible way to do it so I'll leave it with you to come
[22:34:01] n1ck7: up with a sensible solution"
[22:34:18] Stevefaust: desmondhume : Cool. Thanks amigo
[22:34:31] __desmondhume: Stevefaust: np man
[22:35:00] matthewd: So where did "quite specific [..] app/classic/" come from? :/
[22:35:12] djbkd: has joined #RubyOnRails
[22:35:22] Guest53: has joined #RubyOnRails
[22:35:31] Anubix: Stevefaust: There is also good manual on https://gorails.com/deploy/ubuntu/14.04 but i prefer to use Mina instead of Capistrano, Mina is faster and easier config
[22:35:39] __desmondhume: Anubix: you should use `remote` instead of `local` when setting up bloodhound
[22:35:39] __desmondhume: https://github.com/twitter/typeahead.js/blob/master/doc/bloodhound.md#remote
[22:36:03] n1ck7: matthewd, Ah I emailed back clarifying everything and his exact words ""Yeah, that's right ? everything inside app/ will need putting into a
[22:36:03] n1ck7: subdirectory ('classic')."
[22:36:30] sinkensabe: has joined #RubyOnRails
[22:36:33] __desmondhume: so remote { url: 'mayors/towns.json' }
[22:36:36] Stevefaust: Anubix: Thanks. I'll give them both a look through. I appreciate your help guys!
[22:36:40] czerasz: has joined #RubyOnRails
[22:36:53] n1ck7: matthewd, So you don't think it's something that is possible to do in Rails? I've been trying to figure this out all day and haven't come across any solution for it either
[22:36:56] Pazician: has joined #RubyOnRails
[22:37:02] matthewd: Okay, well, I can only advise that you'll be far better off putting things into nested subdirs instead: app/controllers/classic, app/models/classic, etc.
[22:37:29] tianyi: has joined #RubyOnRails
[22:37:44] Radar: Stevefaust: Hi.
[22:37:57] hardtail: has joined #RubyOnRails
[22:37:59] Radar: Stevefaust: I wrote a simple guide for deploying to Ubuntu here: http://ryanbigg.com/2015/07/deploying-a-rails-application-on-ubuntu-passenger-edition/
[22:38:03] baweaver: has joined #RubyOnRails
[22:38:05] Radar: Hi pontiki!
[22:38:07] n1ck7: matthewd, Ok mate, thanks for your help
[22:38:11] yfeldblum: has joined #RubyOnRails
[22:38:13] pontiki: at this gist: https://gist.github.com/tamouse/656a2383cf364b5b0683
[22:38:25] pontiki: i want the attributes in some of the nodes
[22:38:39] Anubix: __desmondhume: Where exactly i should copy remote? Instead of local: @towns now?
[22:38:45] pontiki: i think i might be back to parsing with nokogiri :(((
[22:38:51] __desmondhume: Anubix: the routes / controllers / actions configuration is up to you, I don't know your actual codebase, so I'm just trying to give the best option to "scale" your js in the case you have hundreds or thousands of towns in the future
[22:39:11] __desmondhume: Anubix: exactly
[22:39:22] Radar: pontiki: Yup, that's what I'd use for that.
[22:39:31] pontiki: ACTION HATES xml
[22:39:33] Stevefaust: Radar: Cool. Thanks. How can I be sure that it is in fact a ubuntu server? I know for sure that it isn't Windows.
[22:39:37] __desmondhume: and also, local: @towns <- this is not the way you should print towns
[22:40:01] __desmondhume: Town.all returns an AR Relation, which is not an array of town names :)
[22:40:03] Radar: Stevefaust: It should tell you when you log into it, in the MOTD. "Welcome to Ubuntu 14.04.3" or something similar.
[22:40:12] Radar: Stevefaust: Alternatively, run "uname -a"
[22:40:13] AnomalousBit: has joined #RubyOnRails
[22:40:16] atlantaman: has joined #RubyOnRails
[22:40:57] Stevefaust: Radar: Thanks a lot amigo
[22:41:15] __desmondhume: if you want to keep local and give it a try, just set @towns = Town.pluck(:name), or whatever column_name you want to index for typeahead
[22:41:51] colleenmcguckin: has joined #RubyOnRails
[22:42:19] MartinElvar: has joined #RubyOnRails
[22:42:24] Palsson_: has joined #RubyOnRails
[22:42:34] Anubix: __desmondhume: That .json way looks better. Should i use i new form remote: true then ?
[22:42:53] __desmondhume: this way you'll have an array containing only the names of the towns. Also, don't forget to wrap @towns in <%= %> erb tag
[22:42:57] freezevee: has joined #RubyOnRails
[22:43:00] __desmondhume: it's not remote: true
[22:43:14] Anubix: __desmondhume: ok
[22:43:25] alex88: has joined #RubyOnRails
[22:43:51] gambl0re: has joined #RubyOnRails
[22:43:52] Stevefaust: Radar: I see you mentioned Capistrano in your tutorial. I know that is installed. In the past when I have made changes to sites I would jump in my terminal and do 'cap demo deploy'.
[22:43:55] __desmondhume: remote is an object, containing url key, which is the endpoint url, so just replace your `local: @towns` with `remote: { url: "yourRouteToTowns" }`
[22:44:06] chouhoul_: has joined #RubyOnRails
[22:44:15] lacrymology: has joined #RubyOnRails
[22:44:35] Anubix: __desmondhume: last question. I am looking on it. Now i am using select box with town names and values are foreign key ids. But now when i use text field with typeahead, it will show name and value probably name as well. Not id
[22:44:44] chouhoulis: has joined #RubyOnRails
[22:45:02] kies: has joined #RubyOnRails
[22:45:28] DoubleMalt: has joined #RubyOnRails
[22:47:41] alex88: has joined #RubyOnRails
[22:47:52] Palsson_: has joined #RubyOnRails
[22:49:38] __desmondhume: the identify function is what you're looking for
[22:49:43] Anubix: __desmondhume: Heh. Maybe its bigger problem then I expect. Because input text field doesn't support foreign keys (list of towns name with ids)
[22:51:21] __desmondhume: Anubix: http://stackoverflow.com/questions/28102146/working-twitter-typeahead-example
[22:51:51] yfeldblum: has joined #RubyOnRails
[22:52:14] __desmondhume: google for some examples of rails + typeahead, there's plenty of them. Typeahead is a bit tricky at the beginning, but it's nothing fancy
[22:52:30] frzng: has joined #RubyOnRails
[22:53:25] shibabu: has joined #RubyOnRails
[22:54:41] Anubix: __desmondhume: Yea i was looking on it last 3 days but still unsuccefuly. Anyway thanks for help :)
[22:55:14] quazimodo: has joined #RubyOnRails
[22:55:29] mary5030_: has joined #RubyOnRails
[22:55:46] Maletor: has joined #RubyOnRails
[22:56:24] mary5030_: has joined #RubyOnRails
[22:57:45] jgpawletko: has joined #RubyOnRails
[22:57:51] arthurix_: has joined #RubyOnRails
[22:58:31] pydave6367: has joined #RubyOnRails
[22:59:33] weaksauce: has joined #RubyOnRails
[22:59:40] njero: has joined #RubyOnRails
[22:59:50] Fire-Dra_: has joined #RubyOnRails
[23:00:15] colleenmcguckin: has joined #RubyOnRails
[23:02:17] lemur: has joined #RubyOnRails
[23:02:52] kitsuneyo: has joined #RubyOnRails
[23:03:09] htmldrum: has joined #RubyOnRails
[23:07:33] maxz: has joined #RubyOnRails
[23:10:06] willardg: has joined #RubyOnRails
[23:10:18] iateadonut: has joined #RubyOnRails
[23:10:40] baweaver: has joined #RubyOnRails
[23:11:12] njero: has joined #RubyOnRails
[23:12:35] manuelmesson: has joined #RubyOnRails
[23:13:39] gambl0re: has joined #RubyOnRails
[23:14:08] Radar: What is the way to check if AR is currently inside a transaction?
[23:16:47] riotjones: has joined #RubyOnRails
[23:17:48] Radar: In Bizarro land over here.
[23:18:07] Radar: Or I'm just being stupid. I'll experiment more before I go asking questions.
[23:18:07] VeryBewitching: ActiveRecord::Base.connection.open_transactions
[23:18:13] Radar: Thanks VB.
[23:18:22] Radar: (We have a beer called VB here. It's not very good.)
[23:18:46] VeryBewitching: There's a programming language that's not too good either.
[23:19:01] mary5030: has joined #RubyOnRails
[23:19:29] VeryBewitching: http://stackoverflow.com/questions/20102583/how-to-tell-if-already-within-a-database-transaction-in-ruby-on-rails for context on the previous, fyi
[23:25:13] Aeyrix: It's also a bastardised scripting language and it's pretty horrendous
[23:25:16] annlewis: has joined #RubyOnRails
[23:28:12] Pazician: has joined #RubyOnRails
[23:29:40] Radar: Great. I've got this code in my controller: https://gist.github.com/radar/5e91253a9a2ebbe6b0dd. When I have a Sidekiq worker on another server hit this action and send through parameters, it does not change an advert's published field to false.
[23:29:49] Radar: I should probably include the params in that Gist.
[23:29:54] StaticVoid: has joined #RubyOnRails
[23:30:46] Radar: Done. So the parameters come through. The `params[:advert]` key is a thing due to Rails's own JSON parsing. Can be useful in some cases, but here I'm just blatting the whole params hash to AdvertForm and letting it sort out what it wants / doesn't want.
[23:31:18] Radar: So back to the issue: the SIdekiq worker sends through params, which contain a `published` key set to false. The request succeeds, as I can see this from the Sidekiq logs and also the server logs.
[23:31:28] Radar: Finding the advert in the database however shows the `published` field set to `true` still.
[23:31:37] Radar: Running _the exact same code from the controller_ in a production console makes it work.
[23:31:58] Aeyrix: Looking at that controller makes me worry if I'm doing things wrong.
[23:32:03] Aeyrix: I need to stop looking at other people's code.
[23:32:18] Radar: We are using Reform there because we have... well, it's a whole other story.
[23:32:27] Aeyrix: Is it worth it?
[23:32:29] Radar: Aeyrix: p.s. hack night is tonight
[23:32:33] Radar: We think so.
[23:32:34] Aeyrix: Seriously?
[23:32:39] Radar: Aeyrix: Follow @rubyauevents
[23:32:58] Aeyrix: Is that a Twitter account, an Instagram account, or a meetup.com account?
[23:33:00] Radar: Twitter account.
[23:33:14] Aeyrix: Is this the one in the city?
[23:33:22] Aeyrix: I didn't bring my laptop zzzz
[23:33:33] Aeyrix: I'll see if I can dash home and grab it. This laptop can't leave the premises.
[23:33:43] johnflux: has joined #RubyOnRails
[23:33:43] johnflux: has joined #RubyOnRails
[23:33:45] simplyianm: has joined #RubyOnRails
[23:34:24] edj: has joined #RubyOnRails
[23:34:28] Aeyrix: Loving your bio on that site
[23:34:36] Aeyrix: "Wrote some books about Ruby /Rails."
[23:34:51] Radar: :) Didn't really have any other claim to fame.
[23:35:04] Aeyrix: Your Stackoverflow points balance?
[23:35:16] Aeyrix: "Chief wrangler of #rubyonrails".
[23:35:17] Radar: Changes all the time. I'd have to update Meetup near weekly.
[23:35:24] wldcordeiro: has joined #RubyOnRails
[23:35:56] Aeyrix: I need to get a blackberry tbh
[23:36:03] Aeyrix: Then I could code on my phone. Physical keyboard.
[23:36:42] muntasirsyed: has joined #RubyOnRails
[23:37:39] Aeyrix: Also I finally decided to take a look at FactoryGirl for stubbing class instances.
[23:37:48] seank_: has joined #RubyOnRails
[23:37:49] Aeyrix: Best choice of this month so far.
[23:38:17] Aeyrix: Can you validate, say, password complexity with Reform?
[23:38:20] romdi: has joined #RubyOnRails
[23:38:27] Aeyrix: Asking for a friend who dislikes how much Devise takes over his app and is using Clearance instead.
[23:38:28] Radar: yeah, it has the same validations that AR has
[23:38:40] Radar: We're using it because we were getting tired of validations+callbacks clogging up the Advert model.
[23:38:42] Aeyrix: IIRC AR doesn't have anything for password complexity specifically.
[23:38:51] Radar: You can still write your own.
[23:38:52] frzng: has joined #RubyOnRails
[23:40:40] sye: has joined #RubyOnRails
[23:40:52] Aeyrix: Radar: Reform recommends against ActiveModel.
[23:40:56] Aeyrix: I don't really understand why. Do you?
[23:41:04] Aeyrix: "To use ActiveModel (not recommended as it doesn't support removing validations)."
[23:41:15] hahuang65: has joined #RubyOnRails
[23:41:24] Aeyrix: Are we talking about "doesn't support validations that remove"
[23:41:31] Aeyrix: "doesn't support removing validations from the set"
[23:41:40] Radar: Doesn't support removing validations easily.
[23:41:50] Radar: You can probably modify _validations on the class but that'd be hacky.
[23:41:55] Aeyrix: Why would you want to remove a validation?
[23:42:01] Radar: No idea :)
[23:42:08] sevenseacat: has joined #RubyOnRails
[23:42:10] Aeyrix: ACTION installs.
[23:42:16] Aeyrix: Hey sevenseacat :>
[23:42:21] Radar: I can think of reasons you'd want to temporarily remove one, but not have it removed completely.
[23:42:24] Radar: Good morning sevenseacat
[23:42:35] sevenseacat: bonan matenon
[23:42:40] Aeyrix: You use Devise hey?
[23:42:49] atlantaman: has joined #RubyOnRails
[23:42:57] Aeyrix: Just tabbed into my terminal and remembered another issue I was having.
[23:43:17] Aeyrix: Outputting @model.errors in a user-digestible format if it fails a validation.
[23:43:34] Radar: @model.errors.full_messages?
[23:43:36] rgrmatt: has joined #RubyOnRails
[23:43:42] Aeyrix: Goddammit.
[23:43:45] user083: has joined #RubyOnRails
[23:43:48] Aeyrix: Every time.
[23:44:29] Radar: I should probably have some breakfast. That explains the grumpiness.
[23:44:43] notnoyyyyy: has joined #RubyOnRails
[23:44:44] sye: has joined #RubyOnRails
[23:44:58] Aeyrix: I get up too late for breakfast.
[23:45:11] Aeyrix: If I get up earlier I'm too tired, which means I have to go to bed earlier and I don't have enough time on an evening as it is. <_<
[23:45:41] owenjones: has joined #RubyOnRails
[23:46:25] Aeyrix: >Email is invalid, Email can't be blank
[23:46:33] alex88: has joined #RubyOnRails
[23:46:36] Aeyrix: Kinda wish that if it's blank it quits there as opposed to trying to validate it too.
[23:46:38] Megamos: has joined #RubyOnRails
[23:48:12] sevenseacat: ACTION is having a can of V for breakfast
[23:48:21] Aeyrix: Solid choice. I had a latte.
[23:48:26] dopie: https://gist.github.com/staycreativedesign/e4f3c29f605263df2c97 , try this with capybara and it gets me the error with id nil...
[23:48:28] Aeyrix: Also I can't drink those anymore. :(
[23:48:59] dopie: not sure why its giving me a route error
[23:50:00] sevenseacat: likely because there is no route matching those parameters (a nil id)
[23:50:12] dopie: yes but creating a vendor does create an id
[23:50:22] Aeyrix: Yeah but are you passing it?
[23:51:11] sevenseacat: i have no context to know what a vendor or subscription plan or any of the code is that this test is actually running on
[23:51:20] sye: has joined #RubyOnRails
[23:51:31] Aeyrix: !code etc
[23:51:31] helpa: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[23:51:37] Aeyrix: !botsnack
[23:51:37] helpa: Nom nom. Thanks, Aeyrix!
[23:51:39] sevenseacat: and 8am is far too early for mindreading
[23:51:46] Aeyrix: sevenseacat: Go back to bed.
[23:51:52] Aeyrix: 8am is too early for anything, especially IRC.
[23:51:54] sevenseacat: can't. i'm in the city.
[23:51:57] sevenseacat: worknig and shit.
[23:51:58] Aeyrix: Wow rough. :(
[23:52:02] Aeyrix: Not at home today?
[23:52:12] sevenseacat: roro is on this evening so i am out and about
[23:52:29] Aeyrix: I only just found out we have a Twitter account for that stuff.
[23:52:35] Aeyrix: So I didn't bring my laptop today.
[23:52:36] Megamos: has joined #RubyOnRails
[23:52:36] sevenseacat: yeah it only got started yesterday :P
[23:53:01] p8m: has joined #RubyOnRails
[23:53:08] blackmesa: has joined #RubyOnRails
[23:54:02] TPBallbag: has joined #RubyOnRails
[23:54:09] dopie: https://gist.github.com/staycreativedesign/e4f3c29f605263df2c97
[23:54:46] Radar: dopie: stacktrace from the test too please
[23:55:18] sevenseacat: indeed, the stacktrace will show where the error is - idoubt its in that code, its probably in a view
[23:55:19] Foss_: has joined #RubyOnRails
[23:55:24] sye: has joined #RubyOnRails
[23:56:30] dopie: https://gist.github.com/staycreativedesign/e4f3c29f605263df2c97
[23:56:50] Radar: sevenseacat: you win :)
[23:57:02] Radar: # ./app/views/subscription_plans/index.html.erb:9:in `_app_views_subscription_plans_index_html_erb___1691237000477759334_70183799979220'
[23:57:26] dopie: # /Users/mindblownkaboom/.rvm/gems/ruby-1.9.3-p551@equip/gems/actionpack-3.2.21/lib/action_dispatch/routing/route_set.rb:216:in `subscription_plan_path'
[23:57:38] glaksmono: has joined #RubyOnRails
[23:57:50] glaksmono: guys, if I say .includes(payment_refunds: [:user]), what does that mean?
[23:57:52] Radar: ignore framework code. Look for lines in the stacktrace which point to your app
[23:58:00] glaksmono: is that joining to the "user" table?
[23:58:47] Radar: glaksmono: !querying
[23:58:47] helpa: glaksmono: http://guides.rubyonrails.org/active_record_querying.html - ActiveRecord Querying Guide by Ryan Bigg
[23:59:28] creature: has joined #RubyOnRails
[23:59:28] creature: has joined #RubyOnRails