« Back to channel list

#RubyOnRails - 20 September 2015

« Back 1 day Forward 1 day »
[00:00:30] bronson: has joined #RubyOnRails
[00:00:33] annlewis: has joined #RubyOnRails
[00:01:14] Scripore: has joined #RubyOnRails
[00:01:42] apple12: has joined #RubyOnRails
[00:04:26] hnanon_: has joined #RubyOnRails
[00:05:51] gambl0re: has joined #RubyOnRails
[00:06:05] one_zero: has joined #RubyOnRails
[00:07:04] hnanon_: The following line works as expected:
[00:07:07] hnanon_: @essay_one_first_draft_reviews = @user.reviews.joins(:essay).where( essays: { number: 0, stage: 0 })
[00:07:19] hnanon_: However, this line is giving me an error:
[00:07:27] hnanon_: @essay_one_final_draft_reviews = @user.reviews.joins(:essay).where( essays: { number: 0, stage: 1 })
[00:07:34] hnanon_: first vs final
[00:07:50] hnanon_: Error: undefined method `reviews' for nil:NilClass
[00:07:57] hnanon_: I can't figure out why.
[00:09:00] centrx: has joined #RubyOnRails
[00:09:45] stardiviner: has joined #RubyOnRails
[00:11:25] turbo_MaCk: has joined #RubyOnRails
[00:15:14] pontiki: hnanon_: p'raps you should drop into a debugger right before and find out why @user is non-nil in the one case and nil in the other?
[00:16:35] Kallis: has joined #RubyOnRails
[00:16:49] workmad3: has joined #RubyOnRails
[00:17:24] EminenceHC: has joined #RubyOnRails
[00:17:29] Encapsulation: has joined #RubyOnRails
[00:19:07] Pupeno: has joined #RubyOnRails
[00:19:10] badfish129: has joined #RubyOnRails
[00:20:24] webguynow: has joined #RubyOnRails
[00:21:20] bkulbida: has joined #RubyOnRails
[00:22:25] hydrozen: has joined #RubyOnRails
[00:23:58] chills42: has joined #RubyOnRails
[00:24:30] Pupeno: has joined #RubyOnRails
[00:24:53] Grundell: has joined #RubyOnRails
[00:25:18] gambl0re: how would i add multiple columns to table using migration
[00:26:38] blackhuey: has joined #RubyOnRails
[00:27:03] hightower4: gambl0re, inside the up() or change() function you would just list more "add_column :TABLE, :COL, TYPE" calls
[00:27:22] gambl0re: i mean in the rails g migration command
[00:27:25] gambl0re: i got it though
[00:27:54] gambl0re: you just do ' rails g migration addblahblahtoblah user:string name:string '
[00:29:03] capin: gambl0re: `rails generate migration CreateColumnsInTable first_name:string last_name:string`
[00:30:19] webguynow: has joined #RubyOnRails
[00:32:33] gambl0re: if i need to change a table attribute from string to text, do i do migration?
[00:32:45] hnanon_: pontiki: I figured it out. I didn't have a set_user method on that action.
[00:33:11] capin: gambl0re: you can change your existing migration and rollback or create a new migration
[00:34:07] gambl0re: does this work? rename_column :table, :old_column, :new_column
[00:36:16] Scripore: has joined #RubyOnRails
[00:40:00] chouhoulis: has joined #RubyOnRails
[00:40:24] gambl0re: yea i got it
[00:45:03] bruno-_: has joined #RubyOnRails
[00:55:11] apple12: has joined #RubyOnRails
[00:55:12] webguynow: has joined #RubyOnRails
[01:01:23] michaeldeol: has joined #RubyOnRails
[01:01:25] annlewis: has joined #RubyOnRails
[01:02:42] Scripore: has joined #RubyOnRails
[01:03:08] towski_: has joined #RubyOnRails
[01:03:27] webguynow: has joined #RubyOnRails
[01:08:11] gambl0re: https://gist.github.com/rickywid/644c37b9ccaa6b5460b0
[01:08:26] webguynow: has joined #RubyOnRails
[01:08:34] gambl0re: how would i get the %p tag on line 12 to be inside the panel-body?
[01:08:51] gambl0re: haml keeps complaining about the indentation
[01:09:17] HAL2328: has joined #RubyOnRails
[01:17:24] webguynow: has joined #RubyOnRails
[01:22:39] fedexo: has joined #RubyOnRails
[01:23:39] quazimodo: has joined #RubyOnRails
[01:24:43] pontiki: probably do something with that dangling - else on line 11 that is OUTSIDE THE PANEL
[01:25:02] webguynow: has joined #RubyOnRails
[01:25:03] draig: so sgtill having issues with the validates_timeliness gem
[01:25:10] montage_au: has joined #RubyOnRails
[01:31:22] daniellutz: has joined #RubyOnRails
[01:33:06] bkulbida: has joined #RubyOnRails
[01:33:24] charliesome: has joined #RubyOnRails
[01:33:31] dymk: Paperclip is caching interpolation values I give it, does anyone know a workaround for this?
[01:34:14] webguynow: has joined #RubyOnRails
[01:35:37] h7br1x: has joined #RubyOnRails
[01:36:47] adam12: dymk: can you show some code?
[01:37:18] dymk: This is embarrassing, it's actually rails' caching that is causing me to not see the changes :<
[01:37:34] adam12: That happens.
[01:39:11] daniellutz: has joined #RubyOnRails
[01:39:57] FailBit: chrome users will find this easter egg amusing http://a/%%30%30
[01:40:46] chouhoulis: has joined #RubyOnRails
[01:44:47] Mattx: has joined #RubyOnRails
[01:45:46] Mattx: Hey guys, I have a model Page and I want it to be associated with many resources, that could be of class Download or Product
[01:46:04] Mattx: how do I do this? ActiveRecord doesn't have a polymorphic has_many
[01:47:44] capin: FailBit: chrome quit on me :P
[01:48:45] e1th0r: has joined #RubyOnRails
[01:50:00] webguynow: has joined #RubyOnRails
[01:50:20] SteenJobs: has joined #RubyOnRails
[01:57:10] webguynow: has joined #RubyOnRails
[01:57:44] Creeves: has joined #RubyOnRails
[02:02:07] darrencauthon: has joined #RubyOnRails
[02:02:13] annlewis: has joined #RubyOnRails
[02:02:44] s2013: has joined #RubyOnRails
[02:04:32] Ropeney: has joined #RubyOnRails
[02:04:34] webguynow: has joined #RubyOnRails
[02:04:45] s2013: anyone familiar with activeadmin? when im updating a resource, its not behaving properly.. but im not sure how to access what exactly its doing.. i want to use pry to set a breakpoint somewher
[02:04:51] s2013: hopefully that makes sense
[02:04:53] workmad3: has joined #RubyOnRails
[02:05:12] s2013: or does it look for the update action in the actual controller?
[02:07:23] darrencauthon: has joined #RubyOnRails
[02:07:54] s2013: i guess it doesnt
[02:10:15] wethu: has joined #RubyOnRails
[02:10:36] lwu: has joined #RubyOnRails
[02:10:55] rickmasta: has joined #RubyOnRails
[02:11:25] n1lo: has joined #RubyOnRails
[02:14:46] SteenJobs: has joined #RubyOnRails
[02:16:43] kkeuning: has joined #RubyOnRails
[02:16:55] stannard: has joined #RubyOnRails
[02:18:35] gambl0re: has joined #RubyOnRails
[02:22:07] compl_te_: has joined #RubyOnRails
[02:22:25] draig: hmm what is wrong with this line in my controllers actioin?
[02:22:28] draig: render :plain "wewt"
[02:22:56] draig: i get " syntax error, unexpected tSTRING_BEG, expecting keyword_end render :plain "wewt" ^ "
[02:24:51] draig: i found it
[02:25:10] SteenJobs: has joined #RubyOnRails
[02:26:12] kwstannard: has joined #RubyOnRails
[02:26:12] stannard: has joined #RubyOnRails
[02:27:27] kwstannard: has left #RubyOnRails: ()
[02:27:32] darrencauthon: has joined #RubyOnRails
[02:28:02] adam12: draig: moved the colon, I hope
[02:28:25] webguynow: has joined #RubyOnRails
[02:28:39] draig: the :symbol and expression: are still not in my head yet
[02:29:15] adam12: Yep. Takes some time
[02:29:21] adam12: You could do hash rockets if it helps
[02:29:29] adam12: render :plan => "wewt"
[02:29:36] adam12: s/plan/plain
[02:33:16] bonhoeffer: has joined #RubyOnRails
[02:34:03] startupality: has joined #RubyOnRails
[02:34:51] benlieb: has joined #RubyOnRails
[02:35:49] charliesome: has joined #RubyOnRails
[02:36:05] umgrosscol: has joined #RubyOnRails
[02:40:03] meatherly: has joined #RubyOnRails
[02:41:34] chouhoulis: has joined #RubyOnRails
[02:42:54] mrchris: has joined #RubyOnRails
[02:43:18] PublicSubnet: has joined #RubyOnRails
[02:45:00] bonhoeffer: has joined #RubyOnRails
[02:45:23] PublicSubnet: has joined #RubyOnRails
[02:47:57] iamse7en: has joined #RubyOnRails
[02:49:32] h7br1x: has joined #RubyOnRails
[02:51:26] rushed: has joined #RubyOnRails
[02:53:17] draig: https://gist.github.com/jhoughjr/26002dd50ae4c36eed86
[02:53:55] draig: im getting a missing template for temperatures/new
[02:54:13] draig: oh i bet its beacuse im not rendering anything if it DOES save
[02:54:16] webguynow: has joined #RubyOnRails
[02:54:58] adam12: Also, the `new` action shouldn't be saving objects
[02:55:04] adam12: The `create` action should be.
[02:58:35] moeabdol1: has joined #RubyOnRails
[02:58:44] draig: ah i can change that, thanks
[02:59:06] draig: but now im mad since i went to all thsi trouble for validates_timeliness and its not working
[02:59:23] comm64x: has joined #RubyOnRails
[02:59:36] draig: validates_datetime should be validating as a whole datetime, but it seems to validate no matter what i pass in :/
[03:01:23] webguynow: has joined #RubyOnRails
[03:01:54] draig: im trying to reject anything that is just a time for isntance
[03:02:31] comm64x: has left #RubyOnRails: ()
[03:02:38] draig: hmm now that i have restarted my server, even though nothing changed it wont start
[03:02:43] comm64x: has joined #RubyOnRails
[03:02:47] comm64x: I've run into an error quite a bit in the past and it always ended up being resolved one way or another, but I'm reading through a book on Ruby and I come across the .each as being the method that iterates over something. It caught my attention so I'm wondering...why is it that you run into the no method error for .each in rails?
[03:02:51] annlewis: has joined #RubyOnRails
[03:03:44] comm64x: obviously the each method must exist, so why is rails saying that there is no each method for that object?
[03:06:53] rhizome: NilClass doesn't have an #each method
[03:07:38] comm64x: rhizome: is that the only class without an each method
[03:07:56] rhizome: i doubt it
[03:08:36] comm64x: so, for NilClass at least, what would be the best way to get around this error
[03:09:21] comm64x: when you get the error no method each for NilClass, the interpreter is saying what
[03:09:28] rhizome: generally, to make sure the thing you're calling .each on is not nil, to ensure there's something there to .each
[03:09:49] comm64x: makes sense now
[03:10:10] comm64x: you cant iterate over nothing
[03:10:12] braincras: has joined #RubyOnRails
[03:10:47] sevenseacat: has joined #RubyOnRails
[03:10:57] comm64x: well, I guess you could try, but nothing would be the result
[03:16:05] draig: i like how objc handles nil
[03:16:30] draig: nil evals to 0, false and messages to nil do nothing
[03:16:35] Mattx: Hey guys, I have a model Page and I want it to be associated with many resources, that could be of class Download or Product
[03:16:40] Mattx: how do I do this? ActiveRecord doesn't have a polymorphic has_many
[03:18:19] webguynow: has joined #RubyOnRails
[03:18:24] sevenseacat: polymorphic is exactly what you want
[03:19:30] sevenseacat: actually.. hmm
[03:19:51] Mattx: sevenseacat, I don't think so. polymorphic works the other way around
[03:19:58] sevenseacat: sorry, is early in the morning
[03:20:08] Mattx: with belongs_to, not with has_many/has_one
[03:20:47] Mattx: any idea?
[03:21:18] adam12: How many resources we talking?
[03:22:28] Mattx: many in practice, but a known number
[03:22:39] Mattx: I prefer no to have one associate for each type
[03:22:47] Mattx: if that's was your idea
[03:22:50] adam12: Could you do some sort of STI?
[03:22:55] adam12: This is getting into anti-pattern territory
[03:23:24] adam12: Not provided by ActiveRecord, but possibly even a CTI pattern
[03:23:37] Mattx: STI, no. the classes are way too different
[03:23:45] Mattx: I mean, the attributes
[03:24:08] adam12: Yeah. Tough call. Again, anti-pattern territory
[03:24:11] adam12: CTI can work
[03:24:21] adam12: Or might work. You'd have to switch to Sequel tho, I imagine.
[03:24:36] comm64x: I ran into a similar problem when I needed two separate tables each with a different type of user but they would share a common login
[03:25:01] darrencauthon: has joined #RubyOnRails
[03:25:02] Mattx: comm64x, what do you do?
[03:25:04] comm64x: I tried a few multiple table inheritance ways I found online but known worked
[03:25:19] comm64x: Mattx: freelance webdev
[03:25:30] webguynow: has joined #RubyOnRails
[03:25:31] Mattx: no no, I mean, what do you do on those cases? :P
[03:25:39] adam12: If you're brave and using PG, you could make a JSONB data table
[03:25:47] adam12: and then still use STI but serialize to JSONB
[03:26:16] comm64x: oh haha, I'm still sorting that out, there is a gem called heritage I believe that does CTI
[03:26:24] Mattx: it would be a nightmare to query adam12
[03:26:27] adam12: Custom `store` attributes for each class, serializing to the `data` field.
[03:26:44] adam12: Aye. Again, anti pattern.
[03:26:45] comm64x: every MTI implementation I've tried hasnt worked out for me
[03:27:18] comm64x: is there any particular reason why rails doesnt do MTI
[03:27:27] Mattx: have you tried heritage?
[03:27:30] daniellutz: has left #RubyOnRails: ()
[03:27:47] comm64x: I havent yet but its on my backlog of things to do
[03:27:52] ahmgeek: has joined #RubyOnRails
[03:27:57] daniellutz: has joined #RubyOnRails
[03:29:12] Mattx: comm64x, last commit was in 2013
[03:29:20] Mattx: I wouldn't use it
[03:29:27] maz-dev: has joined #RubyOnRails
[03:30:08] comm64x: Mattx: you could try out some MTI methods, I found them via Google. They may work in your case. For mine I needed something like MTI integrated with authentication and authorization
[03:31:10] comm64x: surely someone is at least working on MTI for rails...somewhere
[03:31:26] Lycanii: has joined #RubyOnRails
[03:32:05] nahtnam: Hey! I need some help. I am trying to nest models with namespacing/modules but I can getting a postgres error: unknown attribute 'status_id' for Steam::StatusDatacenter. When I try to change the migration, to change the field from steam_status_id to status_id, postgres throws an error saying PG::UndefinedTable: ERROR: relation "status" does not exist, so I
[03:32:05] nahtnam: reverted back to steam_status_id... Full code with stack trace: https://gist.github.com/nahtnam/890cf453e1b4af4ec008
[03:32:19] Mattx: that particular gem is outdated but there are a few more on rubytoolbox, I'm reading
[03:33:04] Mattx: meh, all of them are outdated. 2013 or more without a commit
[03:34:32] Mattx: my use case is pretty simple actually. I have a class A that has_many other class B or C, through the same association (when it has a class B associated, all the rest associations are with class B, they shouldn't be mixed)
[03:34:38] Mattx: comm64x, ^
[03:35:40] Mattx: A1 --assoc--> B1, B2 A2 --assoc--> C1 etc
[03:35:43] Mattx: that's it
[03:36:26] comm64x: couldn't you just have class B and class C each extend class A
[03:36:44] Mattx: how would be that stored?
[03:37:27] Mattx: that is the case actually, but A has attributes that are common to B and C, while B and C has attributes that are uniq to them
[03:37:27] comm64x: elaborate on your question
[03:37:54] Mattx: so I don't want to use STI
[03:38:20] webguynow: has joined #RubyOnRails
[03:39:19] comm64x: ah i see, you mean how would that be stored in the database....same problem I have, my best guess so far has been some way of implementing MTI
[03:40:14] comm64x: AFAIK rails doesnt do MTI natively so you would have to implement it yourself depending on what type of database you are using
[03:41:27] comm64x: if you dont like any of the gems you found on toolbox maybe you could take a look at how ActiveRecord does things and extrapolate a way to do MTI from that
[03:41:49] Mattx: wait, what you say mayyyy work
[03:41:58] comm64x: then you could bundle it into a gem, if you would be so kind, so the rest of us could use it :)
[03:41:58] Mattx: what if B and C extends A
[03:42:18] chouhoulis: has joined #RubyOnRails
[03:42:26] Mattx: hmn, maybe I have to explicitly name the table, there should be a method for that
[03:42:46] Mattx: I mean, because rails could think that the table name for B is "a" or something
[03:43:06] comm64x: you can explicitly name tables
[03:43:15] webguynow: has joined #RubyOnRails
[03:43:19] comm64x: I ran across it the other day
[03:43:30] Mattx: ok, so why wouldn't it work?
[03:43:44] Mattx: I guess you already tried this approach :P
[03:43:51] comm64x: I'm not saying it wouldnt, give it a try
[03:44:05] comm64x: no I havent yet I'm going to try it right now actually lol
[03:44:06] beauby: has joined #RubyOnRails
[03:44:23] Pupeno: has joined #RubyOnRails
[03:45:38] comm64x: lets both of us work on it and whichever one finds the answer we agree to share
[03:48:37] Mattx: oh, I see why it wouldn't work for me! comm64x
[03:48:53] SteenJobs: has joined #RubyOnRails
[03:48:55] Mattx: remember that the association is a has_many
[03:49:15] Mattx: I would end having multiple rows with duplicate data (the values that come from class A)
[03:49:20] Mattx: that sucks :(
[03:50:32] webguynow: has joined #RubyOnRails
[03:51:04] Mattx: the tables would be something like: B(a1, a2, a3, b1, b2) C(a1, a2, a3, c1, c2, c3, c4)
[03:51:19] Mattx: where a1, a2 and a3 are from class A
[03:51:56] rhizome: i thought the models couldn't share As
[03:52:51] yaewa: has joined #RubyOnRails
[03:53:04] workmad3: has joined #RubyOnRails
[03:53:47] comm64x: so Page has_many Downloads and Products?
[03:55:13] draig: anyone here used apipie to do docs?
[03:55:54] superlou: has joined #RubyOnRails
[03:56:04] draig: i cant seem to get param docs to work
[03:56:28] nahtnam: Anyone know how I can solve my problem? I cant find anything on stack overflow
[03:57:06] draig: https://gist.github.com/jhoughjr/03a8d5c7c7e030bf24a9
[03:57:22] draig: what problem?
[03:57:32] comm64x: why would you not use Product/Download has_one Page
[03:58:00] adam12: draig: You likely have to permit the parameters.
[03:58:37] draig: i copied this from their docs for a more complex example
[03:58:49] adam12: Actually, you're not doing mass assignment, so that's likely not.
[03:59:17] Mattx: comm64x, I'm trying to get the inverse of that association
[03:59:42] The_Phoenix: has joined #RubyOnRails
[03:59:58] moeabdol1: has joined #RubyOnRails
[03:59:59] Mattx: comm64x, if I have a Page, how do I do page.foos to get all Downloads/Products/whatever_I_may_add?
[04:00:37] srinidhi: has joined #RubyOnRails
[04:00:40] nahtnam: draig: Are you talking to me?
[04:01:05] comm64x: okay so you're wanting the inverse of has_one right?
[04:01:16] draig: yeah, doubt i could help with much speccific but i didnt see what ur prob was
[04:01:33] Mattx: yes, but! there isn't only one class with that has_one
[04:01:36] draig: im trying to use apipie to doc my params for a super simple action
[04:01:43] draig: eactly as their docs show
[04:01:48] Mattx: otherwise inverse_of would work I think
[04:01:56] turbo_MaCk: has joined #RubyOnRails
[04:02:03] comm64x: thats what i was going to suggest lol
[04:02:53] comm64x: Mattx: from apidock Currently :inverse_of supports has_one and has_many (but not the :through variants) associations. It also supplies inverse support for belongs_to associations where the inverse is a has_one and it's not a polymorphic.
[04:03:47] annlewis: has joined #RubyOnRails
[04:03:57] iamse7en: is there a proper way to escape ruby for javascript? e.g. "<script>$(.div).hide();</script>".html_safe ? i generally avoid writing javascript in .rb files
[04:04:51] Coldblackice: has joined #RubyOnRails
[04:06:18] nahtnam: draig: http://logs.ryanbigg.com/RubyOnRails?date=2015-09-20#4141803
[04:06:30] Wixy: has joined #RubyOnRails
[04:06:41] draig: it acts as though its a bug in apipie
[04:07:12] draig: undefined method `content_tag' for #<Apipie::ApipiesController:0x007fd093598a88>
[04:07:12] Wixy: has left #RubyOnRails: ()
[04:07:30] Mattx: has joined #RubyOnRails
[04:07:56] comm64x: Mattx: if you need the :through variants checkout this https://gist.github.com/runemadsen/1242485
[04:08:16] Mattx: I was reading exactly that!
[04:08:19] Mattx: looks intersting
[04:08:19] eazyDev: has joined #RubyOnRails
[04:08:42] Mattx: he could do t.article_elements.element in the example
[04:09:47] rushed: has joined #RubyOnRails
[04:10:29] dopie: has joined #RubyOnRails
[04:11:55] towski_: has joined #RubyOnRails
[04:13:05] Mattx: I think I'll give it a try, thanks comm64x!
[04:13:55] comm64x: np, let me know how it goes im at gmail same username
[04:17:08] webguynow: has joined #RubyOnRails
[04:19:57] nahtnam: Basically what im trying to say is that I have a pair of namespaced models, one called `status`, and the other called `status_datacenters`. Their table names are prefixed with `steam_`. Now, when I try to do `status = Steam::Status.create()`, and then try to do `status.status_datacenters.create()`, it complains that there is no field in StatusDatacenter
[04:19:57] nahtnam: called `status_id`. In postgres, I have to name the field `steam_status_id` in order for it to work
[04:21:37] Parker0: has joined #RubyOnRails
[04:22:33] ahmgeek: has joined #RubyOnRails
[04:23:57] Jasaka: has joined #RubyOnRails
[04:26:26] nahtnam: I got it to work!
[04:26:31] nahtnam: I had to add `foreign_key: :steam_status_id`
[04:27:28] Rohnin: has joined #RubyOnRails
[04:28:52] webguynow: has joined #RubyOnRails
[04:30:02] ahmgeek: has joined #RubyOnRails
[04:33:06] nya: has joined #RubyOnRails
[04:38:43] pawnbox: has joined #RubyOnRails
[04:39:47] doritostains: has joined #RubyOnRails
[04:40:23] bulldawgden: has joined #RubyOnRails
[04:43:02] chouhoulis: has joined #RubyOnRails
[04:46:01] Lightsword: has joined #RubyOnRails
[04:49:33] yfeldblum: has joined #RubyOnRails
[04:49:39] baweaver: has joined #RubyOnRails
[04:53:30] apg: has joined #RubyOnRails
[05:04:22] annlewis: has joined #RubyOnRails
[05:13:07] quazimodo: has joined #RubyOnRails
[05:13:54] bruno-: has joined #RubyOnRails
[05:20:09] liquid-silence: has joined #RubyOnRails
[05:20:57] slayerjain: has joined #RubyOnRails
[05:26:48] stannard: has joined #RubyOnRails
[05:27:52] Scripore: has joined #RubyOnRails
[05:30:03] roxtrongo: has joined #RubyOnRails
[05:30:18] slayerjain: has joined #RubyOnRails
[05:33:22] turbo_MaCk: has joined #RubyOnRails
[05:37:39] moneylotion: has joined #RubyOnRails
[05:40:17] tejasmanohar_: has joined #RubyOnRails
[05:41:05] workmad3: has joined #RubyOnRails
[05:43:10] webguynow: has joined #RubyOnRails
[05:43:46] chouhoulis: has joined #RubyOnRails
[05:44:52] Pupeno: has joined #RubyOnRails
[05:48:05] moeabdol1: has joined #RubyOnRails
[05:49:46] rickmasta: has joined #RubyOnRails
[05:50:29] apg: has joined #RubyOnRails
[05:50:38] Cervajz: has joined #RubyOnRails
[05:53:55] yardenbar: has joined #RubyOnRails
[05:55:13] webguynow: has joined #RubyOnRails
[05:56:04] dideler: has joined #RubyOnRails
[05:56:26] comm64x: anyone have any words of wisdom on authorization solutions...RYO or go with a gem?
[05:58:13] liquid-silence: but comm64x it depends on how complex your stuff is
[06:01:54] comm64x: I would say my requirements are fairly simple, different account types ,e.g. admin, guest, registered user, and vip user, all but guest would require login
[06:02:21] comm64x: admin is obvious, reg user and vip user have separate dashboards
[06:02:56] tbuehlmann: I like recommending pundit as well
[06:03:35] liquid-silence: comm64x I rolled my own for that
[06:03:48] liquid-silence: but might switch to cancan
[06:04:19] comm64x: when would one opt to use pundit
[06:04:50] comm64x: as in how complex an app would you have that would necessitate a gem vs ryo
[06:05:08] annlewis: has joined #RubyOnRails
[06:06:58] andy888: has joined #RubyOnRails
[06:07:14] sevenseacat: why would you roll your own if you didnt have to>
[06:07:29] tbuehlmann: comm64x, pundit is pretty flexible, you just use ruby classes. so, as soon as I have to use some kind of authorization, pundit it is
[06:10:32] tkiel: has joined #RubyOnRails
[06:11:11] moeabdol1: has joined #RubyOnRails
[06:11:43] pawnbox: has joined #RubyOnRails
[06:11:56] mices: @us_cities = Club.where(country: "United States" AND state: :state).group(:city).order(:city)
[06:12:11] mices: can someone fix this for me
[06:12:14] Ropeney: has joined #RubyOnRails
[06:12:38] sevenseacat: we can show you the docs so you can fix it yourself
[06:12:57] sevenseacat: http://guides.rubyonrails.org/active_record_querying.html#hash-conditions
[06:15:17] Synthead: has joined #RubyOnRails
[06:18:26] SteenJobs: has joined #RubyOnRails
[06:22:15] mices: @us_cities = Club.where("country=? and state=?", United States, params[:state]).group(:city).order(:city)
[06:26:53] pawnbox_: has joined #RubyOnRails
[06:26:53] sevenseacat: i linked you to the section on using hashes for querying
[06:31:37] maz-dev: has joined #RubyOnRails
[06:33:54] bronson: has joined #RubyOnRails
[06:41:12] armyriad: has joined #RubyOnRails
[06:41:33] pawnbox: has joined #RubyOnRails
[06:42:25] arup_r: has joined #RubyOnRails
[06:42:59] eGGsha: has joined #RubyOnRails
[06:44:02] webguynow: has joined #RubyOnRails
[06:44:30] chouhoulis: has joined #RubyOnRails
[06:44:30] gambl0re: i want to create a show page for the users but devise doesnt create a show route.
[06:45:05] gambl0re: how would i create a user show page with devise?
[06:45:20] gambl0re: i tried creating a users resource and a users controller
[06:45:23] gambl0re: but it didnt work
[06:45:40] sevenseacat: define 'didnt work'
[06:47:17] gambl0re: i have a bunch of comments created by users. i made the usernames a link to their user page. the path name is correct in the url but it keeps redirecting to the logged in user's page only
[06:47:33] gambl0re: user/1, user/2, user/3 etc...will always redirect to the user that is logged in
[06:47:52] gambl0re: i dont even have a user/3 id but it still redirects to logged in user's page
[06:48:03] sevenseacat: and your code for the users controller looks like?
[06:48:34] gambl0re: do you understand what my issue is?
[06:48:49] sevenseacat: do you understand what my question is
[06:50:06] gambl0re: why you gotta give attitude all the time, seriously
[06:50:35] sevenseacat: I'll take that as a no
[06:50:38] gambl0re: you do the same to others...
[06:50:44] SteenJobs: has joined #RubyOnRails
[06:50:48] sevenseacat: I can't help you figure out your problem without seeing the code you've written.
[06:50:55] gambl0re: i understand that...
[06:51:00] sevenseacat: so please show me the code?
[06:51:34] sevenseacat: was there a hidden 'sudo' in there or something
[06:51:52] sevenseacat: (first time) 'show me the code' 'OMG U ATTITUDE' (second time) 'show me the code' 'ok'
[06:54:03] gambl0re: i asked if you understood my issue and you as usual you replied back with an attitude
[06:54:35] gambl0re: you could have just answered yes/no and asked your second question.
[06:54:51] sevenseacat: I only asked you one question, which you still havent answered
[06:55:01] sevenseacat: what does the code for your users controller look like?
[06:55:24] gambl0re: im getting it.
[06:55:27] webguynow: has joined #RubyOnRails
[06:56:03] gambl0re: https://gist.github.com/anonymous/8a073d245c0372752923
[06:56:20] apg: has joined #RubyOnRails
[06:56:20] apg: has joined #RubyOnRails
[06:56:44] gambl0re: you're from perth?
[06:57:02] charliesome: has joined #RubyOnRails
[06:57:08] sevenseacat: https://gist.github.com/anonymous/8a073d245c0372752923#file-users-controller-L3 this wont help when you're trying to show other users.
[06:57:41] apg: has joined #RubyOnRails
[06:57:41] apg: has joined #RubyOnRails
[06:57:44] gambl0re: come to northbridge
[06:57:52] sevenseacat: do i have to?
[06:58:39] gambl0re: ok can you point me in the right direction?
[06:58:54] sotojuan: has joined #RubyOnRails
[06:59:04] sevenseacat: you want to show the user whos ID is in the URL, right
[06:59:13] sevenseacat: eg. /users/2 shows user ID 2
[06:59:14] apg: has joined #RubyOnRails
[06:59:26] gambl0re: yea and it was showing that in the url bar
[06:59:40] gambl0re: but obviously something is wrong
[06:59:49] sevenseacat: so in your action you should look up the correct user, just like your movies controller looks up the correct movie
[07:00:44] iateadonut: has joined #RubyOnRails
[07:00:50] apg: has joined #RubyOnRails
[07:00:50] apg: has joined #RubyOnRails
[07:01:09] gambl0re: @user = User.find(params[:id] ?
[07:02:10] apg: has joined #RubyOnRails
[07:02:25] gambl0re: i didnt know it was something simple like that
[07:06:03] annlewis: has joined #RubyOnRails
[07:06:08] gambl0re: let me know when you want to meet up in nb!
[07:08:20] webguynow: has joined #RubyOnRails
[07:12:12] KnownSyntax: has joined #RubyOnRails
[07:15:02] bruno-: has joined #RubyOnRails
[07:17:15] Lightsword: has joined #RubyOnRails
[07:18:01] platzhirsch: has joined #RubyOnRails
[07:19:27] Pupeno: has joined #RubyOnRails
[07:20:44] mission712: has joined #RubyOnRails
[07:23:42] moeabdol1: has joined #RubyOnRails
[07:26:13] webguynow: has joined #RubyOnRails
[07:28:02] rickmasta: has joined #RubyOnRails
[07:29:14] workmad3: has joined #RubyOnRails
[07:29:45] chipotle: has joined #RubyOnRails
[07:29:52] pawnbox_: has joined #RubyOnRails
[07:38:49] moeabdol1: has joined #RubyOnRails
[07:39:18] JohnBat26: has joined #RubyOnRails
[07:45:14] chouhoulis: has joined #RubyOnRails
[07:46:57] Pupeno: has joined #RubyOnRails
[07:46:57] Pupeno: has joined #RubyOnRails
[07:48:53] liquid-silence: has joined #RubyOnRails
[07:51:19] BlackCoyote: has joined #RubyOnRails
[07:54:02] brandon: has joined #RubyOnRails
[07:55:51] jgt: has joined #RubyOnRails
[07:57:37] m49p13: has joined #RubyOnRails
[08:00:12] stardiviner: has joined #RubyOnRails
[08:03:48] M46P13: has joined #RubyOnRails
[08:04:44] AzaToth: has joined #RubyOnRails
[08:04:44] webguynow: has joined #RubyOnRails
[08:06:04] ahmgeek: help set entrymsg
[08:06:16] ahmgeek: set entrymsg
[08:06:17] mices: https://gist.github.com/anonymous/101ff0c6f9c2077d81ac
[08:06:49] annlewis: has joined #RubyOnRails
[08:07:34] pawnbox: has joined #RubyOnRails
[08:08:01] kitsuneyo: has joined #RubyOnRails
[08:08:46] stevednd: has joined #RubyOnRails
[08:09:06] kitsuneyo: has joined #RubyOnRails
[08:11:20] helpa: mices: Learn Ruby by reading this book - http://manning.com/black3 - The Well-Grounded Rubyist by David A. Black
[08:12:56] voker57: has joined #RubyOnRails
[08:14:16] webguynow: has joined #RubyOnRails
[08:16:18] krz: has joined #RubyOnRails
[08:17:30] krz: sevenseacat: using zgen or antigen?
[08:17:37] darutoko: has joined #RubyOnRails
[08:17:44] sevenseacat: i dont know what they are, so i'll say no.
[08:19:29] Ropeney: has joined #RubyOnRails
[08:19:29] quazimodo: has joined #RubyOnRails
[08:19:47] krz: sevenseacat: not using a plugin manager for zsh?
[08:20:15] jgt1: has joined #RubyOnRails
[08:20:26] moeabdol1: has joined #RubyOnRails
[08:20:32] krz: sevenseacat: your telling me you arent using any of the fancy plugins like the fish like auto suggestions (https://github.com/tarruda/zsh-autosuggestions)?
[08:20:53] sevenseacat: thats correct.
[08:21:58] Ropeney: has joined #RubyOnRails
[08:22:26] maz-dev: has joined #RubyOnRails
[08:25:34] pawnbox: has joined #RubyOnRails
[08:25:43] liquid-silence: has joined #RubyOnRails
[08:26:26] maz-dev: has joined #RubyOnRails
[08:27:26] stannard: has joined #RubyOnRails
[08:30:20] tbuehlmann: krz, I'm using zaw-history (https://github.com/zsh-users/zaw)
[08:32:30] sanjayu: has joined #RubyOnRails
[08:33:18] webguynow: has joined #RubyOnRails
[08:38:23] roxtrongo: has joined #RubyOnRails
[08:42:49] kitsuneyo: has joined #RubyOnRails
[08:45:32] kitsuneyo: has joined #RubyOnRails
[08:45:48] Karpah: has joined #RubyOnRails
[08:46:01] chouhoulis: has joined #RubyOnRails
[08:46:27] futilegames: has joined #RubyOnRails
[08:47:32] michael_mbp: has joined #RubyOnRails
[08:52:03] melonstorm: has joined #RubyOnRails
[08:53:27] kitsuneyo: has joined #RubyOnRails
[08:54:56] DoubleMalt: has joined #RubyOnRails
[08:55:56] moeabdol1: has joined #RubyOnRails
[08:57:37] moei: has joined #RubyOnRails
[08:58:06] moeabdol: has joined #RubyOnRails
[08:58:19] USvER: has joined #RubyOnRails
[08:58:40] arup_r: USvER: hello
[08:59:45] USvER: How can i define instance level variable (@variable) to have a default value on a class level including inheritance
[09:00:33] arup_r: USvER: The way you are thinking is wrong.
[09:00:57] USvER: I want to have @breadcrumbs variable to be defined in a ApplicationController witha default value, and than in all other controllers i want to append to it
[09:01:26] arup_r: That is easy
[09:02:28] arup_r: USvER: define it there.. then use before_action hook to call it in controllers where you wnt it to use
[09:02:31] USvER: arup_r, hm... can't seem to find a solution....
[09:03:05] arup_r: The method will be available to all controllers unless they are the child of ApplicationController
[09:03:41] pawnbox: has joined #RubyOnRails
[09:03:46] USvER: Ok, maybe i'm not explained properly i will provide some example code
[09:03:53] liquid-silence: has joined #RubyOnRails
[09:05:34] kitsuneyo: has joined #RubyOnRails
[09:07:26] USvER: arup_r Somethisng like this https://gist.github.com/USvER/c3739d93121a55675a99
[09:07:26] annlewis: has joined #RubyOnRails
[09:08:15] arup_r: USvER: one min :)
[09:11:21] arup_r: USvER: check the gist
[09:12:50] USvER: arup_r, aha, so the trick is to invoke class funtion on each instance to set the instance variables
[09:13:39] lxsameer: has joined #RubyOnRails
[09:13:40] lxsameer: has joined #RubyOnRails
[09:13:47] USvER: arup_r, thanks, any idea how to make this more pretty?
[09:14:17] arup_r: more pretty means?
[09:14:28] bonhoeffer: has joined #RubyOnRails
[09:15:22] mosez: has joined #RubyOnRails
[09:15:59] USvER: i would like to see it more like my code...
[09:16:08] tbuehlmann: USvER, although breadcrumbs aren't a too complex thing to write, have you checked for gems out there?
[09:16:09] USvER: arup_r, but never mind
[09:16:25] USvER: tbuehlmann, yeah, all of them...
[09:16:44] USvER: tbuehlmann, only one provides templates to change
[09:17:09] arup_r: USvER: That's the way to go. No idea what are you missing ? :)
[09:17:23] workmad3: has joined #RubyOnRails
[09:18:14] arup_r: more nice way to create a separate class and keep it in lib/ and use it as you go.. and create a object of the class in the application controller..
[09:18:16] zpe: has joined #RubyOnRails
[09:18:27] arup_r: these are just my 2 cents hints BTW :)
[09:18:37] arup_r: No idea exactly what you are doing..
[09:18:55] arup_r: But you can take this route.. It seems to be a CLEAN approach
[09:18:56] USvER: So my ultimate goal is to have @breadcrumbs variable in the view to render my own partial for breadcrumbs...
[09:19:19] arup_r: You will get the access once you set it like the way I shown you..
[09:19:28] arup_r: Your approach was wrong! :(
[09:19:42] arup_r: In Ruby say, you have
[09:19:47] mosez: has joined #RubyOnRails
[09:19:48] USvER: arup_r, yeah i know that... thats why i'm here
[09:20:19] arup_r: class Foo; end; Then Foo is a object and Foo.new is also a object.. so they both can have instance variables
[09:20:20] USvER: arup_r, but your approach is not that pretty
[09:20:37] arup_r: USvER: Did you know what I said above ?
[09:20:44] USvER: arup_r, yeah
[09:21:08] USvER: arup_r, that what i meant when i said Class level variables and Instance level variables
[09:21:11] arup_r: You created the instance variables for your class, not the instances.. that is why you had no access to it
[09:21:46] arup_r: USvER: You wouldn't be able to use class levels vars in views IMO
[09:21:52] USvER: Class object and Class instance is not the same.. i get it
[09:22:09] arup_r: yes.. that is why the before-set is the tool for you
[09:22:23] arup_r: before_action
[09:22:26] USvER: arup_r, is this the only way? =\
[09:22:43] arup_r: Why don't you like it ? :D
[09:22:50] tbuehlmann: USvER, https://gist.github.com/USvER/c3739d93121a55675a99#gistcomment-1577737
[09:23:18] tbuehlmann: but again, check out gems for that, there have to be something
[09:23:38] arup_r: ^^ more clean than me
[09:23:48] USvER: because instead of just @breadcrumbs.append i need to define private function and meke it run before actions
[09:24:06] mosez: has joined #RubyOnRails
[09:24:30] arup_r: USvER: nothing wrong with before_action..
[09:25:04] USvER: tbuehlmann, thanks... that looks a little bit cleaner...
[09:25:42] tbuehlmann: I bet that's what gems do
[09:25:52] mosez: has joined #RubyOnRails
[09:26:01] tbuehlmann: https://github.com/weppos/breadcrumbs_on_rails/blob/d27a796229d7ef2ba3e4a83221d2c0c4efb9390c/lib/breadcrumbs_on_rails/action_controller.rb#L26-L28
[09:26:02] tbuehlmann: dingdingding
[09:26:08] jgt1: has joined #RubyOnRails
[09:26:13] maz-dev: has joined #RubyOnRails
[09:26:37] USvER: tbuehlmann =)
[09:27:32] arup_r: USvER: That was a thought.. of mine.. No idea you were looking for very ready made one! :D
[09:28:08] USvER: tbuehlmann This is magic behind it https://github.com/weppos/breadcrumbs_on_rails/blob/d27a796229d7ef2ba3e4a83221d2c0c4efb9390c/lib/breadcrumbs_on_rails/action_controller.rb#L72
[09:28:30] USvER: tbuehlmann i guess that is what i'm looking for...
[09:29:23] arup_r: USvER: yes, use before_filter don't under estimate it. :p You have to go for it!
[09:29:34] Tempesta: has joined #RubyOnRails
[09:29:59] tbuehlmann: I rather would add the breadcrumbs in a before_action, but well
[09:29:59] USvER: You know, breadcrumbs should be easy...
[09:30:16] USvER: But somehow it's overcomplicated
[09:30:36] USvER: i don't need to instal gems for it...
[09:30:41] arup_r: tbuehlmann: +1
[09:31:10] tbuehlmann: if one likes to use the class method, so be it. doesn't make a big difference
[09:32:11] USvER: This sugar is what makes a Rails - Rails...
[09:33:21] Tempesta: has joined #RubyOnRails
[09:34:06] Pavster: has joined #RubyOnRails
[09:37:18] Coldblackice: has joined #RubyOnRails
[09:37:42] stamina: has joined #RubyOnRails
[09:38:52] kitsuneyo: has joined #RubyOnRails
[09:39:12] stardiviner: has joined #RubyOnRails
[09:40:51] Karpah: breadcrumbs_on_rails is a great gem, i use it whenever i need breadcrumb
[09:41:38] kitsuneyo: has joined #RubyOnRails
[09:42:09] alex88: has joined #RubyOnRails
[09:42:10] tbuehlmann: iirc, the twitter bootstrap gem also provides a breadcrumbs feature
[09:43:53] Coldblackice: has joined #RubyOnRails
[09:46:48] chouhoulis: has joined #RubyOnRails
[09:47:45] subshad: has joined #RubyOnRails
[09:48:01] USvER: tbuehlmann, Do i understand properly, "included " block gets evaluated on each instance https://github.com/weppos/breadcrumbs_on_rails/blob/d27a796229d7ef2ba3e4a83221d2c0c4efb9390c/lib/breadcrumbs_on_rails/action_controller.rb#L14
[09:48:06] qejk: has joined #RubyOnRails
[09:48:45] tbuehlmann: USvER, on the class
[09:50:56] USvER: tbuehlmann, hmm than i don't understand the magic behind this gem =\ there is two add_breadcrumb functions, i guess one for class and one for instance, and one function execute another one..???
[09:51:13] maz-dev: has joined #RubyOnRails
[09:51:52] USvER: tbuehlmann, than icluded block is defining the class level function, right?
[09:52:00] tbuehlmann: the add_breadcrumb class method adds a before_action callback, which calls the add_breadcrumb instance method before the action method is called
[09:52:38] tbuehlmann: that's AS::Concern magic. think of it as the self.included method when including a module (pure ruby, no rails)
[09:54:24] USvER: tbuehlmann, hmmm ok, i'm still not get it, but i guess i don't need to... i got the overall idea...
[09:55:09] tbuehlmann: the block from the included method is called in the context of the class in which the module is included
[09:55:36] USvER: tbuehlmann of a class, and not instance object?
[09:55:53] tbuehlmann: yes, of a class
[09:55:55] Juanchito: has joined #RubyOnRails
[09:56:02] USvER: tbuehlmann , my brain keeps telling me it should be called on an instance
[09:56:25] tbuehlmann: see https://gist.github.com/tbuehlmann/c94ce01a059668da3afb
[09:58:41] USvER: Ahaaaaa, now i see why it's needed, because otherwise this gem can't "patch" the ActionController
[09:59:33] USvER: Then need to get to the ActionController class... and that is what extend ActiveSupport::Concern and included blcok for
[09:59:46] DmitryBochkarev: has joined #RubyOnRails
[10:00:03] USvER: tbuehlmann, thanks man!
[10:00:15] USvER: tbuehlmann, now i get tit =\ dumb me
[10:00:25] kitsuneyo: has joined #RubyOnRails
[10:00:30] USvER: :D tit ahahahaa
[10:01:08] bruno-: has joined #RubyOnRails
[10:02:06] DEA7TH_: has joined #RubyOnRails
[10:02:37] liquid-silence: has joined #RubyOnRails
[10:08:12] annlewis: has joined #RubyOnRails
[10:08:30] pecpec: has joined #RubyOnRails
[10:14:43] hackeron: has joined #RubyOnRails
[10:15:05] Coldblackice: has joined #RubyOnRails
[10:17:31] zpe: has joined #RubyOnRails
[10:19:01] zpe: has joined #RubyOnRails
[10:20:01] Coldblackice: has joined #RubyOnRails
[10:23:12] AntiSpamMeta: has joined #RubyOnRails
[10:29:41] charliesome: has joined #RubyOnRails
[10:31:06] kitsuneyo: has joined #RubyOnRails
[10:34:37] startupality: has joined #RubyOnRails
[10:34:47] davidheward: has joined #RubyOnRails
[10:34:55] kitsuneyo: has joined #RubyOnRails
[10:36:00] srinidhi: has joined #RubyOnRails
[10:38:35] darrencauthon: has joined #RubyOnRails
[10:44:43] lulzmachine: has joined #RubyOnRails
[10:46:54] sanjayu: has joined #RubyOnRails
[10:47:32] chouhoulis: has joined #RubyOnRails
[10:49:47] allcentury: has joined #RubyOnRails
[10:55:05] e1th0r: has joined #RubyOnRails
[10:55:14] USvER: tbuehlmann: full solution https://gist.github.com/USvER/bc089a0a0a54c0802f9b
[10:55:38] USvER: tbuehlmann: works like a charm. Thanks man!
[10:56:00] violarium: has joined #RubyOnRails
[10:56:24] violarium: Hello! Dows somebody use mongoid 5 with rails?
[10:58:05] wethu: has joined #RubyOnRails
[11:00:00] bonhoeffer: has joined #RubyOnRails
[11:04:37] yashinbasement: has joined #RubyOnRails
[11:05:27] workmad3: has joined #RubyOnRails
[11:06:56] arup_r: USvER: very nice! great!
[11:07:37] ruurd: has joined #RubyOnRails
[11:07:39] arup_r: I can now read your thought...
[11:07:55] USvER: arup_r, simple, and somewhat preatier than manualy adding before_action, etc...
[11:08:09] arup_r: yes.. USvER I agree
[11:08:39] arup_r: Clean code depends on the scope and usecases...
[11:08:43] mercerist: has joined #RubyOnRails
[11:09:00] annlewis: has joined #RubyOnRails
[11:09:51] arup_r: As I said, I can see now your intentions.. I gave the a small step on this. some how you have to use before_filter.. But after that it depends on what you want to achieve..
[11:10:09] mostlybadfly: has joined #RubyOnRails
[11:10:36] arup_r: Now you need to add `add_breadcrumb` every controller where you need it.. and before_action behind the curtain is working..
[11:10:53] arup_r: just a layer on top of it..
[11:11:36] arup_r: more clean is now move it to concerns..
[11:14:00] workmad3: has joined #RubyOnRails
[11:15:46] arup_r: Q: I have http://localhost:3000/assets/1/resources/1/resources and http://localhost:3000/assets/1/resources/ and both points to the Asset#index action. Now I have some fields which I want to show in views when request comes from the second url but not from the first one. What is the best way to track this ?
[11:20:25] Palsson: has joined #RubyOnRails
[11:26:23] mercerist: has joined #RubyOnRails
[11:28:03] rikkipitt: has joined #RubyOnRails
[11:30:30] pwnd_nsfw: has joined #RubyOnRails
[11:31:18] arup_r: nvm, I got the hint from this method -- http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-current_page-3F
[11:31:34] m49p13: has joined #RubyOnRails
[11:31:46] workmad3: has joined #RubyOnRails
[11:32:25] USvER: Is there a posibility to define a operator for the result of function something like "def breadcrumbs<<(breadcrumb)"
[11:33:37] arup_r: USvER: yes using delegation
[11:34:15] arup_r: http://apidock.com/rails/Module/delegate
[11:34:41] arup_r: check examples ...
[11:40:36] brendan-: has joined #RubyOnRails
[11:40:59] USvER: arup_r delegate "breadcrumbs <<", to: :@breadcrumbs
[11:48:16] chouhoulis: has joined #RubyOnRails
[11:54:21] tbuehlmann: USvER, you could make #breadcrumbs return a BreadcrumbCollection object that responds to #<<
[11:54:46] tbuehlmann: also, breadcrumbs#<< should work nontheless
[11:55:04] tbuehlmann: but you have a method for that, remember?
[11:55:57] USvER: see, i want to get rid of add_breadcrumb and self.ad_breadcrumb methods... and make operator overloading for breadcrumbs <<
[11:56:28] USvER: that will still be diferentiating between class level and instance level
[11:58:04] USvER: tbuehlmann, something like this pseudo code https://gist.github.com/USvER/578cc61f0470fb545f94
[12:00:01] USvER: tbuehlmann, i know this pseudocode is not proper code and would have infinite recursion if it would work... but it's just to show you what i try to achive
[12:00:07] Cust0sLimen: how does passenger-status think PASSENGER_INSTANCE_REGISTRY_DIR is ?
[12:00:13] stannard: has joined #RubyOnRails
[12:00:19] Cust0sLimen: where does passenger-status think PASSENGER_INSTANCE_REGISTRY_DIR is rather ? if I dont set it
[12:00:31] Cust0sLimen: cos it seems default for apache is /tm/
[12:00:51] Cust0sLimen: */tmp/ - but default for passenger-status is elsewhere
[12:01:10] tbuehlmann: USvER, first decision: override << on the breadcrumbs array (not a fan) or have an object for the collection (big fan)
[12:02:04] tbuehlmann: USvER, second: have .breadcrumbs and #breadcrumbs return the same object. that sounds to me like class level state (one can do that, but well, do you really want to?)
[12:02:45] tbuehlmann: this object only lives for a request, so RequestStore comes to my mind. let me write something up real quick
[12:03:27] USvER: tbuehlmann, but again... @breadcrambs object does not know on wich level it is... Controller class or Instance of Controller class...
[12:03:39] dyleted: has joined #RubyOnRails
[12:03:48] tbuehlmann: that's because the object has to be the same, right?
[12:04:03] USvER: But operator should differ
[12:04:27] tbuehlmann: don't understand that. why?
[12:06:22] ruurd: has joined #RubyOnRails
[12:07:02] USvER: i want operator on a function... this is not possible...
[12:07:04] kitsuneyo: has joined #RubyOnRails
[12:07:07] USvER: i know that... =\
[12:07:20] tbuehlmann: #<< is a method, so no problem :)
[12:07:31] USvER: operators are on objects.. and in fact are methods
[12:08:08] tbuehlmann: something around this maybe: https://gist.github.com/tbuehlmann/786c97575b88ce74e5c9
[12:08:24] USvER: but this is wrong syntax "def breadcrumbs.<<(breadcrumb)"
[12:08:31] tbuehlmann: request store being a gem for storing state for just one request
[12:09:09] tbuehlmann: why should that be wrong syntax?
[12:09:15] tbuehlmann: that's defining a method on an object
[12:09:19] frmendes: has joined #RubyOnRails
[12:09:54] annlewis: has joined #RubyOnRails
[12:10:24] USvER: `<class:ApplicationController>': undefined local variable or method `breadcrumbs' for ApplicationController:Class (NameError)
[12:10:26] tbuehlmann: (made a little correction, update the gist)
[12:10:52] tbuehlmann: have to say, I highly do not recommend using the code I write right now
[12:11:35] USvER: tbuehlmann, i don't understand it )))
[12:11:44] USvER: tbuehlmann, anyway )
[12:11:52] tbuehlmann: what exactly don't you understand?
[12:12:01] tbuehlmann: I'm willing to explain ;)
[12:12:42] romdi: has joined #RubyOnRails
[12:13:44] USvER: [].tap block will be never evaluated?
[12:14:38] tbuehlmann: why do you think that?
[12:16:56] USvER: ah... i'm wrong...
[12:17:23] USvER: it's just oneliner for object instantiation
[12:18:13] mices: https://gist.github.com/anonymous/17a183592bc50dbc2e31
[12:18:20] USvER: So what exactly RequestStore[:breadcrumbs] will hold? Object with method "readcrumbs.<<"
[12:18:58] USvER: Why than we need RequestStore than?
[12:20:08] tbuehlmann: USvER, what do you think happens to the breadcrumbs object on the second http request? might be the same as for the first request, right? well the request store just stores the object for a single request
[12:20:25] tbuehlmann: but there's still an error in it, the object won't be cleared after the request. gonna change that..
[12:21:11] USvER: I do understand what is RequestStore for...
[12:21:44] USvER: But we store a method in it... and not he array itself
[12:21:53] USvER: This is what confuses me
[12:21:57] tbuehlmann: naw, we don't
[12:22:07] tbuehlmann: think of it as a hash
[12:22:19] tbuehlmann: that get's cleared at the end of a request
[12:22:28] USvER: totaly folowing it
[12:22:33] tbuehlmann: and we store an array in it
[12:22:37] tbuehlmann: the breadcrumbs array
[12:22:41] tbuehlmann: (updated the gist, btw)
[12:23:10] tbuehlmann: let me rewrite the tap stuff, maybe that's just confusing
[12:23:14] USvER: But w8.. we store the object with "def breadcrumbs.<<(breadcrumb)" on it
[12:23:56] tbuehlmann: updated the gist
[12:24:04] tbuehlmann: maybe it gets clear now
[12:24:22] wildlander: has joined #RubyOnRails
[12:24:55] USvER: Aha! now we store array and function on it... now i see thanks
[12:25:15] tbuehlmann: we store an array object in it that has the << method overriden, yes
[12:27:58] USvER: tbuehlmann, ok now i see... now every time we call breadcrumbs method(on class on instance) we are working with the same object stored in RequestStore
[12:28:59] USvER: Then i dont need to overload <<...
[12:29:25] tbuehlmann: heh, yea, right
[12:29:44] USvER: But now i need this Request Store
[12:29:50] USvER: It's not in core right?
[12:30:25] tbuehlmann: yes, it's not, it's a gem
[12:30:55] USvER: Thanks dude. You rock!... Nice idea...
[12:31:23] The_Phoenix1: has joined #RubyOnRails
[12:31:24] nfk: has joined #RubyOnRails
[12:31:36] FCser: has joined #RubyOnRails
[12:32:03] tbuehlmann: another idea, why not make it an object? https://gist.github.com/tbuehlmann/33ab57e537d26671f177
[12:32:45] bruno-: has joined #RubyOnRails
[12:33:39] USvER: tbuehlmann hmmm but again we need to return the same @breadcrumbs object from Class and Instance of controller
[12:34:13] Scripore: has joined #RubyOnRails
[12:34:24] startupality: has joined #RubyOnRails
[12:34:31] CheckYourSix: has joined #RubyOnRails
[12:34:37] tbuehlmann: might be overengineered now, because it really is just an array
[12:34:56] USvER: tbuehlmann and the only possible way of doing it is to use "def breadcrumbs" and "def self.breadcrumbs"
[12:35:03] tbuehlmann: but who knows what the future will bring. at least that's not a too bad idea
[12:35:22] User458764: has joined #RubyOnRails
[12:35:40] USvER: tbuehlmann still thinking on how to make it wok...
[12:35:43] tbuehlmann: of doing what exactly?
[12:36:50] meatherly: has joined #RubyOnRails
[12:36:56] wethu: has joined #RubyOnRails
[12:39:30] Kallis: has joined #RubyOnRails
[12:41:56] USvER: the end goal https://gist.github.com/USvER/b85d3f1001aa35196d98
[12:42:40] tbuehlmann: yeah, pasted the solution to this
[12:42:56] yopp: is it possible to set dotenv path to use a .env outside the rails root?
[12:43:05] USvER: tbuehlmann RequestStore is nice idea, and give the same object on different levels..
[12:43:35] Ropeney: has joined #RubyOnRails
[12:43:49] USvER: tbuehlmann i'm just thinking if there is another way
[12:44:08] mices: i'm trying to build a link to an action called "us_cities" in a controller named "clubs" passing it the parameter st.state so my app can print links to every city in st.state but i don't know what i'm doing and right now i'm using the path clubs/us_cities/st.state in my link_to expression but that's not working <%= link_to st.state, clubs/us_cities/st.state %>
[12:45:25] mices: wait somethings not right here
[12:46:25] mices: yea that's what i'm trying to do
[12:46:55] codenapper: has joined #RubyOnRails
[12:47:06] tbuehlmann: USvER, there's another shorthand available: `delegate :breadcrumbs, to: :class`
[12:47:17] tbuehlmann: that will delegate the instance method call to the class
[12:47:29] tbuehlmann: but other than that? nothing comes to my mind
[12:47:34] johnflux: has joined #RubyOnRails
[12:47:34] Kallis: has joined #RubyOnRails
[12:47:44] tbuehlmann: you have to have an object holding the breadcrumbs, the rest is accessing that object
[12:47:47] kitsuneyo: has joined #RubyOnRails
[12:48:44] USvER: tbuehlmann: Currently there is two ways: 1) RequestStore, 2) Dynamicaly call before_action on class level to setup Instance level variable
[12:48:52] kitsuneyo: has joined #RubyOnRails
[12:49:02] chouhoulis: has joined #RubyOnRails
[12:49:27] USvER: tbuehlmann is there other way around delegate from class to inctance )
[12:49:57] tbuehlmann: no, you don't have access to the instance (and you really shouldn't have)
[12:50:01] stardiviner: has joined #RubyOnRails
[12:50:28] USvER: tbuehlmann, using before_action i have =)
[12:50:35] tbuehlmann: beside using the before_action callback of course
[12:50:46] tbuehlmann: but that's not the same I think
[12:51:39] USvER: tbuehlmann, so all this thing about overloading operator is just to have one << operator for Instance level and one for class level that will use before_action trick
[12:52:53] bonhoeffer: has joined #RubyOnRails
[12:53:07] tbuehlmann: the real question for that is how to access the object from the instance and class scope
[12:53:19] tbuehlmann: and that we answered already
[12:53:29] petersaints: has joined #RubyOnRails
[12:54:33] kitsuneyo: has joined #RubyOnRails
[12:54:51] Ergo: has joined #RubyOnRails
[12:55:13] petersaints: has joined #RubyOnRails
[12:55:31] PublicSubnet: has joined #RubyOnRails
[12:56:12] workmad3: has joined #RubyOnRails
[12:57:03] lxsameer: has joined #RubyOnRails
[12:57:03] lxsameer: has joined #RubyOnRails
[12:57:53] USvER: tbuehlmann, this is wrong syntax "def self.breadcrumbs.<<(breadcrumb)"
[12:58:37] USvER: tbuehlmann, so i can't define overload for class level
[12:58:54] tbuehlmann: I think you are confusing things
[12:59:08] tbuehlmann: what do you want to achieve with this code?
[12:59:40] PublicSubnet: has joined #RubyOnRails
[12:59:59] USvER: Overload << operator only for the class level breadcrumbs object
[13:00:48] tbuehlmann: as the object will be the same, that doesn't make sense. unless you want to have some kind of proxy object, which you really doesn't need
[13:01:21] tbuehlmann: I don't see the problem right now
[13:01:34] USvER: anyway the end goal is this https://gist.github.com/USvER/b85d3f1001aa35196d98
[13:02:02] USvER: and breadcrumbs does not need to be the same object
[13:02:10] chills42: has joined #RubyOnRails
[13:02:34] USvER: it just needs to have the << operator to be different for Class and Istance
[13:03:05] tbuehlmann: I already gave the solution to that problem
[13:03:17] USvER: Yes you are...
[13:03:23] tbuehlmann: and yes, the object has to be same to make sense
[13:03:24] USvER: Sorry for taking your taime
[13:03:45] tbuehlmann: what's unclear? don't get it yet
[13:03:45] USvER: Thanks. You was really helpfull... I've learned alot
[13:05:26] kitsuneyo: has joined #RubyOnRails
[13:05:54] USvER: Solution with before_action is really cool... but what i don't like is that it needs custom functions like add_breadcrumb.. wich makes sense and are fine... But what i would expect is and object and not function... Wich is only possible with RequestStore... unfortunately
[13:06:31] USvER: Sorry for bothering you...
[13:06:57] stannard: has joined #RubyOnRails
[13:07:26] tbuehlmann: you can have only one function, but then you don't have a fancy class method but a before_action instead
[13:07:59] daniellutz_: has joined #RubyOnRails
[13:09:13] rapha: has left #RubyOnRails: ("WeeChat 1.3")
[13:09:41] DoubleMalt: has joined #RubyOnRails
[13:10:40] annlewis: has joined #RubyOnRails
[13:11:30] frmendes: has joined #RubyOnRails
[13:11:58] Jasaka: has joined #RubyOnRails
[13:13:05] chills42: has joined #RubyOnRails
[13:16:21] Palsson: has joined #RubyOnRails
[13:17:28] arBmind: has joined #RubyOnRails
[13:18:20] mices: https://gist.github.com/anonymous/ef64254213b0e8720310
[13:18:40] platzhirsch: has joined #RubyOnRails
[13:18:52] davispuh: has joined #RubyOnRails
[13:21:39] Speed: has joined #RubyOnRails
[13:21:46] bruno-: has joined #RubyOnRails
[13:22:19] Speed: hi, I'm trying to figure out how to define new scoped associations:
[13:22:27] Speed: I have the following
[13:22:29] Speed: has_many :classifications, dependent: :delete_all, inverse_of: :product
[13:22:31] Speed: has_many :taxons, through: :classifications
[13:22:50] Speed: now I'm trying to define an artists association, where artists is taxons + where(type: 'artist')
[13:23:08] Speed: so basically the same association with a default scope
[13:24:17] Speed: I need the association because I'm trying to do as has many through on it:
[13:24:40] rushed: has joined #RubyOnRails
[13:24:42] Speed: has_many :artist_products, through: :artists, source: :products
[13:26:31] cina: Is there a shortcut for Model.all.select(:field).map(&:field) ?
[13:27:30] cina: Oh yes, I forgot that! Thanks! :D
[13:29:18] jsrn_: has joined #RubyOnRails
[13:31:42] futilegames: has joined #RubyOnRails
[13:34:12] mission712: has joined #RubyOnRails
[13:35:56] krz: has joined #RubyOnRails
[13:43:37] atomical: has joined #RubyOnRails
[13:43:45] petersaints: has joined #RubyOnRails
[13:43:51] sanjayu: has joined #RubyOnRails
[13:45:41] mrchris: has joined #RubyOnRails
[13:47:07] stannard: has joined #RubyOnRails
[13:49:45] chouhoulis: has joined #RubyOnRails
[13:50:06] mrchris: has joined #RubyOnRails
[13:50:46] huck5: I'm trying to find all instances of a model within my database, using AR, by searching for multiple parameters. I've tried using the where clause (e.g. `Car.where(colour_id:1, manufacturer_id:2)`), but testing if the result is nil always comes back as false.
[13:51:26] huck5: This must be because the where clause returns a collection, which is never nil even if it is empty. Is there a function similar to `find` that allows me to search for multiple, specified attributes?
[13:51:49] huck5: And returns an instance of the requested model back*
[13:52:16] contradictioned: has joined #RubyOnRails
[13:53:25] rushed: huck5: find_by
[13:53:30] krz: has joined #RubyOnRails
[13:53:38] huck5: rushed, thanks. Was just going to report that I discovered it :P.
[13:54:02] huck5: If I am looking for a single instance of the object, find_by would be faster, correct?
[13:54:12] huck5: as opposed to finding a collection and testing if it is empty, I mean.
[13:54:22] romdi`: has joined #RubyOnRails
[13:55:22] rushed: huck5: like the answer to most questions that include the word faster... it depends~
[13:55:45] huck5: That makes sense, thanks
[13:55:56] ruurd: has joined #RubyOnRails
[13:57:16] dstarh: has joined #RubyOnRails
[13:57:47] kitsuneyo: has joined #RubyOnRails
[13:59:12] mices: how would this route be expressed in a link_to statement: get 'clubs/:state'
[14:03:52] FailBit: link to club_path(state)
[14:03:55] lwu: has joined #RubyOnRails
[14:03:57] statusfailed: has left #RubyOnRails: ()
[14:03:59] USvER: How can i make instance level function available on a class?
[14:05:12] rushed: USvER: change it to a class level function?
[14:05:18] USvER: Without renaming it to "self."+name
[14:05:21] havenwood: has joined #RubyOnRails
[14:05:27] pecpec: has joined #RubyOnRails
[14:05:33] rushed: USvER: why do you not want to do that?
[14:06:33] USvER: rushed i want to get Rails.application.routes.url_helpers on a ActionController class level
[14:06:33] FailBit: wrap it in class<<self; def thing; end
[14:06:49] FailBit: USvER: use extend instead of include
[14:07:29] Radar: USvER: !rule0
[14:07:29] helpa: USvER: 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.
[14:07:45] tbuehlmann: USvER, there's a reason why breadcrumb libraries can take symbol arguments (helpers not available on class scope)
[14:08:02] contradictioned: has joined #RubyOnRails
[14:08:42] kitsuneyo: has joined #RubyOnRails
[14:09:21] Radar: USvER: Why do you want it on a class level? Show us in code what it is exactly you're trying to do rather than telling us
[14:09:23] Radar: !xyproblem
[14:09:23] helpa: http://mywiki.wooledge.org/XyProblem
[14:11:17] annlewis: has joined #RubyOnRails
[14:11:29] USvER: that's helped class<<self; include Rails.application.routes.url_helpers end
[14:11:32] mices: FailBit: ty
[14:11:46] USvER: FailBit, thaks!
[14:12:20] USvER: FailBit, extends didn't helped
[14:12:32] mices: FailBit: not clubs_path(state) ?
[14:12:33] ericjphillips: has joined #RubyOnRails
[14:12:46] USvER: tbuehlmann , yeah, now i see that
[14:12:50] Radar: mices: !routing
[14:12:50] helpa: mices: http://guides.rubyonrails.org/routing.html - Rails Routing From the Outside In - Rails Guide - by Mike Gunderloy
[14:13:04] Radar: mices: look at "rake routes". It will tell you the helper to use
[14:14:09] huck5: How can I run my tests in a sandbox database...? I want to ensure that my tests don't effect the actual contents of my database..
[14:14:20] rushed: huck5: that's the default
[14:14:25] Radar: huck5: Tests run automatically in a "test" database as configured in config/database.yml
[14:14:37] Radar: they won't touch the data in either the development or production databases
[14:14:53] huck5: rushed, oh ok. I just noticed that on one of my Create tests there was already data present in the db.
[14:15:15] Radar: Likely not cleaned up after another test
[14:15:22] huck5: Is it the case that the "test" database will reset on each *_test.rb file?
[14:15:26] huck5: Ah, thanks
[14:15:30] frmendes: has joined #RubyOnRails
[14:15:54] huck5: And, finally, is there a simple command I can call to reset the test database?
[14:16:07] Radar: huck5: look into using the database_cleaner gem
[14:16:14] huck5: Radar, Thank you!
[14:16:23] Radar: rake db:test:prepare will reset it, but it's not something that you should be calling all the time to reset it
[14:16:27] sanjayu: has joined #RubyOnRails
[14:16:51] podman: has joined #RubyOnRails
[14:17:09] huck5: Would it be better practice to wipe the database this way, or if I am expecting the absence of a specific object in the db, to just search for this object and delete it (within my specific test case), before continuing?
[14:17:24] Radar: Clean it first with database_cleaner.
[14:18:08] huck5: Thanks again!
[14:19:03] petersaints: has joined #RubyOnRails
[14:19:50] maz-dev: has joined #RubyOnRails
[14:20:36] yottanami: has joined #RubyOnRails
[14:22:27] mices: FailBit: that syntax you gave me "club_path(state)" gets me undefined local variable or method `state'
[14:23:02] shinnya: has joined #RubyOnRails
[14:23:03] Radar: mices: why do you think that might be?
[14:23:10] Radar: might it be because state is undefined?
[14:23:45] umgrosscol: has joined #RubyOnRails
[14:25:11] gp5st: has joined #RubyOnRails
[14:25:23] arup_r: has joined #RubyOnRails
[14:27:50] krz: has joined #RubyOnRails
[14:31:01] liquid-silence: has joined #RubyOnRails
[14:34:53] mices: Radar: defining it didn't help (i had defined a couple of lines up with "state=club.state" but that got me the same error "undefined method or variable", using @state and (@state) instead of state and (state) in the assignment and link_to didn't help either, but when i took out the assignment and substituted (club.state) for (state) in the link_to , then it worked
[14:34:54] Balzrael: has joined #RubyOnRails
[14:35:22] FailBit: it's like you don't even understand ruby...
[14:35:28] FailBit: let alone rails
[14:37:22] sevenseacat: thats why i keep pointing them towards the well-grounded rubyist to start leaning ruby first
[14:37:41] mices: why didn't the assignment work with the link_to but when i use club.state in the link_to that works
[14:39:15] rushed: mices: you didn't do what you think you did? gist the version that doesn't work allong with the complete error message & stack if you want to know for sure
[14:41:47] vdmo: has joined #RubyOnRails
[14:43:31] huck5: Here's a silly question: How can I tell what Gem I am using for testing. I think I am using Minitest, but how can I be sure of this?
[14:43:47] huck5: Or, is minitest used in conjuction with RSpec?
[14:43:59] FailBit: they're separate
[14:44:17] workmad3: has joined #RubyOnRails
[14:44:21] huck5: FailBit, so then if I'm requiring minitest within my test_helper.rb, I'm probably using minitest :P?
[14:44:29] FailBit: if you used rspec, you'd have to run rpsec to run the tests
[14:44:45] FailBit: minitest is run by rake test
[14:44:50] huck5: FailBit, Ok. I'm just calling `bundle exec rake test` to run my tests. Yeah ok, thanks!
[14:45:12] FailBit: and some people prefer Test::Unit, believe it or not
[14:45:35] huck5: FailBit, to run a specific test, you mean?
[14:45:59] FailBit: Test::Unit, the ruby unittest framework
[14:46:11] huck5: Oh, I see! Thank you.
[14:46:24] FailBit: which is different from Minitest for rails, which is more of an integration test than a unit test
[14:46:36] srinidhi: has joined #RubyOnRails
[14:48:15] huck5: Ok, then Minitest seems like what I want. This brings me to my next question, which is related to setting up the DatabaseCleaner gem to work with my tests. The docs say to use something like this https://gist.github.com/Huck5/781e9ccac99579e0f12d . Where should I be writing this code, though? In my test_helper.rb?
[14:49:42] huck5: I ran into "NoMethodError: undefined method `before' " when I added the before/after methods to my effects_controller.rb file...
[14:50:31] chouhoulis: has joined #RubyOnRails
[14:50:55] huck5: Never mind. I think I need the minitest-around gem. Thanks.
[14:51:42] Speed: has left #RubyOnRails: ("WeeChat 1.3")
[14:51:49] mrchris: has joined #RubyOnRails
[14:56:48] SteenJobs: has joined #RubyOnRails
[14:57:16] Guest61: has joined #RubyOnRails
[14:57:25] darrencauthon: has joined #RubyOnRails
[14:58:30] h7br1x: has joined #RubyOnRails
[15:03:34] Balzrael: has joined #RubyOnRails
[15:03:55] jcm: has joined #RubyOnRails
[15:03:56] Balzrael: has joined #RubyOnRails
[15:04:13] robwri32_: has joined #RubyOnRails
[15:05:03] robwri32_: Good Morning!
[15:05:16] USvER: [UJS] How can I programaticaly fire remote request to the server? tried $.rails.handleRemote(); But it's expecting element and not URL
[15:05:22] Papierkorb: Is it possible to run a migration against all models which include a certain model concern?
[15:06:05] USvER: Papierkorb, you can rum migration by model??? O_O
[15:06:13] frmendes: has joined #RubyOnRails
[15:06:21] krz: has joined #RubyOnRails
[15:06:47] Papierkorb: USvER: That's crap, then I'd need to add/remove/alter columns for each. [:foos, :bars].each{} is only a work-around for that.
[15:07:24] Papierkorb: If I ever add another model which includes one of those concerns, which is likely to happen, then I'll have to duplicate the current 'state' into a new migration. That sucks.
[15:08:10] lord4163: has joined #RubyOnRails
[15:09:02] USvER: Papierkorb, mmm sorry i don't understand, you want to change migrations that you already migrate on?
[15:09:34] Papierkorb: No. I have concern Fooable. I include Fooable into various models, and now I want to write a single migration which acts on all Fooables
[15:10:18] USvER: Papierkorb, i would look for Concerns to Migrations generator...
[15:10:42] FailBit: Papierkorb: I think your best bet is to enumerate and iterate the models.
[15:10:51] FailBit: and also the simplest way
[15:11:00] Papierkorb: FailBit: that sucks when I add a new model and need to sync it to the current state
[15:11:10] FailBit: well too bad
[15:11:13] FailBit: migrations are a pain
[15:11:21] FailBit: but you have to live with them
[15:11:24] mrchris: has joined #RubyOnRails
[15:12:05] annlewis: has joined #RubyOnRails
[15:12:08] Papierkorb: What a design failure.
[15:13:10] USvER: Papierkorb, nope... migrations is really cool feature....
[15:13:11] FailBit: it's not a design failure.
[15:13:26] FailBit: migrations are extremely useful
[15:13:36] FailBit: they just don't always mesh with what you want
[15:13:40] Papierkorb: Where exactly did I say now that migrations are bad?
[15:14:06] FailBit: when did I say that you said they were bad
[15:14:25] Papierkorb: No I didn't. I said that concerns not being able to 'influence' them is a design failure.
[15:14:43] USvER: Can someone help me with rails ujs\ajax remote
[15:14:48] atomical: has joined #RubyOnRails
[15:15:15] FailBit: except that the ActiveRecord way is not to define fields on models
[15:15:24] FailBit: other ORMs handle differently
[15:19:44] pecpec: has joined #RubyOnRails
[15:21:03] eGGsha: has joined #RubyOnRails
[15:22:30] USvER: FailBit, Papierkorb, actualy if in the concer you will define what fields should be added to the models table, than you can create a generator to create migrations for you...
[15:22:42] stannard: has joined #RubyOnRails
[15:22:53] EminenceHC: has joined #RubyOnRails
[15:23:54] robwri32_: has joined #RubyOnRails
[15:24:41] sanjayu: has joined #RubyOnRails
[15:24:48] pecpec: has joined #RubyOnRails
[15:28:02] srinidhi: has joined #RubyOnRails
[15:29:20] robwri32_: has left #RubyOnRails: ()
[15:29:26] robwri32_: has joined #RubyOnRails
[15:31:52] robwri32_: has left #RubyOnRails: ()
[15:31:54] robwri32_: has joined #RubyOnRails
[15:32:34] jyraff: has joined #RubyOnRails
[15:35:31] jyraff: hello. I did everything as written here https://github.com/plataformatec/devise/wiki/How-To:-Test-controllers-with-Rails-3-and-4-(and-RSpec) but I get this error NameError: undefined local variable or method `login_user'
[15:35:36] maz-dev_: has joined #RubyOnRails
[15:36:35] jyraff: I use devise 3.5.2 and rspec-rails 3.3.3
[15:40:46] User458764: has joined #RubyOnRails
[15:41:26] rushed: has joined #RubyOnRails
[15:42:17] bonhoeffer: has joined #RubyOnRails
[15:42:57] FailBit: if your devise models are not confirmable you could just write sign_in @user
[15:43:17] FailBit: however I suspect you have an inclusion missing somewhere
[15:43:39] fschuindt1: has joined #RubyOnRails
[15:44:44] n1lo: has joined #RubyOnRails
[15:46:51] rodfersou: has joined #RubyOnRails
[15:49:38] bonhoeffer: anyone having issues iwth heroku?
[15:50:05] bonhoeffer: https://status.heroku.com/
[15:50:59] rushed: bonhoeffer: AWS East cranky this morning
[15:50:59] Fuzai: <link rel="apple-touch-icon-precomposed" sizes="114x114" href="apple-touch-icon-114x114-precomposed.png"> how do I tell my html what the correct path of that is in rails? I can't find anything on erb/rails and the html link tag without finding all the link_to
[15:51:06] maz-dev: has joined #RubyOnRails
[15:51:20] chouhoulis: has joined #RubyOnRails
[15:51:26] bonhoeffer: rushed: ah . . .
[15:51:36] ahmgeek: has joined #RubyOnRails
[15:51:52] scott0101: has joined #RubyOnRails
[15:51:57] scott0101: has left #RubyOnRails: ()
[15:52:01] bkulbida: has joined #RubyOnRails
[15:52:04] ahmgeek: if I upload things via ajax, and I respod to it via server method, how can I cance' the upload ?
[15:52:06] rushed: Fuzai: you're not sure where to put the png or you're not sure how to get that in your html?
[15:52:16] moeabdol: has joined #RubyOnRails
[15:52:50] Fuzai: how to get it into my html, i moved the png into app/assets/images but I don't know how to work with a link tag in html / erb to give it the proper path to it
[15:53:29] Fuzai: would it be asset_path?
[15:53:34] rushed: Fuzai: you don't want to use the pipeline for that since you want a static filename, just put it in public
[15:54:37] moeabdol: has joined #RubyOnRails
[15:55:15] havenwood: has joined #RubyOnRails
[15:56:34] huck5: has joined #RubyOnRails
[15:57:22] dici: has joined #RubyOnRails
[15:58:51] darrencauthon: has joined #RubyOnRails
[15:59:04] niksw: has joined #RubyOnRails
[15:59:19] niksw: Hi everyone. Who can help me with models? For example I have model A, which has integer field weight. But this weight could be in different system like kg, lbs, ???. And when user enter weight for example in kg he should later be able to switch between kg, lbs, ??? . What is the best practice to do this? Should I create WeightsSystem model or something?
[15:59:32] greengriminal: has joined #RubyOnRails
[16:01:34] pawnbox: has joined #RubyOnRails
[16:01:38] rushed: niksw: couple options: a) pick a unit to always save/read in b) store both the value & unit
[16:02:29] niksw: has joined #RubyOnRails
[16:02:43] tianyi_: has joined #RubyOnRails
[16:05:27] sotojuan: has joined #RubyOnRails
[16:06:04] niksw: has joined #RubyOnRails
[16:06:09] tianyi_: has left #RubyOnRails: ()
[16:06:33] tianyi: has joined #RubyOnRails
[16:07:06] dideler: has joined #RubyOnRails
[16:07:42] tianyi: has left #RubyOnRails: ()
[16:08:46] tianyi: has joined #RubyOnRails
[16:10:58] ruurd: has joined #RubyOnRails
[16:11:47] allcentury: has joined #RubyOnRails
[16:12:59] annlewis: has joined #RubyOnRails
[16:14:12] platzhirsch: has joined #RubyOnRails
[16:14:15] huck5: Trying to implement database_cleaner gem so that it resets the database after each test case. I have this... https://gist.github.com/Huck5/575caef212479f5b5882 , but the database is not wiped before/after each test... what am I doing wrong?
[16:15:28] Papierkorb: If someone ends up with the same issue as me, this code works for me: https://gist.github.com/Papierkorb/5b660e464ca424b3a562
[16:16:34] krz: has joined #RubyOnRails
[16:18:27] rushed: huck5: you generally don't want to wipe your test db after each test
[16:18:53] greengriminal: has joined #RubyOnRails
[16:19:03] huck5: rushed, I can see why that would be. What is my setup currently doing, then? Is it wiping the database after each *_test.rb file is ran?
[16:19:20] allcentury: has joined #RubyOnRails
[16:19:22] SteenJobs: has joined #RubyOnRails
[16:19:26] exadeci: has joined #RubyOnRails
[16:19:30] rushed: huck5: I have no idea what your setup is doing~
[16:19:38] huck5: OK, thanks!
[16:20:04] rushed: huck5: usually the entire test suite is wrapped in a transaction that isn't committed -OR- the db is truncated at the start or end of everything
[16:20:33] rushed: huck5: but those are things you'd need to setup using something like db_cleaner or options in your testing tool
[16:21:07] huck5: That's pretty much what I thought. I'm just trying to set up a test-case that ensures a duplicate record is not entered into the database. I thought the best way to do this would be to clean the database prior to each test?
[16:21:30] huck5: Because right now there is data in the database from previous test cases, so I'm getting unexpected results.
[16:24:35] erichu: has joined #RubyOnRails
[16:24:51] atzorvas: has joined #RubyOnRails
[16:27:19] smathy: has joined #RubyOnRails
[16:28:07] briandeweese: has joined #RubyOnRails
[16:29:18] messine: has joined #RubyOnRails
[16:29:46] dstarh: has joined #RubyOnRails
[16:31:15] mices: FailBit: i tried "link_to club_path/us" to build a link to " get 'clubs/us' " is that wrong?
[16:31:37] mices: sorry wait
[16:32:05] mices: link_to 'US blues clubs', club_path/us
[16:32:27] workmad3: has joined #RubyOnRails
[16:32:28] FailBit: you don't understand ruby
[16:32:39] FailBit: I don't want to help you if you won't help yourself
[16:32:56] mices: reading the page on routes that you gave me didn't clarify the link_to
[16:33:25] mices: i need to learn how to pass paths to link_to
[16:33:52] FailBit: I'm not talking about link_to.
[16:34:04] FailBit: or even rails
[16:34:06] mices: here's my route get 'clubs/us' => 'clubs#us_states'
[16:34:07] FailBit: I'm talking about basic ruby syntax
[16:34:36] mices: i thought link_to helper is only in rails
[16:34:51] huck5: mices, if you are having trouble specifically with link_to, try reading the documentation here http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-link_to
[16:35:28] beauby: has joined #RubyOnRails
[16:35:35] chipotle: has joined #RubyOnRails
[16:36:01] Lightsword: has joined #RubyOnRails
[16:36:26] kies: has joined #RubyOnRails
[16:37:30] Palsson: has joined #RubyOnRails
[16:39:45] FCser: has joined #RubyOnRails
[16:40:34] Lightsword: has joined #RubyOnRails
[16:41:31] greengriminal: has joined #RubyOnRails
[16:42:20] n008f4g_: has joined #RubyOnRails
[16:43:55] rushed: has joined #RubyOnRails
[16:45:58] sanjayu: has joined #RubyOnRails
[16:48:52] bendangelo: has joined #RubyOnRails
[16:50:50] kitsuneyo: has joined #RubyOnRails
[16:52:04] chouhoulis: has joined #RubyOnRails
[16:52:35] bkulbida: has joined #RubyOnRails
[16:52:53] huck5: How can I prevent my database from seeding prior to running my tests?
[16:53:03] pawnbox_: has joined #RubyOnRails
[16:53:35] shevy: has joined #RubyOnRails
[16:53:56] yardenbar: has joined #RubyOnRails
[16:53:57] huck5: Or is the default behaviour not to seed the test database..?
[16:55:57] huck5: hm.. Never mind. Sorry about that.
[16:56:16] raunicolae: has joined #RubyOnRails
[16:58:10] pawnbox: has joined #RubyOnRails
[16:58:50] mices: does anyone use aptana? how in the world do you search for text in the current file
[16:59:36] darrencauthon: has joined #RubyOnRails
[16:59:55] chouhoulis: has joined #RubyOnRails
[17:01:34] daniellutz: mices: ctrl+f or cmd+f ?
[17:05:03] crdpink2: has joined #RubyOnRails
[17:07:10] maz-dev: has joined #RubyOnRails
[17:09:20] naftilos76: has joined #RubyOnRails
[17:09:58] platzhirsch: has left #RubyOnRails: ()
[17:10:43] maz-dev: has joined #RubyOnRails
[17:11:00] naftilos76: Hi, i am trying to add custom attributes in a checkbox that start with data- but i am not having luck if i add it in a rails helper checkbox. Does anybody know how i can do this without using plain html checkbox syntax ?
[17:11:27] naftilos76: http://www.w3schools.com/tags/att_global_data.asp
[17:11:32] marr: has joined #RubyOnRails
[17:11:41] banister: has joined #RubyOnRails
[17:13:35] annlewis: has joined #RubyOnRails
[17:13:44] pecpec: has joined #RubyOnRails
[17:13:46] richipargo: has joined #RubyOnRails
[17:14:34] mrchris: has joined #RubyOnRails
[17:14:48] frmendes: has joined #RubyOnRails
[17:15:55] rushed: naftilos76: , { 'data-foo' => 'a_value' }
[17:16:17] mices: how do i map a controller action to a view, i thought having a view with the same name was enough but the controller action us_states is passing rendering to show.html.erb instead of my newly created us_states.html.erb
[17:17:29] rushed: mices: what did you pass to render?
[17:17:49] naftilos76: rushed, dummy me, i forgot that the key can be both a symbol and a string! thanks
[17:17:58] mices: nothing there's no render statement
[17:18:02] Rodya_: has joined #RubyOnRails
[17:18:14] ruurd: has joined #RubyOnRails
[17:18:23] banjara: has joined #RubyOnRails
[17:18:41] rushed: mices: the default view is the controller action
[17:18:50] rushed: mices: maybe gist what you have w/ the routes
[17:18:57] roxtrongo: has joined #RubyOnRails
[17:19:03] scott0101: has joined #RubyOnRails
[17:19:42] scott0101: Hey, anyone know how to include concerns in a controller that does not inherit from ActionController
[17:20:57] rushed: scott0101: so then, not a controller?
[17:21:17] scott0101: well I have a controller that inherits from WebsocketRails::BaseController
[17:21:23] scott0101: but I can???t seem to include conerns in it
[17:21:31] mices: rushed: https://gist.github.com/anonymous/2b85d63f4858c7c3d3d8
[17:22:26] rushed: mices: sorry, what I ment was gist what you have *including* the routes (not just the routes) :)
[17:23:29] rushed: mices: although in this case the routes might be enough, your show action is probably being executed
[17:23:37] bleda: has joined #RubyOnRails
[17:23:41] rushed: mices: what does it say in the console when you hit the page?
[17:24:10] beauby: has joined #RubyOnRails
[17:24:13] rushed: mices: if you use a url that will match multiple routes it will hit the first one defined in your routes file
[17:25:35] chills42: has joined #RubyOnRails
[17:25:51] ahmgeek: has joined #RubyOnRails
[17:26:38] mices: NoMethodError in ClubsController#show
[17:27:10] rushed: mices: right, so that's it then :)
[17:27:34] centrx: has joined #RubyOnRails
[17:27:42] ahmgeek: guys, if Iam uploading with method called upload and wanted to cancel that thing, but want to make sure to rollback any changes might happened
[17:27:48] ahmgeek: and these things not ActiveRecord
[17:27:58] ekem: say i have a task in lib/tasks and i want to call some other script that parses a file from tmp, where would the be most appropiate place to put this gile
[17:28:00] ahmgeek: it's uploading stuff and processing stuff
[17:28:08] ekem: call it from the task that is
[17:28:12] bonhoeffer: has joined #RubyOnRails
[17:28:35] fschuindt: has joined #RubyOnRails
[17:28:44] ahmgeek: so. can I call another method that abort the upload method immediately
[17:28:45] mices: rushed: i didn't ask it to call the show method
[17:28:57] rushed: mices: your route does
[17:29:12] rushed: mices: /clubs/:id(.:format) clubs#show
[17:29:13] zpe: has joined #RubyOnRails
[17:30:04] mices: this is not /clubs/:id this is get '/clubs/us' => 'clubs#us_states'
[17:30:44] mices: it's taking 'us' for an id and matching show
[17:30:50] rushed: mices: exactly
[17:31:14] rushed: mices: due to the order in your routes
[17:31:17] mices: what about the route i defined for /clubs/us
[17:31:33] allcentury: has joined #RubyOnRails
[17:31:36] mices: it takes the first matching route
[17:31:51] rushed: mices: I may have mentioned that~
[17:34:25] 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")
[17:36:35] shevy: has left #RubyOnRails: ("I'll be back ... maybe")
[17:38:23] arup_r: suddenly in one file called users.coffee a simple js code also not working. I have there like
[17:38:45] arup_r: $(document).on 'ready page:load', (event) ->
[17:38:49] arup_r: console.log(12)
[17:39:03] arup_r: that 12 is not getting printed in the console..
[17:39:10] arup_r: what could be the reason ?
[17:39:41] rushed: has joined #RubyOnRails
[17:39:45] arup_r: I restarted my rails server also.. but no improvement
[17:39:58] chills42: has joined #RubyOnRails
[17:41:09] yaymukund: has joined #RubyOnRails
[17:44:59] acti0nman: has joined #RubyOnRails
[17:48:22] mices: rushed: https://gist.github.com/anonymous/f289753d422611debf6e
[17:49:15] rikkipitt: has joined #RubyOnRails
[17:50:05] mices: rushed: there's a before_action :set_club in the controller does that have to do with it
[17:51:18] mices: set_club is defined on bottom
[17:52:01] User458764: has joined #RubyOnRails
[17:53:44] rushed: mices: have to do with what?
[17:54:28] mices: why show is listed before my method in routes
[17:54:46] rushed: mices: no, the order in your routes file does
[17:55:02] rushed: mices: is in routes.rb, as in which one is closer to the top of the file
[17:55:48] mices: there's no route to show in routes.rb it's commented out but there's a "resources :clubs, only: [:show, :index]" all the way on top
[17:56:27] mices: sorry it's not commented out, it's not there at all
[17:56:48] rushed: mices: then you don't have the routes you gisted earlier (you have to restart your server after changing the routes file)
[17:57:13] rushed: and by server I mean rails not your machine
[17:58:25] Coldblackice: has joined #RubyOnRails
[17:59:56] spekode: has joined #RubyOnRails
[17:59:59] iamse7en: has joined #RubyOnRails
[18:00:21] darrencauthon: has joined #RubyOnRails
[18:00:30] ruurd: has joined #RubyOnRails
[18:00:33] scyth: has joined #RubyOnRails
[18:00:52] sotojuan: has joined #RubyOnRails
[18:01:48] scyth: Hi. If I have a User model with these associations: has_many :user_apps and has_many :owned_apps, -> { where(user_apps: {role: {name: 'owned'}}) }, :through => :user_apps, source: :app
[18:02:03] scyth: why AR is not joining roles table on user_apps?
[18:02:09] mices: rushed: i think we're confusing the output of rake routes with my routes.rb file
[18:02:24] mices: i'm saying there's no route to show in my routes.rb file
[18:02:45] rushed: mices: have you gisted your routes.rb?
[18:02:51] banjara: has joined #RubyOnRails
[18:03:14] rushed: mices: and if there is no route related to clubs/us why are you surprised it's using show?
[18:04:17] mices: rushed: https://gist.github.com/anonymous/6939db522532b827a6e2
[18:04:26] mices: there's a route to us_clubs, yes
[18:04:47] huck5: mices, `resources :clubs, only: [:show, :index]`
[18:05:03] rushed: mices: and is that route above or below resources :clubs?
[18:05:34] pawnbox: has joined #RubyOnRails
[18:06:23] tubbo: has joined #RubyOnRails
[18:06:47] tejasmanohar: has joined #RubyOnRails
[18:07:52] mices: so i have to include my method in that only: clause?
[18:08:03] craysiii: has joined #RubyOnRails
[18:08:25] annlewis: has joined #RubyOnRails
[18:08:26] huck5: mices, did you try?
[18:08:31] rushed: mices: do you see the comment "# The priority is based upon order of creation: first created -> highest priority."
[18:08:38] robwri32_: has joined #RubyOnRails
[18:09:02] nettoweb: has joined #RubyOnRails
[18:09:04] rushed: mices: did you see where we were talking about the order of items several times?
[18:09:35] GreatDanton: has joined #RubyOnRails
[18:09:38] rushed: mices: you need to take "get '/clubs/us' => 'clubs#us_states'" and move it ABOVE "resources :clubs, only: [:show, :index]" otherwise the show route gets hit as it just looks like a request for a club with an id of "us"
[18:09:50] EminenceHC: has joined #RubyOnRails
[18:10:38] rushed: mices: you might find this helpful if you want additional details on routes http://guides.rubyonrails.org/routing.html
[18:11:13] huck5: Is it better practice to create larger test cases that include a number of smaller cases? Or to create as low-level cases as possible?
[18:11:16] Kallis: has joined #RubyOnRails
[18:14:36] atmosx_laptop: has joined #RubyOnRails
[18:14:57] FailBit: https://i.imgur.com/qBdOPOo.png
[18:15:06] FailBit: huck5: depends on if you're doing integration or unit tests
[18:15:24] huck5: FailBit, integration. And lol.
[18:16:12] FailBit: then larger test cases work
[18:16:30] huck5: Ok, thank you.
[18:16:31] hnanon_: has joined #RubyOnRails
[18:17:32] hnanon_: Essay belongs to User, Review belongs to User, Review Belongs to Essay
[18:17:49] hnanon_: I want to count the number of reviews a user has written for a particular essay.
[18:17:59] hnanon_: user.essays.where(number: 0, stage: 0).last.reviews.count
[18:18:25] hnanon_: That's giving me an incorrect number, though.
[18:20:36] workmad3: has joined #RubyOnRails
[18:20:37] huck5: Can't you do something like `user.reviews.where(essay_id: @essay.id).count` ? Assuming that a User has_many Reviews?
[18:22:26] hnanon_: huck5: Let me try that.
[18:23:42] hnanon_: Actually, I don't think that will work; I need user reviews for a type of essay with the conditions above.
[18:24:00] hnanon_: number: 0, stage: 0
[18:24:14] rushed: has joined #RubyOnRails
[18:24:49] FailBit: user.essays.where(number: 0, stage: 0).last.reviews.where(user: user).count
[18:27:55] FailBit: also, if that works, I want you to never use that
[18:28:10] FailBit: user.essays.where(number: 0, stage: 0) might be nil
[18:28:24] FailBit: well, #last
[18:28:47] hnanon_: Failbit: It still gives me the wrong number.
[18:29:19] FailBit: then you are probably miscounting.
[18:29:38] hnanon_: Let me double check the number of reviews from the console...1 sec.
[18:31:26] tubbo: has joined #RubyOnRails
[18:33:11] hnanon_: How do I show all records in the console?
[18:34:36] FailBit: also, I didn't even realize newrelic had public charts
[18:34:52] FailBit: https://rpm.newrelic.com/public/charts/5HL9PuWRSLT
[18:35:53] rickmasta: has joined #RubyOnRails
[18:39:33] hnanon_: I think I have some orphaned records from previous deletions.
[18:39:34] FCser: has joined #RubyOnRails
[18:39:50] hnanon_: I just added ", dependent: :destroy" to my models to prevent that (I hope).
[18:41:33] chills42: has joined #RubyOnRails
[18:42:13] hnanon_: So, I have: has_many :essays, dependent: :destroy
[18:42:25] hnanon_: If I delete all users, should that also delete all essays?
[18:43:36] centrx: hnanon_, right
[18:45:02] stannard: has joined #RubyOnRails
[18:45:27] krz: has joined #RubyOnRails
[18:46:33] stamina: has joined #RubyOnRails
[18:46:58] hnanon_: centrx: I didn't :(
[18:47:31] rushed: hnanon: how did you delete them?
[18:48:44] hnanon_: Through the console.
[18:48:54] hnanon_: User.destroy_all
[18:49:06] michael_mbp: has joined #RubyOnRails
[18:49:43] bronson: has joined #RubyOnRails
[18:50:03] rhizome: you could easily write a unit test for this
[18:50:10] rhizome: rather than hunting around
[18:50:48] rushed: hnanon: and this was after adding the dependent: destory and issuing a "reload!" in the console at a time where there were not yet any orphans?
[18:52:16] hnanon_: I did not reload! the console until after destroying.
[18:53:49] rushed: hnanon: then your console session may not have known about the dependent destroy code when it was destroying :)
[18:53:51] Palsson: has joined #RubyOnRails
[18:56:41] meatherly: has joined #RubyOnRails
[18:56:46] yaymukund: has joined #RubyOnRails
[18:57:48] Lycanii: has joined #RubyOnRails
[18:59:30] hnanon_: rushed: Yup, I think that's what happened.
[18:59:54] hnanon_: Failbit: I believe it's working now. Thank you.
[19:00:14] hnanon_: And thanks centrx and and rushed.
[19:00:58] hnanon_: rhizome: I've yet to write a single test. I'm still trying to get the basic down.
[19:01:08] darrencauthon: has joined #RubyOnRails
[19:02:04] Coldblackice_: has joined #RubyOnRails
[19:02:54] bleda: has joined #RubyOnRails
[19:04:33] greengriminal: has joined #RubyOnRails
[19:07:54] centrx: No, thank YOU
[19:11:32] lwu: has joined #RubyOnRails
[19:13:51] sanjayu: has joined #RubyOnRails
[19:14:28] rushed: has joined #RubyOnRails
[19:14:37] Cache_Money: has joined #RubyOnRails
[19:14:53] ruurd: has joined #RubyOnRails
[19:15:08] pecpec: has joined #RubyOnRails
[19:20:11] greengriminal: has joined #RubyOnRails
[19:22:30] fedexo: has joined #RubyOnRails
[19:22:45] scott0101: can anyone help with a controller inheritance question?
[19:23:13] scott0101: I have a controller that does not inherit from my regular application controller(and its children), however I???d like to use some of the conerns that are included in them
[19:23:47] scott0101: I???ve included the concern I need, however this concern relies on rails methods such as ???helper_method???
[19:24:28] scott0101: am I right by saying I should just include AbstractController::Helpers::ClassMethods to my dissident controller?
[19:24:45] yardenbar: has joined #RubyOnRails
[19:26:55] rushed: scott0101: dissident controllers don't like to be told what to include~
[19:27:33] scott0101: what it boils down to is that I need to use helper_method in my controller
[19:27:45] scott0101: im not sure what to include to mix this in to my controller
[19:27:55] scott0101: AbstractController::Helpers::ClassMethods doesn???t seem to work
[19:28:00] bronson: has joined #RubyOnRails
[19:28:18] lupine: if only there were a sane way to statically analyse ruby code. you could precisely identify its dependencies
[19:28:43] pwnd_nsfw: has joined #RubyOnRails
[19:29:03] rushed: lupine: now who's the dissident~
[19:30:48] rboyd: has joined #RubyOnRails
[19:31:17] lorn: has joined #RubyOnRails
[19:31:20] lorn: has joined #RubyOnRails
[19:31:33] lupine: scott0101, you want to use code that has dependencies. they're not well-defined, but if you want to use that code you have to map them and ensure they're met
[19:32:04] lupine: I'm just grumping
[19:32:48] meoblast001: has joined #RubyOnRails
[19:32:50] scott0101: i have included the dependencies that my included concern needs
[19:33:24] lupine: including its transitive dependencies, and without breaking any other dependencies?
[19:33:49] workmad3: has joined #RubyOnRails
[19:35:23] lupine: hmm. TIL: RAML
[19:40:12] baweaver: has joined #RubyOnRails
[19:40:37] maz-dev: has joined #RubyOnRails
[19:44:44] startupality: has joined #RubyOnRails
[19:45:03] towski_: has joined #RubyOnRails
[19:45:35] lupine: a pretty amateur one by the looks of it
[19:45:39] lupine: mind you, swagger
[19:46:00] art-solopov: has joined #RubyOnRails
[19:48:43] atomical: has joined #RubyOnRails
[19:51:47] hamster88: has joined #RubyOnRails
[19:51:55] hamster88: greetings everyone !! :)
[19:52:12] centrx: Greetings Hamster
[19:52:44] hamster88: I have been facing a issue when using Materialize with rails
[19:53:31] hamster88: I have the variable defined but still this says, that sass syntax error undefined variable : "$navs"
[19:53:58] hamster88: do i have to setup any precompile in development.rb?
[19:54:23] toretore: has joined #RubyOnRails
[19:55:37] Kallis: has joined #RubyOnRails
[19:55:38] Joufflu: has joined #RubyOnRails
[19:55:54] hamster88: gist > https://gist.github.com/thedesignable/2d3c270ad03b48594e90
[19:56:01] scott0101: has left #RubyOnRails: ()
[20:00:45] Jasaka: has joined #RubyOnRails
[20:01:50] darrencauthon: has joined #RubyOnRails
[20:02:16] chipotle: has joined #RubyOnRails
[20:02:57] hamster88: any idea what could it be?
[20:03:20] hamster88: pretty confusing though.. never had these issues with bootstrap or foundation sass .
[20:08:16] PlasmaStar: has joined #RubyOnRails
[20:14:38] Pavster: has joined #RubyOnRails
[20:16:27] Kallis: has joined #RubyOnRails
[20:16:28] stannard: has joined #RubyOnRails
[20:18:24] duncannz: has joined #RubyOnRails
[20:20:29] hamster88: has joined #RubyOnRails
[20:23:30] agent_white: has joined #RubyOnRails
[20:24:39] yottanami: has joined #RubyOnRails
[20:25:15] hamster88: I've resolved the error finally
[20:25:43] hamster88: But i have a question what is this *= require_tree ." for?
[20:26:06] yottanami: Is any way to send notification about issues of RubyOnRails issue tracker in mail?
[20:26:06] rhizome: it sucks in all the files at that level and below
[20:26:40] rhizome: yottanami: once again, in english
[20:27:49] hamster88: rhizome, that's why it was creating issue with materialize css implementation.. was including all my import files too
[20:27:51] ericjphillips: has joined #RubyOnRails
[20:29:23] yottanami: rhinon, I want to receive mail for each issue about Rails repository
[20:31:02] robwri32: has joined #RubyOnRails
[20:31:33] Scripore: has joined #RubyOnRails
[20:32:02] umgrosscol: has joined #RubyOnRails
[20:35:45] atomical: has joined #RubyOnRails
[20:36:04] rhizome: yottanami: go to the rails github page and enable notifications
[20:38:04] kgzm: Hey.. maybe someone can help me out here. Is there a standard way in ActiveRecord to set an association based on a query? For example, if I have User.new(name: "Bob", location_attributes: { postal_code: "55555" }) that would try to create a new location with that postal code, but is there some method I can override to catch that and instead of creating a new instance of the nested model, to query for an
[20:38:10] kgzm: existing record that has those values and use that instead?
[20:40:33] annlewis: has joined #RubyOnRails
[20:40:36] briandeweese: has joined #RubyOnRails
[20:40:37] arBmind: has joined #RubyOnRails
[20:41:44] ariedler: has joined #RubyOnRails
[20:41:55] EminenceHC: has joined #RubyOnRails
[20:41:56] maz-dev: has joined #RubyOnRails
[20:43:23] pawnbox: has joined #RubyOnRails
[20:46:56] Lytol: has joined #RubyOnRails
[20:48:41] romdi: has joined #RubyOnRails
[20:49:33] kgzm: Bueller? Anyone?
[20:50:08] bronson: kgzm, quick answer: not really... you don't want to just assign it before saving?
[20:50:27] bronson: not that I know of anyway
[20:50:54] bronson: you can do your own magic in before_save of course
[20:52:17] kgzm: bronson: Well that's what I started writing but it seemed like something that others would want often enough that there would be some kind of convenient way to do it, in the case where you need to set an association from what is basically a list of options. Hmm.
[20:53:46] mostlybadfly: has joined #RubyOnRails
[20:57:34] kgzm: bronson: before_save would totally do the job. It seems like after_initialize would also work unless that would be painting a target on my foot?
[20:59:09] bronson: yeah, either is fine. or before_create. Just depends on how you want the data to be used.
[21:00:41] SteenJobs: has joined #RubyOnRails
[21:00:43] kgzm: bronson: after_initialize seems like it would be best for my use case, because if there's no hit in the DB, I want to query an API.. I'm not going to be creating anything directly from what the client says.
[21:00:47] bronson: Some implications to which callback you use... after_initialize would imply that you expect people to override during the init process, while before_save implies you never want it to be overridden.
[21:01:02] bronson: sounds good.
[21:01:25] kgzm: bronson: Thanks!
[21:01:40] bronson: you're welcome, happy coding.
[21:02:37] bronson: true. hope you're eventually happy to have coded.
[21:02:40] yottanami: rhizome, It does not send mail
[21:02:40] darrencauthon: has joined #RubyOnRails
[21:09:18] frmendes: has joined #RubyOnRails
[21:09:56] Pupeno: has joined #RubyOnRails
[21:10:14] BlackCoyote: has joined #RubyOnRails
[21:10:46] benlieb: has joined #RubyOnRails
[21:13:05] rhizome: yottanami:
[21:13:07] rhizome: https://help.github.com/articles/managing-notification-delivery-methods/
[21:13:29] VeryBewitching: has joined #RubyOnRails
[21:15:21] pecpec: has joined #RubyOnRails
[21:17:07] shinnya: has joined #RubyOnRails
[21:18:07] bleda: has joined #RubyOnRails
[21:18:37] Grundell: has joined #RubyOnRails
[21:22:06] workmad3: has joined #RubyOnRails
[21:22:14] kgzm: bronson: Okay, the sequel to my last question.. after I get the correct model with after_initialize how can I update the instance from within the callback. self.attributes =.. well I didn't seriously expect that to work completely, it gives the correct values which is probably good enough but persisted? is still false. It probably doesn't matter since I won't be trying to save it. But I wonder if there's
[21:22:20] kgzm: abetter way.
[21:23:03] CanTonic: has joined #RubyOnRails
[21:23:10] Rodya_: has joined #RubyOnRails
[21:24:02] bronson: I don't understand the question. `after_initialize { my_field = ComputeMyField }` doesn't work?
[21:24:28] jjasonclark: has joined #RubyOnRails
[21:24:54] bronson: I may not be the right person to ask... not sure I've ever used after_initialize.
[21:27:07] meatherly: has joined #RubyOnRails
[21:27:27] CanTonic: has joined #RubyOnRails
[21:30:27] erichu: has joined #RubyOnRails
[21:30:50] kgzm: bronson: I was going to try and type it out here but that's crazy, here's a link: http://pastebin.com/Bc3c2VH1
[21:31:03] kgzm: Oh, there are rules.
[21:31:16] kgzm: https://gist.github.com/KGZM/7ebd864c629dbaad5400
[21:32:17] mrmylanman: has joined #RubyOnRails
[21:32:49] ap4y: has joined #RubyOnRails
[21:33:32] bronson: self.attributes = Location.find_by(...) looks weird to me. What are you trying to do there?
[21:34:06] kgzm: bronson: Querying for an instance of the correct record only to discard it, after mutating the current instance with the correct attributes.
[21:34:09] bronson: if you really want to change every attribute, there's gotta be a more clear way to write it.
[21:34:39] kgzm: bronson: I'm trying to find that out, because this feels slightly immoral but I might just have to slap a big FIXME over it and move on.
[21:34:43] n008f4g_: has joined #RubyOnRails
[21:34:44] rhizome: i'm thinking there's probably a better way
[21:35:02] Parker0: has joined #RubyOnRails
[21:35:28] meatherly: has joined #RubyOnRails
[21:35:38] rhizome: where exactly is attributes in attributes.compact coming from?
[21:35:45] SteenJobs: has joined #RubyOnRails
[21:36:26] glennt: has joined #RubyOnRails
[21:36:29] pecpec: has joined #RubyOnRails
[21:36:52] bronson: and, isn't there a better way of writing this domain logic? finding and duplicating existing records sounds weird.
[21:37:02] Rodya_: has joined #RubyOnRails
[21:37:16] smathy: has joined #RubyOnRails
[21:37:57] rhizome: "after i get the correct model" ...why are you starting with the wrong one?
[21:38:03] bronson: at least, I've never run into a situation that needed that. Makes it hard for me to reason about.
[21:38:33] rhizome: oh jeez, i just read back. use find_or_initialize_by
[21:40:28] kgzm: rhizome: That definitely looks better, the reason I'm going down this rabbit hole is that I'm trying to use nested attributes to build one model with the correct associations.
[21:41:12] annlewis: has joined #RubyOnRails
[21:42:49] rhizome: the whole idea may need rethinking
[21:44:16] frmendes: has joined #RubyOnRails
[21:46:36] rhizome: find_or* takes a block, btw
[21:46:48] rhizome: can take, that is
[21:48:10] ahmgeek: has joined #RubyOnRails
[21:48:26] ahmgeek: Errno::ENOENT (No such file or directory @ rb_sysopen - /app/public/system/dragonfly/development/624bc2c1-d3f2-4268-8a0b-35237322d8ac.webm):
[21:48:47] erich: has joined #RubyOnRails
[21:49:28] rhizome: is the file there?
[21:49:40] ahmgeek: https://gist.github.com/ahmgeek/6dba4cde124fdce58d4f
[21:49:55] ahmgeek: I don't know, it worked before on heroku, now not working
[21:50:05] ahmgeek: is the upload function have something wrong ?
[21:50:06] FailBit: dragonfly is a horrible piece of software
[21:50:21] FailBit: whoever designed it should get a hot poker up the ass because it always loses the file
[21:50:29] ahmgeek: it's not dragonfly that upload I use regular uploading and use dragonfly to move files to s3
[21:50:59] rhizome: why dragonfly to move? you can use the s3 gem
[21:51:01] ahmgeek: just want to make sure that regular uploader works
[21:51:06] FailBit: this literally just happened to me not an hour ago
[21:51:08] FailBit: Dragonfly::DataStorage::DataNotFound: couldn't find file /home/derpibooru/shared/public/system/images/2015/09/20/22_13_50_179_rd_being_dragged_by_ahumeniy_d4goe23.svg
[21:51:30] ahmgeek: I am into this problem for almost 5 days now
[21:51:33] ahmgeek: or something.
[21:51:54] ahmgeek: I'll give free hugs to all of you if it worked
[21:52:17] ericjphillips: has joined #RubyOnRails
[21:52:19] capin: ahmgeek: you have heard of codementor.io ...right?
[21:52:28] pecpec: has joined #RubyOnRails
[21:53:54] ahmgeek: but taking it as easy like that ? I want to get into problems until it works !
[21:54:41] kgzm: rhizome: Thanks for your help. I have some ideas on how to improve this now.. I also think this'll totally work for now, even though it is questionable.
[21:57:00] ahmgeek: any idea guys ?
[21:57:21] scott0101: has joined #RubyOnRails
[21:58:36] rhizome: that's a huge method, not sure where you think the help is going to come in
[22:00:48] quazimodo: has joined #RubyOnRails
[22:03:21] darrencauthon: has joined #RubyOnRails
[22:03:58] ahmgeek: has joined #RubyOnRails
[22:04:10] workmad3: has joined #RubyOnRails
[22:05:27] ap4y: has joined #RubyOnRails
[22:09:44] ap4y: has joined #RubyOnRails
[22:11:22] ap4y: has joined #RubyOnRails
[22:12:19] ap4y: has joined #RubyOnRails
[22:14:56] stannard: has joined #RubyOnRails
[22:16:04] cornerma1: has joined #RubyOnRails
[22:18:24] lapide_viridi: has joined #RubyOnRails
[22:19:37] benlieb: has joined #RubyOnRails
[22:22:04] workmad3: has joined #RubyOnRails
[22:29:50] rickmasta: has joined #RubyOnRails
[22:33:44] mrchris: has joined #RubyOnRails
[22:38:08] michael_mbp: has joined #RubyOnRails
[22:41:06] Encapsulation: has joined #RubyOnRails
[22:42:07] annlewis: has joined #RubyOnRails
[22:44:41] jgt1: has joined #RubyOnRails
[22:47:18] Rodya_: has joined #RubyOnRails
[22:48:18] sotojuan: has joined #RubyOnRails
[22:49:49] EminenceHC: has joined #RubyOnRails
[22:51:28] chills42: has joined #RubyOnRails
[22:53:10] kitsuneyo: has joined #RubyOnRails
[22:53:16] pecpec: has joined #RubyOnRails
[22:53:17] Joufflu: has joined #RubyOnRails
[22:56:00] ahmgeek: has joined #RubyOnRails
[22:57:03] ahmgeek: I am really wasted guys
[22:57:28] ahmgeek: capin, I;ve tried to connect with mentors without success
[22:57:53] capin: ahmgeek: really, i've had great success with that site
[22:58:11] ahmgeek: is there any other sites ?
[22:58:41] capin: ummm none that I know of ...you could always post a gig on CL or elance :l
[23:01:52] Scripore: has joined #RubyOnRails
[23:02:29] ariedler: has joined #RubyOnRails
[23:03:33] ariedler: has joined #RubyOnRails
[23:04:05] darrencauthon: has joined #RubyOnRails
[23:04:21] sanjayu: has joined #RubyOnRails
[23:04:42] startupality: has joined #RubyOnRails
[23:04:57] wethu: has joined #RubyOnRails
[23:11:46] andrew9184: has joined #RubyOnRails
[23:12:39] yaymukund: has joined #RubyOnRails
[23:14:00] mrchris: has joined #RubyOnRails
[23:14:25] arBmind1: has joined #RubyOnRails
[23:15:57] benlieb: has joined #RubyOnRails
[23:17:40] Ropeney: has joined #RubyOnRails
[23:22:05] gambl0re: has joined #RubyOnRails
[23:23:10] smathy: has joined #RubyOnRails
[23:23:11] ahmgeek: how can I require a std/lib from controller
[23:24:02] Aeyrix: Why would you need to do that?
[23:24:21] ahmgeek: I need to use shellwords from a controller
[23:24:24] ahmgeek: a shellwords method
[23:27:43] lwu: has joined #RubyOnRails
[23:28:39] simkessy: has joined #RubyOnRails
[23:28:46] mrchris: has joined #RubyOnRails
[23:29:24] simkessy: I'm trying to redirect to my results page, after an AJAX request. I've posted details here: http://stackoverflow.com/questions/32685362/redirect-after-ajax-request
[23:31:27] darrencauthon: has joined #RubyOnRails
[23:35:06] atomical: has joined #RubyOnRails
[23:36:21] diegoviola: has joined #RubyOnRails
[23:39:03] bruno-: has joined #RubyOnRails
[23:42:01] gambl0re: has joined #RubyOnRails
[23:42:51] annlewis: has joined #RubyOnRails
[23:47:18] idd2d: has joined #RubyOnRails
[23:48:32] capin: simkessy: == Batman ...ehhhh :D
[23:48:53] bronson: has joined #RubyOnRails
[23:54:22] pecpec: has joined #RubyOnRails
[23:55:38] gambl0re: is heroku basically a web hosting service like hostgator except it allows rails apps whereas other web hosts support php?
[23:55:48] FailBit: it's a PaaS
[23:56:07] FailBit: it runs your app in a container
[23:56:14] Aeyrix: Heroku is basically a web hosting service like hostgator except it's expensive. :^)
[23:56:26] FailBit: it's also not cheap
[23:56:33] FailBit: and not worth the cost of running at scale
[23:56:44] Aeyrix: Amusingly, they are still backed by AWS.
[23:56:54] FailBit: get 1 or 2 VPSes and you'll save a lot of money vs trying to run a cloud service
[23:57:00] Aeyrix: Running on Heroku is running on an AWS Ubuntu container.
[23:57:10] gambl0re: but they allow up to three sites or something like that with some restrictions
[23:57:22] gambl0re: i just need a site to upload my simple rails sites
[23:57:30] Aeyrix: Those restrictions involve your site being turned off after something like 3hrs of no activity.
[23:57:46] FailBit: heroku is free for devs... with certain conditions
[23:58:06] FailBit: you get 1 dyno and it has to sleep for 6 hours in a day minimum
[23:58:08] gambl0re: they dont turn off your site...
[23:58:17] FailBit: yes they do
[23:59:10] gambl0re: turn off your site meaning no access?
[23:59:20] Aeyrix: It means it has to start back up.
[23:59:37] Aeyrix: And, yes, if you haven't slept for 6hrs over a 24hr period, it means no access.