« Back to channel list

#RubyOnRails - 25 September 2015

« Back 1 day Forward 1 day »
[00:00:07] lasker85: i feel like it's almost there
[00:00:08] pwnd_nsfw: has joined #RubyOnRails
[00:00:09] FailBit: will you donate it to the March of Dimes for me?
[00:00:13] lasker85: yea i'll do that
[00:00:54] FailBit: can I see the relations on your profile class
[00:01:08] craysiii: has joined #RubyOnRails
[00:01:14] tfitts: lasker85: yeah, is your profile class missing has_many :products
[00:01:28] lasker85: the profile doesn't have products though
[00:01:31] culturelabs: has joined #RubyOnRails
[00:01:32] amitchellbullard: has joined #RubyOnRails
[00:01:32] lasker85: the profile has scores
[00:01:45] lasker85: products and profiles are separate
[00:01:48] lasker85: they both have scores
[00:01:48] Voxxit: has joined #RubyOnRails
[00:01:53] spastorino: has joined #RubyOnRails
[00:02:21] lasker85: this is what i have in my profile class
[00:02:22] tfitts: to do @profile.products your profile model has to have a line that says has_many :products and your products table would have to have a field called profile_id
[00:02:25] lasker85: belongs_to :user
[00:02:42] jgpawletko: has joined #RubyOnRails
[00:02:44] lasker85: and also has_many :scores, dependent: :destroy
[00:02:45] one_zero: has joined #RubyOnRails
[00:03:00] RegulationD: has joined #RubyOnRails
[00:03:01] machty: has joined #RubyOnRails
[00:03:07] lasker85: but i'm not trying to list the products or anything
[00:03:11] lasker85: i'm trying to list the score
[00:03:22] FailBit: @profile.scores ?
[00:03:26] lasker85: scores belong to both profile and the product
[00:03:33] tfitts: just do @profile.scores then
[00:04:12] lasker85: ok no errors
[00:04:36] lasker85: p.score returned an error in the view undefined method `score' for #<Product:0x007ff501a0d1a8>
[00:04:53] quazimodo: has joined #RubyOnRails
[00:04:54] lasker85: oh maybe i also need @product.scores
[00:05:03] zrl: has joined #RubyOnRails
[00:05:19] FailBit: I thought products had scores
[00:05:23] FailBit: not a single score
[00:05:41] lasker85: each product has one score for each user
[00:06:02] FailBit: but still multiple?
[00:06:24] lasker85: each product, when looked at by the user, has exactly one score
[00:06:30] lasker85: but there are many scores, many products and many users
[00:06:33] FailBit: @product.scores.where(user_id: @profile.user_id).first
[00:08:19] lasker85: it returned undefined method `score' for #<Product:0x007ff4fbefc250>
[00:08:35] bruno-: has joined #RubyOnRails
[00:09:06] FailBit: Product has_many scores, even if uniq for a user
[00:09:44] lasker85: undefined method `scores' for nil:NilClass
[00:09:50] lasker85: still giving this in the controller
[00:10:20] CanTonic: has joined #RubyOnRails
[00:10:34] FailBit: because @product is nil?
[00:10:39] tfitts: lasker85: gist all 3 models
[00:11:01] FailBit: you confuse me.
[00:11:07] bePolite: has joined #RubyOnRails
[00:11:37] tawaffan: has joined #RubyOnRails
[00:11:51] ericjphillips: has joined #RubyOnRails
[00:11:52] Gustavo: has joined #RubyOnRails
[00:13:26] lasker85: https://gist.github.com/chrisbrunk/67c8405476b6c9108360
[00:13:33] lasker85: so product is = tshirtsize here
[00:15:16] allcentury: has joined #RubyOnRails
[00:18:39] jenrzzz: has joined #RubyOnRails
[00:23:38] pwnd_nsfw: What's your controller look like?
[00:23:42] pwnd_nsfw: sry, it's in there
[00:24:28] lasker85: i think it's complicated because i'm trying to get the score to display for the current user and for the specific product
[00:24:39] pwnd_nsfw: nothing is score, it's scores
[00:26:32] rakm_: trying to use a select_tag from an array of struct objects, what am I doing wrong? http://pastie.org/10442540
[00:26:46] rakm_: the option elements don't have anything inside them
[00:26:57] rakm_: getting this syntax right from the docs
[00:27:10] rakm_: first one here: http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#method-i-select_tag
[00:27:16] annlewis: has joined #RubyOnRails
[00:28:14] rickmasta: has joined #RubyOnRails
[00:28:58] pwnd_nsfw: select tag really should have a better syntax
[00:29:32] rakm_: it's always been very confusing to me
[00:30:12] bricker: rakm_: you are initializing your struct incorrectly
[00:30:30] bricker: rakm_: it doesn't take kwargs
[00:31:07] tsujp: has joined #RubyOnRails
[00:31:42] rakm_: bricker ahhh, there it is. thank you
[00:33:45] pwnd_nsfw: kwargs? like... specifying what value is for what key?
[00:34:54] quazimodo: has joined #RubyOnRails
[00:35:33] rushed: keyword arguments (as opposed to an options hash)
[00:35:43] vdmo_: has joined #RubyOnRails
[00:35:57] FailBit: keyword arguments are kinda bleh
[00:36:16] FailBit: I guess it works, so w/e
[00:36:51] pwnd_nsfw: It's nice to not have to look the arguments up in docs :p
[00:37:05] Scripore: has joined #RubyOnRails
[00:38:19] bricker: also nice that we don't have to fake them anymore and waste memory on all those hashes
[00:42:43] rromanch_: has joined #RubyOnRails
[00:43:23] CDunce: has joined #RubyOnRails
[00:46:00] rubyonrailed: has joined #RubyOnRails
[00:46:43] Kallis: has joined #RubyOnRails
[00:49:20] hydrozen: has joined #RubyOnRails
[00:49:50] nettoweb: has joined #RubyOnRails
[00:51:38] stardiviner: has joined #RubyOnRails
[00:52:18] mrmylanman: has joined #RubyOnRails
[00:52:19] lasker85: is it generally a bad idea to use the same column name twice for different models?
[00:52:21] lasker85: or is that no big deal?
[00:52:52] pwnd_nsfw: as long as it's not a foreign key, I'd imagine
[00:53:03] gavit: Hi I'm trying OrderLine.where(:id => params[:order_line_ids]).update_all(["ordered_date=?", Date.today]), but ordered_date is a delegate to :order_status
[00:53:16] gavit: so I get no such column: ordered_date
[00:53:23] p8m: has joined #RubyOnRails
[00:54:07] gavit: is there a way to do update_all with nested attributes?
[00:55:07] pontiki: has joined #RubyOnRails
[00:55:11] Radar: lasker85: I have "name" used in like a bazillion models across my app
[00:55:20] Radar: since column names are unique to the models it doesn't matter
[00:55:44] Radar: gavit: no
[00:55:56] Radar: gavit: What is it delegated _to_?
[00:56:16] bscott: has joined #RubyOnRails
[00:56:27] rhizome: why would you delegate something called a data to something called a status?
[00:57:27] gavit: Radar: OrderLine has a delegate :ordered_date, to: :order_status, prefix: false, allow_nil: true
[00:57:30] sevenseacat: has joined #RubyOnRails
[00:57:54] Radar: Why is the order status a separate ... actually it's too late for these arguments
[00:58:14] gavit: Radar: it's a seperate model
[00:58:20] Radar: gavit: Yes, but why?
[00:58:56] pontiki_: has joined #RubyOnRails
[00:59:14] dnewkerk: has joined #RubyOnRails
[00:59:48] gavit: Radar: well it stores the "ordered_date" and so the 'order status' has to be calculated on if it oly has an ordered_date/arrived_date etc
[01:00:05] Radar: and that information can't be stored on the OrderLine?
[01:00:09] gavit: maybe you're right that it doesnt make sense
[01:00:11] Radar: Seems like you're over-normalising your database
[01:00:17] Radar: A MODEL FOR EVERY FIELD!!1o1neone
[01:00:26] gavit: but for now, lets assume that was logical, how would one go about updating it?
[01:00:46] havenwood: has joined #RubyOnRails
[01:00:50] Scient: well you cant do it the way you were trying to, thats for sure
[01:00:57] Radar: "Let's assume I want to blow a hole in my foot, how do I pull trigger?"
[01:01:01] gavit: Scient: I know that much :(
[01:01:14] Radar: Convoluted query would be required to find the order statuses
[01:01:17] Radar: Fix your database
[01:01:18] Scient: either query all order_status records over order_line or whatever the assoc looks like
[01:01:20] Radar: glhf bye now
[01:01:21] Scient: and update those
[01:01:29] Scient: but I agree with Radar, the db design seems off
[01:01:32] gavit: Radar: if you don't want to tell me that's fine, but I want to learn how to blow a hole in my foot if you dont mind
[01:01:42] Scient: and the issue you are running into is proof of that
[01:01:50] pontiki_: has left #RubyOnRails: ()
[01:01:51] Scient: a clear indicator that you expect your data to be modeled differently
[01:02:13] pontiki: has joined #RubyOnRails
[01:02:26] gavit: Scient: I realize that, but and I'll rethink it, but I'm guessing I'll need this some day and want to learn how to
[01:02:40] dnewkerk: I have some code in a model that interacts with an external API (Amazon), example https://gist.github.com/dnewkerk/88ca7ded191c3e756b07 ??? is this a good way to stucture such code, or would you recommend a better way? I???m also aiming for these methods to be easily testable, though not certain how
[01:02:43] Scient: do what? work your way around bad design? :)
[01:03:18] pontiki: that's a really useful skill
[01:03:25] rushed: fair point~
[01:03:36] Scient: OrderStatus.where(:order_line_id => params[:order_line_ids]).update_all(...)
[01:03:47] Scient: if only you could access associations from the other end... right? :)
[01:04:05] Aeyrix: Holy shit that db design
[01:04:07] Aeyrix: what on earth
[01:04:53] gavit: Scient: fine, orderline has_one order_status: status:string date_of_status:change:date reference:order_line <- this way
[01:05:29] Aeyrix: >date_of_status_change
[01:05:33] Aeyrix: How about just updated_at
[01:05:43] gavit: Aeyrix: how so?
[01:05:44] yfeldblum: has joined #RubyOnRails
[01:05:48] Aeyrix: You're overengineering to the n+1th degree here.
[01:06:07] gavit: Aeyrix: ordered: today/shipped:tomorrow/paid/theday_after
[01:06:19] Aeyrix: what the fuck
[01:06:27] Scient: gavit: I believe I gave you a working solution, but you should still fix the design
[01:06:55] Radar: It's really fun to give people advice that they don't follow
[01:07:06] yfeldblum: has joined #RubyOnRails
[01:07:10] Radar: Makes me feel like my time is especially valued by those who want help.
[01:07:15] Radar: Makes me want to continue helping them
[01:07:18] pontiki: even better when they ask for the advice
[01:07:19] Radar: Just a quick thought before bed. Toodles.
[01:07:32] gavit: Radar: we can't all be perfect like you. But thanks for the help.
[01:07:49] Aeyrix: 'Night Radar.
[01:07:49] Scient: thats not his point
[01:07:55] gavit: Scient: I'll see about the addociation from the other end, I was just trying to see what Aeyrix meant
[01:08:08] Scient: his point is that if you get advice, you should probably follow it - even if you dont like it right away
[01:08:19] Aeyrix: FWIW, Radar's written books on Rails
[01:08:22] Aeyrix: several books
[01:08:28] Aeyrix: so generally when he talks people (should) listen
[01:08:32] Aeyrix: especially about Rails things
[01:08:36] Scient: its a classic case of inexperience, no offense
[01:08:50] rushed: gavit: the first "we can't all be perfect like you" kind of spoils the "thanks for the help"... but you probably knew that~
[01:08:57] Scient: i usually cover my ears when Radar talks
[01:09:04] gavit: Aeyrix: I know he's a good dev, but he has to understand that we start somewhere and we make mistakes, and we need to sometimes fall to understand why its wrong
[01:09:18] EvilEpoch: Greetings to Radar from The EvilEpoch.
[01:09:23] Aeyrix: EvilEpoch: He just left.
[01:09:30] ngscheurich: has joined #RubyOnRails
[01:09:33] Scient: a more efficient way to learn is to learn from others mistakes, without going through them on your own
[01:09:38] Aeyrix: gavit: We get a lot of people in here daily
[01:09:43] Aeyrix: and an irritating percentage of them
[01:09:48] Aeyrix: just smash through anything anyone says
[01:09:51] Aeyrix: and shits on about their problem
[01:09:54] Aeyrix: without answering questions appropriately
[01:10:06] gavit: Aeyrix: yes, and while I do understand its infuriating, it is the only way we people learn :(
[01:10:13] Aeyrix: Absolutely not.
[01:10:21] Scient: now that I think about it... a has_one relation usually is an indication of design being off
[01:10:24] redondo: has joined #RubyOnRails
[01:10:29] Aeyrix: Scient: what
[01:10:36] Aeyrix: well, depends, actually
[01:10:38] Scient: idk, cant really think of a case where I have used it and its a good design decision :P
[01:10:46] Scient: im obviously missing _some_ cases here but yeah
[01:10:56] Aeyrix: It's very niche versus has_many / belongs_to
[01:11:18] gavit: anyways, Scient thanks for the help, gonna see how my foot gets blown
[01:11:20] rhizome: classic case is of user/profile for people who are serious about SRP
[01:11:33] Aeyrix: rhizome: Yeah.
[01:11:44] gavit: I do like the fact that Radar pointed out that the design was off, just not the way he did it
[01:11:45] pontiki: i've used it when working with polymorphic addresses, but i don't like it
[01:11:56] Scient: i believe I have even had a polymorphic has_one at some point
[01:11:58] Scient: that was a shitshow... :D
[01:12:09] Scient: it was actually with addresses lol
[01:12:20] pwnd_nsfw: has joined #RubyOnRails
[01:12:20] rhizome: there are so many other more-rewarding shitshows
[01:12:20] lasker85: are there any secrets to global renaming of variables?
[01:12:28] ebragaparah: has joined #RubyOnRails
[01:12:59] gavit: Scient: are you saying that http://guides.rubyonrails.org/association_basics.html#the-has-one-association you would merge suppliers with accounts?
[01:13:36] pontiki: Scient: using polymorphic addresses and those damn credit cards require a *single* address as a billing address
[01:13:38] Scient: if a supplier can ever only have one account, then yes
[01:13:54] Scient: most likely I would make it a little more flexible and allow one supplier to have multiple accounts
[01:14:02] Scient: "it depends"
[01:14:12] Scient: but has_one there tells me that the objects could be merged
[01:14:15] rhizome: "the Stevens account"
[01:14:27] Scient: and I would require a very good reason to keep them separated and associated via a has_one
[01:16:05] allcentury: has joined #RubyOnRails
[01:16:11] Aeyrix: gavit: Gimme your schema
[01:16:17] gavit: Scient: the other end accessing is a lot of 'work'. OrderStatus.new
[01:16:34] gavit: Aeyrix: Radar already pointed out that its wrong and I see that
[01:16:51] gavit: Aeyrix: no point in making more fun about it
[01:16:58] cantonic_: has joined #RubyOnRails
[01:18:40] gavit: Aeyrix: I'm trying to track my amazon purchases. so I place an order, however not all orders 'arrive', so I need somewayof tracking it based on tracking numbers and what not
[01:19:00] gavit: some orders even get split into several 'shipments'
[01:19:39] gavit: I was first thinking of getting every order_line and associate it with a trackingnumber
[01:19:39] Aeyrix: Order: *has_many :shipments *order_id:integer *ordered_at:timestamp *shipped:boolean
[01:19:56] gavit: but when u order 3 socks, you can get a shipment with 1 sock and another with 2 socks
[01:19:59] Aeyrix: Shipment: *belongs_to :order *shipped_at:datetime *delivered_at:datetime
[01:20:12] Aeyrix: Any that don't have a delivered datetime haven't been delivered
[01:20:19] Aeyrix: any that don't have a shipped datetime haven't been shipped
[01:20:27] Aeyrix: All Orders have one or more Shipments
[01:20:30] gavit: Aeyrix: an order has several 'items'
[01:20:33] Aeyrix: All Orders have one or more Shipments
[01:20:38] gavit: hence my order_lines
[01:20:50] Aeyrix: 1+ items in a shipment?
[01:20:59] gavit: 3 socks, 2 shoes -> amazon ships 1 sock, 1 shoe in 1 shipment
[01:21:05] bourbon: has left #RubyOnRails: ()
[01:21:06] gavit: and 2 socks and 1 shoe in another
[01:21:11] Aeyrix: Order: has_many :items through: :shipments
[01:21:16] Aeyrix: shipments has many items
[01:21:20] Aeyrix: item belongs to shipment
[01:21:25] Aeyrix: item is x y z
[01:21:44] Aeyrix: Order.items would return all items in all shipments belonging to that order.
[01:21:51] gavit: the through shipments sounds good
[01:22:09] gavit: but I dont know if the qty's will match :P
[01:22:18] gavit: I'll ponder a bit on it
[01:22:23] gavit: thanks for the idea
[01:22:45] Aeyrix: idk what your source data looks like
[01:22:55] Aeyrix: but i'm sure that you'd only have to modify the item attributes
[01:23:12] gavit: Aeyrix: when you order, the shipment isn't prepared yet
[01:23:23] crdpink2: has joined #RubyOnRails
[01:23:23] gavit: so you know the qty of shoes you ordered, and the qty of socks
[01:23:46] gavit: guess I can put that in 'items'
[01:24:01] gavit: and do a through_shipments specify the qty in t here too
[01:24:13] gavit: and don't 'complete' the order till the qtys match
[01:25:42] gavit: Aeyrix: Order.items will return all items that have been shipped. I'll need another 'copy' of what I ordered
[01:25:57] gavit: but I'll just specify that in my order I think
[01:26:42] Aeyrix: There's a few ways to do this.
[01:26:48] Aeyrix: You can either have a copy or a 'link', kind of.
[01:27:07] Gustavo: has joined #RubyOnRails
[01:27:14] Aeyrix: tbh I'd break it up so that if you're shipping 36 candle lights
[01:27:25] Aeyrix: you have 36 OrderItems with the candle light sku
[01:27:29] Aeyrix: as opposed to one, with a qty attribute
[01:27:42] cnk: has left #RubyOnRails: ()
[01:27:45] Aeyrix: so then when it's coming in you just count like that
[01:27:52] annlewis: has joined #RubyOnRails
[01:28:12] Aeyrix: until the order.items.find_by(:sku).count matches shipment.items.find_by(:sku)
[01:28:48] gavit: You'd have to make a model for item then. I don't wish to 'store' them. a simple string was sufficient for me
[01:28:55] Aeyrix: Roughly, you'd end up with a schema not unlike this:https://gist.githubusercontent.com/Aeyrix/98ab18ff373a5d605662/raw/7b0f224fa10c4fbd6cc463eb9e47d748feaead1b/gistfile1.txt
[01:29:11] Aeyrix: OrderItem should be "item"
[01:29:30] Aeyrix: https://gist.githubusercontent.com/Aeyrix/98ab18ff373a5d605662/raw/6f15bed840fdc6df60d913245e78a1285b024265/gistfile1.txt there we go
[01:29:40] gavit: lemme see if I can gist what I think
[01:30:29] bkulbida: has joined #RubyOnRails
[01:33:21] dmz: has joined #RubyOnRails
[01:33:47] dmz: has joined #RubyOnRails
[01:35:00] gavit: Aeyrix: https://gist.github.com/power1984/663517f8f0133eea52f0 <- this is what I think it should be like, but I dont want to 'store' items, I want to just use a 'string' rather than a orderItem 'model'
[01:36:14] gavit: Scient: I think I found a 'exception' on when to use a has_one? :p
[01:38:46] Rodya_: has joined #RubyOnRails
[01:42:43] yfeldblum: has joined #RubyOnRails
[01:46:31] cnk: has joined #RubyOnRails
[01:49:15] nettoweb: has joined #RubyOnRails
[01:49:18] cnk: has left #RubyOnRails: ()
[01:56:27] Swappticon: has joined #RubyOnRails
[01:57:22] fre: has joined #RubyOnRails
[01:58:19] Swappticon: has joined #RubyOnRails
[02:00:00] Swappticon: has joined #RubyOnRails
[02:00:10] drale2k: has joined #RubyOnRails
[02:04:20] lasker85: has joined #RubyOnRails
[02:04:27] RegulationD: has joined #RubyOnRails
[02:07:20] Pathfinder: has joined #RubyOnRails
[02:07:50] hahuang65: has joined #RubyOnRails
[02:10:01] lasker85: has joined #RubyOnRails
[02:12:40] fre: has joined #RubyOnRails
[02:12:45] tejasmanohar: has joined #RubyOnRails
[02:18:51] pontiki: has joined #RubyOnRails
[02:18:52] fschuindt: has joined #RubyOnRails
[02:19:09] lasker85: what are people's thoughts on formtastic vs. simple_form?
[02:19:10] stardiviner: has joined #RubyOnRails
[02:20:00] rushed: lasker85: yes
[02:20:36] bulldawgden: has joined #RubyOnRails
[02:21:19] bulldawgden: has joined #RubyOnRails
[02:21:42] Kallis: has joined #RubyOnRails
[02:22:05] fschuindt: Do Rails provide an way to use a domain prefix as parameter? Something like: mike.domain.com, david.domain.com... Same app, something like mike's blog and david's blog.
[02:22:12] Pathfinder: has joined #RubyOnRails
[02:22:40] SteenJobs: has joined #RubyOnRails
[02:23:04] Kallis: has joined #RubyOnRails
[02:23:19] rushed: fschuindt: request.subdomain or if you want something that cuts across the entire app multitenancy is the search term you're looking for
[02:24:38] seank_: has joined #RubyOnRails
[02:24:42] fschuindt: rushed: thank you
[02:25:35] bronson: has joined #RubyOnRails
[02:28:35] sdwrage: has joined #RubyOnRails
[02:28:43] annlewis: has joined #RubyOnRails
[02:33:58] sevenseacat: simple_form all theway
[02:34:01] sevenseacat: 100% of the way
[02:34:10] beauby: has joined #RubyOnRails
[02:34:12] xcesariox: has joined #RubyOnRails
[02:34:48] mheld: has joined #RubyOnRails
[02:35:19] pontiki: i'd love to use it on this project; all the bloody forms have been hand-wrought. at the least they're in haml, but wow, what a royal pain
[02:35:19] darkxploit: has joined #RubyOnRails
[02:35:27] Lightsword: has joined #RubyOnRails
[02:35:29] rickmasta: has joined #RubyOnRails
[02:37:59] dnewkerk: can anyone recommend favorite posts, books, or courses, other resources that teach best practices on writing good, testable code that involves external APIs?
[02:38:32] rhizome: alphabetical order OK?
[02:39:10] roxtrongo: has joined #RubyOnRails
[02:40:10] pontiki: avdi has some rubytapas episodes on it, a few blog posts as well, but nothing i'm going to go dig up
[02:40:19] bruno-: has joined #RubyOnRails
[02:40:41] roxtrongo: has joined #RubyOnRails
[02:41:14] pontiki: devblog.avdi.org
[02:42:38] pontiki: railscasts.org has some on APIs, both writing and reading
[02:42:44] ebragaparah: has joined #RubyOnRails
[02:45:55] yaymukund: has joined #RubyOnRails
[02:47:15] simkessy: Hi, just wondering, is it a good idea to set my rails app to use Local time as default instead of UTC?
[02:48:16] rushed: simkessy: it depends~
[02:48:48] simkessy: I'm having trouble finding a decent article on the subject but right now all my timestamps are off
[02:48:53] baweaver: has joined #RubyOnRails
[02:48:54] simkessy: Not sure what's the best way to handle it
[02:49:35] rushed: simkessy: why do you think they're off, what do you think you need to handle?
[02:50:02] simkessy: I think they're off because the created_at is off by 4-5 hours
[02:50:11] simkessy: It's set at UTC and I'm not at UTC
[02:50:15] michael_mbp: has joined #RubyOnRails
[02:50:32] rushed: simkessy: so, if it's set at UTC and 4-5 hours "off" that sounds like they're exactly right :)
[02:50:33] simkessy: Users can be anywhere though, so I can't just set everything to my time.
[02:50:51] sevenseacat: you need to let the users configure their own timezone
[02:50:56] sevenseacat: there was a railscast on this
[02:50:57] simkessy: rushed: I see what you're saying but how do I get them to display correctly in the views
[02:51:12] r0bby_: has joined #RubyOnRails
[02:51:32] simkessy: Just found the railscast
[02:51:37] simkessy: will take a look at it thx
[02:52:03] sevenseacat: http://railscasts.com/episodes/106-time-zones-revised
[02:52:09] sevenseacat: cheers :) I think thats what you're after
[02:52:20] sevenseacat: so you can show everyone things in their own time zone
[02:53:48] simkessy: sevenseacat: yea that's exactly it thaaanks
[02:54:55] nya: has joined #RubyOnRails
[02:58:06] herbst: has joined #RubyOnRails
[03:00:03] brendan-: has joined #RubyOnRails
[03:00:43] mrtomme: has joined #RubyOnRails
[03:02:33] darkxploit: has joined #RubyOnRails
[03:06:21] frzn: has joined #RubyOnRails
[03:07:54] bmurt: has joined #RubyOnRails
[03:08:19] brentd: has joined #RubyOnRails
[03:10:02] braincrash: has joined #RubyOnRails
[03:11:00] zoidfarb: has joined #RubyOnRails
[03:11:19] redondo: has joined #RubyOnRails
[03:11:37] typedefvoid: has joined #RubyOnRails
[03:12:29] typedefvoid: Nightmare scenario: inherited client project, production postgresql database is set as development database in database.yml, I ran `rake db:setup`. There don't appear to be backups. I'm screwed, right?
[03:13:03] zoidfarb: Is there an easy way to output the context that a template will be rendered with? I'm handing off some HTML designs to a junior dev to convert them to ERB, and I'd like them to know what variables they have to work with.
[03:13:25] Contigi: has joined #RubyOnRails
[03:13:42] otacon-: has joined #RubyOnRails
[03:14:39] elton: has joined #RubyOnRails
[03:14:40] Lytol: has joined #RubyOnRails
[03:16:06] banjara: has joined #RubyOnRails
[03:16:10] stannard: has joined #RubyOnRails
[03:16:11] zoidfarb: typedefvoid: You did db:setup, not db:reset? This stack overflow thread https://stackoverflow.com/questions/10301794/difference-between-rake-dbmigrate-dbreset-and-dbschemaload claims db:setup only runs db:create, db:schema:load, db:seed
[03:16:36] zoidfarb: typedefvoid: It seems like that should've failed with an error if there was an existing database
[03:16:47] typedefvoid: zoidfarb: yes, db:setup... hmm, I agree with you, but I assure you it did not :(
[03:17:11] typedefvoid: it seems db:create will nuke the development db
[03:17:25] typedefvoid: or possible db:schema:load is what did it
[03:19:49] zoidfarb: typedefvoid: That's actually horrifying. I would almost say open an issue against Rails (or rake?) because that should not be a destructive action
[03:20:42] rhizome: hrm. fields_for :foo or fields_for form.object.foo
[03:23:57] rhizome: typedefvoid: not your fault
[03:24:14] sevenseacat: fields_for :foo
[03:24:19] typedefvoid: rhizome: I agree, but, data lost is data lost.
[03:24:34] rhizome: that's kind of between them and the previous dev
[03:24:55] rhizome: but yeah, sucks in the abstract. meanwhile, have a beer.
[03:24:57] typedefvoid: This is was from a mom-and-pop marketing firm and I should have known better
[03:25:01] rhizome: sevenseacat: why so?
[03:25:21] sevenseacat: because thats how it works...?
[03:25:24] rhizome: possibly, but the previous dev should have known better more.
[03:25:35] rhizome: sevenseacat: it works both ways
[03:26:01] rhizome: suit yourself.
[03:26:07] typedefvoid: rhizome: heh. well, thanks.
[03:28:22] sevenseacat: rhizome: seems you are correct, I apologize. I would always do fields_for :permission, though.
[03:29:23] annlewis: has joined #RubyOnRails
[03:29:46] chipotle: has joined #RubyOnRails
[03:34:58] Lightsword: has joined #RubyOnRails
[03:38:04] rubyonrailed: has joined #RubyOnRails
[03:38:48] ewilliam: hi, question about service objects - is it conventionally ok to have a service object create records unrelated to itself in the database?
[03:39:21] ewilliam: for example for a PaymentCardService service object which talks to Stripe. after creating a customer/card on Stripe, it creates a ChargeCard in the database
[03:39:29] ewilliam: https://www.irccloud.com/pastebin/uMMRIoZA/
[03:39:43] ewilliam: or should i handle that in the controller?
[03:40:06] ewilliam: note creation of Wallet and ChargeCard records
[03:41:20] zoidfarb: has left #RubyOnRails: ()
[03:44:59] rhizome: that's the service object's mission in life :)
[03:46:01] ewilliam: rhizome: hmm?
[03:46:11] rhizome: yes, it's ok.
[03:46:27] ewilliam: awesome, thanks
[03:46:58] sekrit: has joined #RubyOnRails
[03:47:08] sypheren: has joined #RubyOnRails
[03:50:15] Lightsword: has joined #RubyOnRails
[03:51:12] ewilliam: didn't mean to be cold, just wasn't sure what you meant :) again, thanks!
[03:52:39] rromanch_: has joined #RubyOnRails
[03:55:23] havenwood: has joined #RubyOnRails
[03:56:49] dnewkerk: ewilliam: I???m learning about service objects too right now??? mind pointing out any favorite posts or resources you???ve found helpful?
[03:57:39] fre: has joined #RubyOnRails
[03:57:59] ewilliam: dnewkerk: sure, here's a couple - https://blog.engineyard.com/2014/keeping-your-rails-controllers-dry-with-services https://netguru.co/blog/service-objects-in-rails-will-help http://blog.arkency.com/2013/09/services-what-they-are-and-why-we-need-them/ http://blog.carbonfive.com/2012/01/10/does-my-rails-app-need-a-service-layer/
[03:57:59] ewilliam: http://brewhouse.io/blog/2014/04/30/gourmet-service-objects.html
[03:58:51] stardiviner: has joined #RubyOnRails
[03:59:37] dnewkerk: ewilliam: thanks :)
[04:00:08] dnewkerk: ewilliam: quick question about the code you posted if you don???t mind??? where does external_customer_service come from?
[04:00:10] reeve_: has joined #RubyOnRails
[04:02:03] kp666: has joined #RubyOnRails
[04:03:13] ewilliam: oh, i just removed those for legibility
[04:03:34] ewilliam: https://www.irccloud.com/pastebin/cCARIh0U/
[04:03:47] ewilliam: the engine yard article covers that i believe
[04:03:52] twilling: has joined #RubyOnRails
[04:04:19] ewilliam: dnewkerk: ^^
[04:06:17] dnewkerk: ewilliam: cool thanks, I???ll read the article. Appears to touch on both topics I???m currently looking into (service objects as well as using/testing external services within my code)
[04:06:32] higuys: has joined #RubyOnRails
[04:06:52] jenrzzz: has joined #RubyOnRails
[04:14:30] fedexo: has joined #RubyOnRails
[04:15:33] Lightsword: has joined #RubyOnRails
[04:16:20] havenwood: has joined #RubyOnRails
[04:20:45] Joufflu: has joined #RubyOnRails
[04:21:20] Lightsword: has joined #RubyOnRails
[04:25:57] bronson: has joined #RubyOnRails
[04:26:21] dopamean_: has joined #RubyOnRails
[04:29:06] CheckYourSix: has joined #RubyOnRails
[04:30:17] annlewis: has joined #RubyOnRails
[04:33:45] krz: has joined #RubyOnRails
[04:34:46] fre: has joined #RubyOnRails
[04:34:47] hd1: has left #RubyOnRails: ()
[04:40:17] jenrzzz: has joined #RubyOnRails
[04:46:47] darkxploit: has joined #RubyOnRails
[04:48:52] Wolland: has joined #RubyOnRails
[04:52:14] allcentury: has joined #RubyOnRails
[04:52:44] sekrit: has joined #RubyOnRails
[04:59:10] vjdhama: has joined #RubyOnRails
[04:59:38] herbst: has joined #RubyOnRails
[05:01:26] rickmasta: has joined #RubyOnRails
[05:04:50] SteenJobs: has joined #RubyOnRails
[05:05:33] rromanch_: has joined #RubyOnRails
[05:06:49] rvanlieshout: has joined #RubyOnRails
[05:08:44] krzkrz: has joined #RubyOnRails
[05:09:14] Lightsword: has joined #RubyOnRails
[05:18:52] dhjondoh: has joined #RubyOnRails
[05:19:19] dionysus69: has joined #RubyOnRails
[05:19:47] tjbiddle: has joined #RubyOnRails
[05:21:24] tjbiddle: Hey all - I have a model object that I'd like to only expose certain fields of. I know in an ActiveRecord::Relation I can use .select() - What do I have at my disposal to do this on the object?
[05:21:55] rushed: tjbiddle: expose to what?
[05:21:57] Mattx: has joined #RubyOnRails
[05:22:21] tjbiddle: rushed: Say my object has (id, category, name, description) and I only want to expose name and description
[05:22:28] rushed: tjbiddle: expose to what?
[05:22:52] rvanlieshout: cause you don't have to limit what the object really contains with select
[05:22:59] Mattx: I have a asset-url("foo.png") in vendor/assets/stylesheets/bar.scss, but it returns "/foo.png" instead of "/assets/foo.png". so it generates a 404 error. what is wrong?
[05:23:17] rvanlieshout: Mattx: shouldn't it be asset-url("images/foo.png") ?
[05:23:25] tjbiddle: Ah, sorry - I mean expose via JSON to an API caller. Only thing I can think of is removing all but xyz keys after converting to json
[05:23:29] sevenseacat: Mattx: you don't have a foo.png in your images folders
[05:23:45] rvanlieshout: tjbiddle: how are creating a json of this?
[05:23:51] sevenseacat: and it should be image-url, not asset-url
[05:24:08] Mattx: I do sevenseacat
[05:24:17] Mattx: that's why /assets/foo.png would work
[05:24:17] tjbiddle: rvanlieshout: Normally just calling .to_json on the object.
[05:24:19] sevenseacat: what's the full path
[05:24:22] tjbiddle: But not really limited to anything in particular
[05:24:23] Mattx: it's in vendor/assets/images
[05:24:38] sevenseacat: did you create that folder after starting the server?
[05:24:43] rvanlieshout: tjbiddle: then that's what you need to change
[05:24:51] Mattx: I restarted already and nothing changed
[05:25:13] Mattx: that too, I killed two spring processes and started the server again
[05:25:23] tjbiddle: rvanlieshout: So just remove it after it's been converted to json?
[05:26:09] rvanlieshout: or just create a json you desire
[05:26:16] Mattx: btw, if I move the image to /app/assets/images it works (the url generated is "/assets/foo.png"). but when it is in /vendor/assets/images the url is "/foo.png"
[05:26:22] Mattx: any idea?
[05:26:29] rushed: tjbiddle: you probably want jbuilder, active_model_serializers, rabl, pick one~
[05:26:47] tjbiddle: rvanlieshout: Yeah - I've recreated json I desire in the past - just starts to look a bit messy duplicating the object and such; was looking for a cleaner way
[05:26:48] bronson: has joined #RubyOnRails
[05:26:54] tjbiddle: rushed: Will check into that
[05:27:36] sevenseacat: with the limited information provided, no.
[05:27:58] banjara: has joined #RubyOnRails
[05:28:04] rvanlieshout: tjbiddle: you don't have to 'recreate'
[05:28:11] rvanlieshout: just don't start with a plain to_json
[05:28:49] Lightsword: has joined #RubyOnRails
[05:31:03] annlewis: has joined #RubyOnRails
[05:33:11] bmalum: has joined #RubyOnRails
[05:33:54] codenapper: has joined #RubyOnRails
[05:34:23] aganov: has joined #RubyOnRails
[05:34:36] Macaveli: has joined #RubyOnRails
[05:34:57] Scripore: has joined #RubyOnRails
[05:37:41] roxtrongo: has joined #RubyOnRails
[05:45:31] rubyonrailed: has joined #RubyOnRails
[05:55:02] Lytol: has joined #RubyOnRails
[05:55:11] TomyLobo: has joined #RubyOnRails
[05:55:38] QoQOoO: has joined #RubyOnRails
[05:56:01] QoQOoO: has joined #RubyOnRails
[05:57:53] maz-dev: has joined #RubyOnRails
[06:00:56] herbst: has joined #RubyOnRails
[06:03:49] if1live: has joined #RubyOnRails
[06:05:44] RegulationD: has joined #RubyOnRails
[06:08:49] montagesoftware: has joined #RubyOnRails
[06:09:09] AzaToth: has joined #RubyOnRails
[06:10:09] sanjayu: has joined #RubyOnRails
[06:10:34] eGGsha: has joined #RubyOnRails
[06:11:48] roxtrongo: has joined #RubyOnRails
[06:13:45] rushed: has joined #RubyOnRails
[06:13:53] Lytol: has joined #RubyOnRails
[06:14:39] Pathfinder_: has joined #RubyOnRails
[06:15:31] sandstrom: has joined #RubyOnRails
[06:16:53] stannard: has joined #RubyOnRails
[06:20:24] vjdhama: has joined #RubyOnRails
[06:21:12] yaymukund: has joined #RubyOnRails
[06:26:17] Wixy: has joined #RubyOnRails
[06:26:54] herbst: has joined #RubyOnRails
[06:28:02] bronson: has joined #RubyOnRails
[06:31:01] emilkarl: has joined #RubyOnRails
[06:31:46] annlewis: has joined #RubyOnRails
[06:34:22] Stuffness: has joined #RubyOnRails
[06:35:41] arup_r: has joined #RubyOnRails
[06:37:23] armyriad: has joined #RubyOnRails
[06:37:26] bmalum: has joined #RubyOnRails
[06:37:37] finnnnnnnnnnn: has joined #RubyOnRails
[06:38:54] Macaveli: has joined #RubyOnRails
[06:40:13] Pumukel: has joined #RubyOnRails
[06:41:28] gurix: has joined #RubyOnRails
[06:41:29] fre: has joined #RubyOnRails
[06:41:46] bruno-: has joined #RubyOnRails
[06:43:18] rubyonrailed: has joined #RubyOnRails
[06:43:18] rhizome: has joined #RubyOnRails
[06:45:17] zpe: has joined #RubyOnRails
[06:48:55] jbrinkmusic: can somebody help me debug my code... for some reason my delete button sends a GET request instead of a DELETE request...
[06:48:58] jbrinkmusic: http://pastie.org/private/nzy2ym2yqpfcai0r1dvzog
[06:52:19] jbrinkmusic: I have no idea what's wrong
[06:52:20] sevenseacat: jbrinkmusic: any js errors on the page?
[06:52:49] violarium: has joined #RubyOnRails
[06:52:58] jbrinkmusic: sevenseacat: none
[06:53:11] sevenseacat: is your application.js loading jquery_ujs ?
[06:53:20] nfk|laptop: has joined #RubyOnRails
[06:54:30] robbyoconnor: has joined #RubyOnRails
[06:55:00] rhizome: jbrinkmusic: use button_to, it's better in the long run
[06:55:17] sevenseacat: rhizome: why so?
[06:55:25] jbrinkmusic: sevenseacat: that would be a no... is it just "//= require jquery_ujs" ?
[06:55:42] sevenseacat: jbrinkmusic: yes, it should be loaded after jquery.
[06:55:44] rhizome: because it works the first time you try and you shouldn't modify the database with links
[06:55:55] sevenseacat: rhizome: what?
[06:57:33] psk17_: has joined #RubyOnRails
[06:57:57] lemur: has joined #RubyOnRails
[06:58:50] banjara: has joined #RubyOnRails
[06:59:50] jbrinkmusic: sevenseacat: that solved it, thanks :)
[07:00:00] sevenseacat: jbrinkmusic: good stuff :)
[07:00:17] crdpink: has joined #RubyOnRails
[07:00:33] toomus: has joined #RubyOnRails
[07:00:57] rubyonrailed: has joined #RubyOnRails
[07:01:39] robotbrain: has joined #RubyOnRails
[07:01:59] toomus: I have problem, that browsers delete my cookie
[07:02:24] skroon: has joined #RubyOnRails
[07:04:12] srinidhi: has joined #RubyOnRails
[07:04:46] sandstrom: has joined #RubyOnRails
[07:04:48] VeryBewitching: toomus: How are you storing the cookie?
[07:05:20] toomus: I set cookie when user logs in
[07:05:49] vjdhama: has joined #RubyOnRails
[07:06:10] toomus: cookies[:events_token] = SecureRandom.uuid
[07:06:25] vjdhama: has joined #RubyOnRails
[07:06:31] toomus: It works great until user come back tomorrow
[07:06:40] toomus: cookie is undefined
[07:07:12] Wolland: has joined #RubyOnRails
[07:07:20] rhizome: they might be clearing cookies. probably better to use the session
[07:07:46] rhizome: but even so
[07:08:01] violarium: # Sets a "permanent" cookie (which expires in 20 years from now).
[07:08:07] violarium: cookies.permanent[:login] = "XJ-122"
[07:08:23] violarium: By default they are "session" cookies
[07:08:49] violarium: without expires date they cleared when session ends
[07:08:59] violarium: Read this: http://api.rubyonrails.org/classes/ActionDispatch/Cookies.html
[07:11:31] violarium: toomus: did it help?
[07:11:31] vjdhama: has joined #RubyOnRails
[07:12:40] cball: has joined #RubyOnRails
[07:13:20] pwnd_nsfw: has joined #RubyOnRails
[07:14:15] johnflux: has joined #RubyOnRails
[07:14:15] johnflux: has joined #RubyOnRails
[07:14:48] craysiii: has joined #RubyOnRails
[07:17:58] bergelmir: has joined #RubyOnRails
[07:18:34] rubyonra_: has joined #RubyOnRails
[07:19:04] bergelmir: Is there an easy way to test (RSpec) that my class has included a concern?
[07:19:08] charliesome: has joined #RubyOnRails
[07:20:15] sevenseacat: you have some specs for the functionality of the concern? apply those specs to any class you expect to include the concern
[07:20:32] finnnnnnnnnnn: has joined #RubyOnRails
[07:20:44] aligo: has joined #RubyOnRails
[07:21:34] comrad: has joined #RubyOnRails
[07:22:36] Shoutsid: has joined #RubyOnRails
[07:22:43] bergelmir: sevenseacat: i have a concern that includes other concerns so i don't need to copy them to all other classes (10+). i would like to test that my concern includes other concerns that aren't mine. so i have no specs for these 3rd-party concerns
[07:23:03] sevenseacat: sounds like a mess
[07:23:06] alex88: has joined #RubyOnRails
[07:24:07] arBmind: has joined #RubyOnRails
[07:24:41] bergelmir: sevenseacat: the lib i am using has functionality spreaded over three different concerns and i need them all so i created a concern that includes them all and my models only need to include my concern.
[07:28:57] bronson: has joined #RubyOnRails
[07:29:30] tjbiddle: has joined #RubyOnRails
[07:32:27] annlewis: has joined #RubyOnRails
[07:34:30] artto: has joined #RubyOnRails
[07:34:37] violarium: bergelmir: you should test objects and not concerns
[07:36:37] vjdhama_: has joined #RubyOnRails
[07:36:38] tagrudev: has joined #RubyOnRails
[07:37:45] bergelmir: violarium: yeah, but how to test that my class behaves like a 3rd-party concern? i don't want to test all the functionality it provides
[07:38:51] shoutsid06: has joined #RubyOnRails
[07:39:20] jgt2: has joined #RubyOnRails
[07:39:21] yfeldblum: has joined #RubyOnRails
[07:40:42] yfeldblum: has joined #RubyOnRails
[07:41:06] DoubleMalt: has joined #RubyOnRails
[07:41:13] slayerjain: has joined #RubyOnRails
[07:41:21] Shoutsid: has joined #RubyOnRails
[07:41:24] sevenseacat: you dont have to test all of it - just something of it
[07:41:32] sevenseacat: enough to verify the concern is included
[07:41:45] sevenseacat: whether its as simple as responding to a method that only the concern provides
[07:42:03] Ergo: has joined #RubyOnRails
[07:42:31] bruno-: has joined #RubyOnRails
[07:44:01] violarium: bergelmir: you could use shared examples, if you use rspec.
[07:44:23] bergelmir: violarium: i use shared examples :)
[07:44:34] jenrzzz: has joined #RubyOnRails
[07:45:04] violarium: bergelmir: in this case why is this a problem? Describe in this example concern behaviour and include this example to your class scpe,
[07:45:57] violarium: bergelmir: it's better, because in future you could change your mind and extend some concern methods or do not use concern, but you still will have tests.
[07:46:18] burgestrand: has joined #RubyOnRails
[07:46:23] herbst: has joined #RubyOnRails
[07:46:41] violarium: bergelmir: maybe I'm wrong, but it's better to test behaviour and not interface.
[07:47:18] beast: has joined #RubyOnRails
[07:48:00] alex88_: has joined #RubyOnRails
[07:48:43] bergelmir: violarium: hmm, i think the 3rd-party concerns are already tests by my tests because i use their provided functionality :D
[07:48:52] bergelmir: s/tests/tested/
[07:49:37] violarium: bergelmir: actually, why don't use so "is_a?"
[07:49:54] violarium: bergelmir: Y.is_a? X
[07:50:27] violarium: expect(Y.is_a? X).to be_truthy
[07:50:34] vjdhama: has joined #RubyOnRails
[07:53:03] bergelmir: violarium: i don't think is_a? works for included concerns
[07:53:22] rvanlieshout: you could test if it has one of the included methods
[07:54:29] vjdhama_: has joined #RubyOnRails
[07:55:03] violarium: https://gist.github.com/violarium/4602812dd3102636518b
[07:55:27] violarium: bergelmir: look at this: https://gist.github.com/violarium/4602812dd3102636518b
[07:55:47] violarium: bergelmir: if module is included, object of class "is_a" this module
[07:56:04] violarium: bergelmir: if module is extended, class "is_a" module
[07:57:02] violarium: bergelmir: you should test that instance of your class is a module
[07:57:23] startupality: has joined #RubyOnRails
[07:57:31] jsrn_: has joined #RubyOnRails
[07:58:44] alex88: has joined #RubyOnRails
[07:58:52] PlasmaStar: has joined #RubyOnRails
[07:59:36] alex88__: has joined #RubyOnRails
[07:59:47] violarium: bergelmir: is_a? works for included concerns, but you should call is_a? not on your class, but on the instance of class
[08:00:23] bergelmir: violarium: ok :) works fine!
[08:01:32] violarium: bergelmir: you could read somewhere how works ruby modules. For example, you could do like that: 1.extend(ModuleName)
[08:01:53] violarium: bergelmir: they are very flexible and there is a big difference between include and extend
[08:01:57] hive-mind: has joined #RubyOnRails
[08:02:37] violarium: bergelmir: it's more about how they change inheritance chain of objects
[08:03:44] krisquigley: has joined #RubyOnRails
[08:04:57] gurix: has joined #RubyOnRails
[08:05:43] Spami_: has joined #RubyOnRails
[08:06:42] RegulationD: has joined #RubyOnRails
[08:08:39] adre: has joined #RubyOnRails
[08:09:34] USvER: has joined #RubyOnRails
[08:11:11] USvER: hey, what if i want update all associated models in one sql query without runing all hooks etc... how can i do it?
[08:11:36] burgestrand: has joined #RubyOnRails
[08:12:27] USvER: rvanlieshout , model.associted.where(status: "123").update_all(status: "321)?
[08:12:36] darutoko: has joined #RubyOnRails
[08:12:38] USvER: rvanlieshout thanks alot
[08:12:39] ruurd: has joined #RubyOnRails
[08:13:56] thsig: has joined #RubyOnRails
[08:14:04] rvanlieshout: you're welcome
[08:15:48] erichu: has joined #RubyOnRails
[08:16:19] burgestrand: Is there a public style guide somewhere for naming AR scopes, e.g. "in_<some>_order" for scopes that append an order, or "including_<something>" for scopes that compute an in-SQL value, or "by_<something>" for scopes that more or less wraps a where-clause, or similar? I've noticed we have emerging patterns like these in our Rails applications at work, but they're not always consistent.
[08:18:04] burgestrand: I guess I'm trying to find the solution for one of the two hardest problems in programming, naming things. :)
[08:19:16] elaptics: not that I'm aware of
[08:20:58] elaptics: there is https://github.com/bbatsov/rails-style-guide but it doesn't cover naming scopes
[08:21:44] Zackio: has joined #RubyOnRails
[08:21:50] curses: has joined #RubyOnRails
[08:22:07] sevenseacat: the problem I have with style guides like that is they give a good list of what to do, but not why
[08:22:18] curses: has anyone used the ctiveadmin-wysihtml5
[08:22:23] sevenseacat: I get that they're opinionated and all, but some of that I'm just like 'no ty'
[08:22:26] curses: ..gem before
[08:22:44] jgt3: has joined #RubyOnRails
[08:23:27] burgestrand: sevenseacat: Isn't one of the problems with style that it's kind of subjective, which often makes arguing for one or the other kind of moot?
[08:24:02] burgestrand: i.e. there's better things to do, let's just decide one way to do it and avoid the arguments and inconsistencies that'd otherwise arise.
[08:24:09] sevenseacat: yep, so if there's no reasoning behind one choice or the other, do whatever you bloody want
[08:24:36] infoget: has joined #RubyOnRails
[08:24:38] sevenseacat: drives me absolutely batty, dealing with 100 stupid rubocop rules that I don't agree with and don't mean anything but I have to fix or else
[08:25:07] sevenseacat: I must single quote all my strings and not make lines greater than 100 characters and always line up my multiline hash arguments OR THE WORLD WILL FALL DOWN
[08:25:10] elaptics: sevenseacat: do you have a style guide like that for your projects then?
[08:25:22] Gustavo: has joined #RubyOnRails
[08:25:36] sevenseacat: I have a set of rubocop rules. tbh I've never actually looked at them but they sure don't like me.
[08:25:47] burgestrand: sevenseacat: I disagree, because I believe it does hold value to stick to the style conventions of surrounding code, and unless there's some guidelines that usually doesn't hold.
[08:25:54] elaptics: how do they get enforced?
[08:26:02] sevenseacat: rubocop runs on CI
[08:26:23] burgestrand: sevenseacat: (I do agree about rubocop, the times I do use it I've more or less changed everything using the config files to be more lenient)
[08:26:25] sevenseacat: Burgestrand: so if I use double quotes for strings and you use single, what is going to explode?
[08:26:25] elaptics: so do you end up with a load of commits like "fixes bloody rubocop shit"? :)
[08:26:30] sevenseacat: elaptics: absolutely.
[08:26:42] sevenseacat: Burgestrand: what value does it add?
[08:27:02] burgestrand: sevenseacat: the value to move forward.
[08:27:13] sevenseacat: not if you're making me go back and change all my code before every commit
[08:27:24] sevenseacat: that's wasting my time for no benefit
[08:27:35] burgestrand: If you had a style guide you wouldn't have to change anything to begin with.
[08:27:39] sevenseacat: absolutely zero benefit
[08:27:47] sevenseacat: zilch, zip, nada
[08:27:49] burgestrand: The benefit is that your code will look like the rest of the code base.
[08:28:04] sevenseacat: do double quotes confuse you that much?
[08:28:30] burgestrand: Do you have another strawman?
[08:28:30] elaptics: you should be using double quotes and not single quotes anyway
[08:28:53] sevenseacat: 'the code looks the same' is not something I see of being any benefit whatsoever
[08:29:04] sevenseacat: nor is it worth expending any energy on
[08:29:07] burgestrand: If you don't care just follow the style guide.
[08:29:14] elaptics: I'm pretty sure if you're a capable programmer you can read the code just fine either way
[08:29:29] burgestrand: A capable programmer can read obfuscated code, that doesn't make it good though.
[08:29:37] sevenseacat: Burgestrand: sure, let me knock five years of muscle memory out of your head too and see how you go
[08:29:53] sevenseacat: see how much time you end up wasting
[08:29:55] bronson: has joined #RubyOnRails
[08:30:02] elaptics: style guides only work when everyone is pretty much on the same page
[08:30:23] burgestrand: You won't be on the same page, that's kind of the point.
[08:30:37] elaptics: otherwise plenty of people get frustrated because they have to keep going back to change code that works perfectly well
[08:30:38] burgestrand: If there's two people then there's two ways of doing many things that are equally good.
[08:30:48] sevenseacat: exactly, so why worry about it
[08:30:56] elaptics: plus if you don't fix it before you commit then your good commit messages are lost
[08:30:58] sevenseacat: why enforce little syntactic things that make no difference to anything
[08:31:04] burgestrand: I'm not saying that you should follow the guide like a slave, it's a guide not a rulebook.
[08:31:19] sevenseacat: but you just said the code has to look the same
[08:31:22] elaptics: it's a rulebook when you have something like rubocop running
[08:31:25] burgestrand: But for one, do follow the style of the code surrounding your changes.
[08:31:27] sevenseacat: and my double quotes are evil
[08:31:44] elaptics: Burgestrand: I agree with that
[08:32:17] johnflux: has joined #RubyOnRails
[08:32:19] elaptics: for example there's no point changing the quote symbol if you're just updating some text in it
[08:32:36] sevenseacat: I try to do that for the most part, but quoting and indenting of hash arguments shits me off
[08:32:48] burgestrand: Yeah, I don't change all single quotes the first thing I do when starting a new rails application, even if it does get on my nerve a little bit. :)
[08:33:08] sevenseacat: hell even brand new rails apps are completely inconsistent in their quoting
[08:33:16] burgestrand: However, I do advise against things such as the ternary operator.
[08:33:20] annlewis: has joined #RubyOnRails
[08:33:35] VeryBewitching: I try to use double-quotes only when I have a value to interpolate in the string.
[08:33:45] vjdhama: has joined #RubyOnRails
[08:33:55] rvanlieshout: what's wrong with a ternary operator?
[08:34:10] sevenseacat: also confusing I guess.
[08:34:14] Veejay: has joined #RubyOnRails
[08:34:38] burgestrand: It's misused more often than not, and it's no better than a regular if-statement.
[08:34:58] sevenseacat: how can you..... never mind
[08:35:16] rvanlieshout: it's way better then some regular if statements
[08:35:22] burgestrand: Somehow people use it under the impression that the same number of statements are better written on a single line.
[08:35:30] dionysus69: has joined #RubyOnRails
[08:35:37] rvanlieshout: so it's not the ternary operator
[08:35:38] sevenseacat: i can see how five tiny lines are better than one normal sized line i guess
[08:35:52] rvanlieshout: it's those who try to write their full app one a single line
[08:36:06] sevenseacat: never mind that screens are horizontal, not vertical
[08:36:30] VeryBewitching: The ternary operator is great for multiple conditional assignments in a row.
[08:36:42] dionysus69: hello everyone, I am aiming for "button based" filter, tall/short for example and based on column in model, index view gets filtered, how do I do that? I have researched but nothing specific poped out, I have encountered scopes but i got confused as to what it does
[08:36:51] VeryBewitching: It's more readable than 13 if statements in a row if you had that much to process.
[08:36:56] sevenseacat: never mind that rubocop also bitches about methods that are over 15 lines long and you just used a third of that for a simple conditional
[08:37:33] Veejay: Hello, there's a behaviour in Rails where [] is turned into nil to address a CVE for unsafe query execution. Is there a way to whitelist certain attributes to allow for empty array in some cases?
[08:37:58] sevenseacat: you want to enable the unsafe query execution?
[08:38:02] burgestrand: dionysus69: I don't understand your question, could you rephrase?
[08:38:12] burgestrand: (or perhaps provide an example)
[08:38:32] elaptics: dionysus69: maybe look at the ransack gem for implementing easy search/filter forms
[08:38:52] Peteykun: has joined #RubyOnRails
[08:39:08] dionysus69: there is an index view and all products are shown, and there are two buttons on the top, tall and short for example and when you push tall only tall products remain and so on if I push all all products show up
[08:39:18] Veejay: sevenseacat: Not really no, the mechanism has been added for a good reason, but we do need to be able to send JSON objects where certain attributes have the [] value
[08:39:22] elaptics: Burgestrand: I think what dionysus69 is asking is for search filter forms where you'd have a button for "tall" and a button for "short" which just queries for element with that attribute
[08:39:29] dionysus69: hmm ok thanks elaptics will take a look at ransack
[08:39:39] Veejay: And I was wondering how to do that without the [] turnign into nil, which isn't what our application expects
[08:39:45] Veejay: turning* sorry
[08:39:46] VeryBewitching: dionysus69: You can do that with a scope and an enum for size.
[08:39:48] elaptics: Veejay: you just allow them using strong parameters
[08:40:16] burgestrand: dionysus69: You can provide a name and a value to a button. If you have one form, two buttons with the same name (e.g. filter), and give each button a different value, pressing it will submit the form with the proper parameter which will allow you to pick up the parameter in the controller and do your thing.
[08:40:41] maz-dev: has joined #RubyOnRails
[08:41:09] dionysus69: thanks for suggestions, will post back my progress ))
[08:41:12] marr: has joined #RubyOnRails
[08:41:18] VeryBewitching: dionysus69: Assuming the column is called size, you could add this to your model: scope :tall, -> { where(size: self.sizes[:tall]) }
[08:41:36] VeryBewitching: This also assumes that size is an enum
[08:42:04] Voxxit: has joined #RubyOnRails
[08:42:04] VeryBewitching: But you don't need a scope to do this, there's more than one way to skin a cat.
[08:42:20] dionysus69: ok lets go to specific, I just have a winetype column instead of size and it is a string in model, so would it be same in that case?
[08:42:59] VeryBewitching: scope :tall, -> { where(winetype: 'tall') }
[08:43:17] VeryBewitching: If you wanted to create a scope for winetype = 'tall'
[08:43:35] VeryBewitching: Then Model.tall
[08:44:15] dionysus69: ok thanks will try
[08:44:53] VeryBewitching: OK, sleep time for me. Night folks.
[08:46:41] mojojoel: has joined #RubyOnRails
[08:47:16] bePolite: has joined #RubyOnRails
[08:51:38] drptbl: has joined #RubyOnRails
[08:52:07] mojojoel: Anyone have recommendations of an admin app running on Sequel and not AR?
[08:53:46] rubyonrailed: has joined #RubyOnRails
[08:54:01] slayerja_: has joined #RubyOnRails
[08:55:17] sevenseacat: write your own? :)
[08:56:55] Hates_: has joined #RubyOnRails
[08:57:06] Hates_: has joined #RubyOnRails
[08:59:26] Palsson: has joined #RubyOnRails
[09:00:37] pontiki: has joined #RubyOnRails
[09:01:01] elaptics: what is an admin app?
[09:02:04] blackhuey: has joined #RubyOnRails
[09:02:22] dionysus69: ransack provides options for only with search button cases, but I want to give user options and when clicked on it filters without separate button for search
[09:02:51] konsolebox: has joined #RubyOnRails
[09:07:14] sevenseacat: dionysus69: and you cant see how to adapt the examples?
[09:08:12] dionysus69: I will assume, do I make two search buttons rename them and make them submit prewritten search queries?
[09:08:28] helpa: Why don't you try it and find out for yourself?
[09:08:43] elaptics: where is helpa?
[09:15:16] blackhuey: has left #RubyOnRails: ()
[09:15:43] Scripore: has joined #RubyOnRails
[09:16:26] dionysus69: anyone using sublime 3?
[09:16:59] Gustavo: has joined #RubyOnRails
[09:20:36] sadaf2606: has joined #RubyOnRails
[09:21:21] dionysus69: do you have any packages that make it more than a text editor? only help I am getting with sublime right now is that it recognizes some html and I have to type all rails stuff by hand so if you have any packages for suggestion that make things a lil easier would be appreciated :)
[09:21:32] mugurel: has joined #RubyOnRails
[09:22:23] vjdhama: has joined #RubyOnRails
[09:23:37] arup_r: has joined #RubyOnRails
[09:23:37] Macaveli: What does "MRI 2.0.0+" mean?
[09:23:38] jbrinkmusic: dionysus69: if you'd like to develop rails code in the cloud with a Sublime Text like editor, there's this one called Cloud9... works really well and suggests rails stuff as well
[09:24:29] dionysus69: jbrinkmusic: hmm no I would like a local solution for now, I will have to resetup everything but thanks though
[09:25:08] rvanlieshout: Macaveli: Matz's Ruby Interpreeter
[09:25:13] rvanlieshout: version 2.0.0 or higher
[09:25:28] Macaveli: The matz thing was freaking me out :p I'll be looking into that
[09:26:22] sevenseacat: dionysus69: what do you need?
[09:26:41] maz-dev_: has joined #RubyOnRails
[09:26:43] drptbl: has joined #RubyOnRails
[09:27:11] dionysus69: something like text completion and when I write <% or <%= so it closes brackets as well, I don't get why it doesn't come with sublime 3
[09:27:44] rvanlieshout: because it's annoying? :)
[09:27:49] rvanlieshout: text completion is in sublime
[09:27:54] rvanlieshout: so is closes brackets
[09:28:03] rvanlieshout: i'm not sure for the <%= thing, but i don't use erb
[09:28:11] sevenseacat: I normally disable all that autocompleting crap
[09:28:16] sevenseacat: just gets in the way
[09:28:46] slayerjain: has joined #RubyOnRails
[09:29:37] dionysus69: ok ok fine i ll focus on more important stuff :D
[09:30:27] defsdoor: has joined #RubyOnRails
[09:30:44] arup_r: rvanlieshout: You use HAML ?
[09:30:50] bronson: has joined #RubyOnRails
[09:31:36] dionysus69: oh wait HAML combines html.erb functionality? so its not haml.erb?
[09:32:02] rvanlieshout: it's html.haml
[09:32:42] dionysus69: oh I see I thought it would be like index.haml but its still cool, far from me so far anyway but I ll try it sometime
[09:34:07] quazimodo: has joined #RubyOnRails
[09:34:10] annlewis: has joined #RubyOnRails
[09:37:22] maz-dev: has joined #RubyOnRails
[09:39:51] alexhartley: has joined #RubyOnRails
[09:40:05] CanTonic: has joined #RubyOnRails
[09:43:22] bruno-: has joined #RubyOnRails
[09:45:46] dionysus69: wow I achieved what I wanted with like 2 lines using scope
[09:46:03] dionysus69: so I get a question now, I have a div on page and when I click on it I want to send get method
[09:46:16] rvanlieshout: dionysus69: convert it to a a href? :)
[09:46:49] dionysus69: http://localhost:5000/bottles?wine_type=eu something like this? just a full URL inside link_to??
[09:46:50] w09x: has joined #RubyOnRails
[09:46:59] rvanlieshout: if you prefer
[09:47:03] rvanlieshout: you could also write plain html
[09:47:15] yottanami: has joined #RubyOnRails
[09:47:27] dionysus69: also, how would I filter without sending request to server? ajax?
[09:47:28] rvanlieshout: or why not <%= link_to 'foobar', bottles_path(wine_type: eu) %>
[09:47:39] rvanlieshout: ajax will send it to the server
[09:47:50] rvanlieshout: you might just want to start with turbolinks
[09:47:59] rvanlieshout: it'll give great speed improvement
[09:48:06] dionysus69: hmm sure, how? I have turbolinks on
[09:48:06] bmalum: has joined #RubyOnRails
[09:48:22] rvanlieshout: is it slow? :) note that develompent is always slower
[09:48:45] dionysus69: oh so you meant the way I just did, its using turbolinks?
[09:48:58] dionysus69: no no its not slow just for future knowledge
[09:49:42] dionysus69: so basically turbolinks will cache results so the get request might not(~will not) even reach the server?
[09:49:58] rvanlieshout: it will use ajax
[09:50:11] rvanlieshout: so your browser won't have to download and parse the full css and js again
[09:50:20] yottanami: What is the most fast way deployment solution for a Rails project on a dedicated server/?
[09:50:37] dionysus69: wait a min so turbolinks is using ajax?
[09:50:45] charliesome: has joined #RubyOnRails
[09:50:46] sadaf2605: has joined #RubyOnRails
[09:50:56] rvanlieshout: yottanami: capistrano
[09:51:01] dionysus69: wow lol I never knew I love rails even more now
[09:51:41] rvanlieshout: dionysus69: only if the browser supports push states
[09:51:48] dionysus69: its like why would you develop using anything else xD
[09:51:49] diegoviola: has joined #RubyOnRails
[09:52:13] dionysus69: well and I assume all update browsers support? maybe except of explorer or something :D
[09:52:37] rvanlieshout: they do indeed. and it will just use the non-ajax version for the older browsers
[09:52:42] rvanlieshout: nothing to worry about
[09:52:49] yottanami: rvanlieshout, What about Mina
[09:52:56] rvanlieshout: what is mina?
[09:53:08] dionysus69: cool thanks for valueable info!
[09:55:42] arBmind: has joined #RubyOnRails
[09:56:46] yottanami: rvanlieshout, http://nadarei.co/mina/
[09:57:00] yottanami: """Really fast deployer and server automation tool"""
[09:58:35] rvanlieshout: never seen of heard about that one
[09:58:53] lxsameer: has joined #RubyOnRails
[09:58:54] alexhart_: has joined #RubyOnRails
[10:01:11] drptbl: has joined #RubyOnRails
[10:01:49] sadaf2605: has joined #RubyOnRails
[10:01:53] odabasi: has joined #RubyOnRails
[10:02:58] jas02: has joined #RubyOnRails
[10:03:03] dionysus69: link_to is great and the option I just discovered you just showed me rvanlieshout :D passing parameters from within ^.^
[10:03:30] alexhartley: has joined #RubyOnRails
[10:06:26] nya: has joined #RubyOnRails
[10:07:30] RegulationD: has joined #RubyOnRails
[10:13:53] rodfersou: has joined #RubyOnRails
[10:15:45] dymk: has joined #RubyOnRails
[10:16:50] mostlybadfly: has joined #RubyOnRails
[10:20:18] rickmasta: has joined #RubyOnRails
[10:21:08] rodfersou: has joined #RubyOnRails
[10:22:50] odabasi: has left #RubyOnRails: ()
[10:23:28] rodfersou: has joined #RubyOnRails
[10:23:48] voker57: has joined #RubyOnRails
[10:23:58] odabasi: has joined #RubyOnRails
[10:25:26] arup_r: Any method is there which will assign values to attributes and then it will save those when I will be calling save method. I thought `assign_attributes` does this. But it is not. I am debugging why my update is rollingback .. But not finding out proper method which will wait for saving until I call #save!
[10:25:45] nfk|laptop: has joined #RubyOnRails
[10:26:02] rvanlieshout: update could roll back if one of the callbacks returns false
[10:26:03] arup_r: New attributes will be persisted in the database when the object is saved. -- is the problem with assign_attributes
[10:26:26] arup_r: rvanlieshout: I have to figure that out.. but not able to track that
[10:26:40] arup_r: I want to see which is causing rollbacks..
[10:26:48] rvanlieshout: how many callbacks do you have?
[10:27:03] arup_r: let me check...
[10:27:07] rvanlieshout: disable them and add them one by one until it fails
[10:27:57] arup_r: I see 3 callbacks I have
[10:28:42] Pathfinder_: has joined #RubyOnRails
[10:29:12] Balzrael: has joined #RubyOnRails
[10:29:27] vjdhama: has joined #RubyOnRails
[10:30:16] codenapper: has joined #RubyOnRails
[10:31:44] bronson: has joined #RubyOnRails
[10:32:26] dhjondoh: has joined #RubyOnRails
[10:32:53] arup_r: I off all callbacks.. still rolling back..
[10:33:17] stamina: has joined #RubyOnRails
[10:33:52] rromanch_: has joined #RubyOnRails
[10:34:45] annlewis: has joined #RubyOnRails
[10:36:04] skroon: has joined #RubyOnRails
[10:37:47] jbrinkmusic: I built a comment model for posts today and it seems I have one comment without an id... is there any way to fix this?
[10:39:25] jbrinkmusic: my comments have a belongs_to relation to User and Message, which in turn have a has_many relation as there should be
[10:40:33] jbrinkmusic: when I try to retrieve the edit path for comments, I get an error message saying the id is "nil"
[10:40:48] jbrinkmusic: No route matches {:action=>"edit", :controller=>"comments", :id=>nil, :message_id=>"5"} missing required keys: [:id]
[10:40:51] frzn: has joined #RubyOnRails
[10:40:51] frzn: has joined #RubyOnRails
[10:42:03] jbrinkmusic: my edit link is as follows: <%= link_to "Edit", edit_message_comment_path(@comment.message, @comment), class: "btn btn-xs btn-success" %>
[10:43:08] srinidhi: has joined #RubyOnRails
[10:43:19] sanjayu: has joined #RubyOnRails
[10:44:07] bruno-: has joined #RubyOnRails
[10:45:16] akemrir: has joined #RubyOnRails
[10:47:49] habitullence: Good morning everyone :)
[10:48:37] pontiki: has joined #RubyOnRails
[10:54:08] rvanlieshout: jbrinkmusic: is your @comment.message present?
[10:54:22] rvanlieshout: oh wait. that's a nested resource
[10:54:32] rvanlieshout: edit_message_comment_path(@comment, @comment.message)
[10:54:34] jbrinkmusic: rvanlieshout: yes, it's a nested resource
[10:54:38] rvanlieshout: [:edit, @comment, @comment.message]
[10:54:48] rvanlieshout: or even better: add a non-nested resource for the actions where you have an id
[10:54:57] rvanlieshout: so nested is only for index, new and create
[10:55:17] dymk: has joined #RubyOnRails
[10:55:29] emilkarl: has joined #RubyOnRails
[10:56:19] Cervajz: has joined #RubyOnRails
[10:56:24] jmignault: has joined #RubyOnRails
[11:00:11] artto: has joined #RubyOnRails
[11:02:17] tvw: has joined #RubyOnRails
[11:02:38] sandstrom: has joined #RubyOnRails
[11:02:43] nickenchuggets: has joined #RubyOnRails
[11:04:33] montagesoftware: has joined #RubyOnRails
[11:06:34] jahpereira_: has joined #RubyOnRails
[11:07:02] jahpereira_: has left #RubyOnRails: ()
[11:07:13] Cervajz_: has joined #RubyOnRails
[11:07:31] jahpereira_: has joined #RubyOnRails
[11:09:18] rodfersou: has joined #RubyOnRails
[11:10:08] jahpereira_: can someone give me a recommendation on whether to add dinamic attributes to my database?
[11:10:34] jahpereira_: basically I want to read an excel file and create a database table and model with the excel headers
[11:10:45] chridal: Anyone been able to successfully run Docker, Docker Compose and then auto-running tests with Guard?
[11:10:48] jahpereira_: so for example if excel???s first row is A | B | C
[11:10:56] chridal: I've got everything working except auto-running my tests. (Also some tests have become slower after dockerization)
[11:11:08] jahpereira_: i want to generate a table in rails database with those fields (plus the ID, created_at and updated_at)
[11:11:16] skroon: has joined #RubyOnRails
[11:11:47] jahpereira_: should I genererate a database migration from controller?
[11:12:11] rvanlieshout: jahpereira_: maybe a document based db fits your needs better here
[11:12:26] jahpereira_: hum, more or less
[11:12:30] drptbl: has joined #RubyOnRails
[11:12:40] jahpereira_: I would like to use a relational database
[11:12:42] rvanlieshout: then don't try to stuff that in a relational db
[11:12:44] arup_r: has joined #RubyOnRails
[11:12:49] jahpereira_: but my client sent me an excel to work with
[11:12:49] rvanlieshout: don't use a db engine for a wrong purpose
[11:13:07] defsdoor: jahpereira_, is this a one off process ?
[11:13:34] jahpereira_: the client will be sending me dummy data in excel files each week
[11:13:44] defsdoor: in teh same format ?
[11:13:45] jahpereira_: and I need to import those files in tables
[11:13:52] rvanlieshout: so use a document based db engine
[11:14:18] jahpereira_: hum, I don???t know about that
[11:14:29] jahpereira_: I have to read more about document based
[11:14:42] iateadonut: has joined #RubyOnRails
[11:14:50] rvanlieshout: and get specifications right
[11:14:53] jahpereira_: I am quite green at rails
[11:14:59] rvanlieshout: i didn't say you have to drop rails
[11:14:59] defsdoor: is this was frequent thing that didnt require user involvement I would consider creating a tables, and a columns tables and a values table
[11:15:10] rvanlieshout: rails can work with something like mongo if you want
[11:15:25] jahpereira_: but for the purpose of learning
[11:15:26] rvanlieshout: but this is never going to work if you don't have proper specifications
[11:15:29] defsdoor: but it really dpends on what you want to do with the data thereafter
[11:15:38] jahpereira_: can you please point me out to the right way of manipulating tables in a rails app?
[11:15:43] vjdhama: has joined #RubyOnRails
[11:15:45] defsdoor: jahpereira_, I wouldnt
[11:15:49] jahpereira_: I just created a simple rails app
[11:16:04] jahpereira_: usually manipulating tables with rake db:create and db:migrate
[11:16:26] jahpereira_: but I would like to know the correct way to manipulate tables from the app without commands
[11:16:34] rvanlieshout: not if you generate them on the fly :)
[11:17:05] jahpereira_: rvanlieshout: how so?
[11:17:06] fschuindt: Radar: Just watching "Rails Pacific 2014 Multitenancy with Rails" and realized it's you. I've seen you a lot here in the channel, haha, cool.
[11:17:19] rvanlieshout: jsrn_: because it's not designed for that scenario
[11:17:27] rvanlieshout: jahpereira_: ^
[11:17:38] Macaveli: Call all pry-remote / pry guru's -> Still can't get into the debugger after upgrading to Rails 4. Thanks! http://stackoverflow.com/questions/32780971/pry-remote-not-triggered-rails-4
[11:17:40] rvanlieshout: and a relational db isn't designed to be that flexible in schema
[11:17:44] rvanlieshout: you need a schema-less db
[11:18:26] rvanlieshout: jahpereira_: IF your customer is not sending a same scheme each time
[11:18:29] rvanlieshout: but you don't know that yet
[11:18:37] rvanlieshout: so you need to have proper specifications first
[11:18:53] jahpereira_: all the logic from the moment I import the first table (which for the prototype happens to be excel)
[11:18:58] jahpereira_: is better handled with data tables
[11:19:32] jahpereira_: let me share an example
[11:19:45] rvanlieshout: what's a 'data table'?
[11:19:48] jahpereira_: this a cloud based app and insurance company A wants to use it
[11:20:05] jahpereira_: company A uses three attributes to calculate its insurance premium
[11:20:05] rvanlieshout: cloud based is irrelevant here, but ok
[11:20:10] jahpereira_: namely attributes A, B and C
[11:20:17] defsdoor: It's in the cloud!!!!
[11:20:33] defsdoor: jahpereira_, write it up and post it on github or somewhere
[11:20:55] rvanlieshout: jahpereira_: exactly, so the scheme for company A differs from company B.. so it's scheme-less... so use a scheme-less db.. don't use tools that are not designed for your purpose
[11:20:58] jahpereira_: alright I will skip the exaplnation
[11:21:17] rodfersou: has joined #RubyOnRails
[11:21:18] jahpereira_: but my question is
[11:21:20] rvanlieshout: jahpereira_: explanation is ok, but you're including buzzwords to make it look cool
[11:21:24] jahpereira_: from the moment I import that first ???scheme"
[11:21:32] jahpereira_: everything works with the same tables
[11:21:55] jahpereira_: all the workflow is based on well defined tables (with schemes)
[11:21:56] maz-dev: has joined #RubyOnRails
[11:22:08] defsdoor: rvanlieshout, I still fancy representing the colums/rows in a couple of tables
[11:22:53] rvanlieshout: defsdoor: jahpereira_ will come to the conclusion that he cannot know if he / she needs a relational or document based db unless he got better specifications in 10 min
[11:23:30] defsdoor: jahpereira_, question I have to ask is how come you are doing this ?
[11:23:48] defsdoor: you clearly don't seem to have the right or enough expertise
[11:24:11] defsdoor: but it sounds like a legitimate, complex requirement
[11:24:15] jahpereira_: I am learning
[11:24:18] rvanlieshout: coding is some of the later steps in software development
[11:24:33] defsdoor: does the client know this ?
[11:24:36] jahpereira_: I am a product manager at a software startup
[11:24:50] dionysus69: I have a select list on a model and when I edit the model and select some value with the select list, when I save and edit it again it shows me default blank, how can I make it show the value currently in DB?
[11:24:59] jahpereira_: and I decided to participate in a startup acceleration program
[11:25:24] jahpereira_: so I formed my own company one month ago with someone I trust
[11:25:30] jahpereira_: ouside of my day work
[11:25:36] rvanlieshout: dionysus69: !gist your controller, view and log for the update request
[11:25:36] helpa: dionysus69: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[11:25:39] jahpereira_: and we decided to develop a RoR solution
[11:25:47] defsdoor: dionysus69, what form select tag helper are you using ?
[11:25:55] rodfersou: has joined #RubyOnRails
[11:25:57] rvanlieshout: jahpereira_: then start with the arhitectual design of the app
[11:25:59] dionysus69: one second I will gist
[11:26:00] jahpereira_: which I plan to build (since in my day job I only get to manage specifications and JIRA prioritization)
[11:26:23] jahpereira_: and that???s it
[11:26:27] stannard: has joined #RubyOnRails
[11:26:38] jahpereira_: I know rvanlieshout I am still working on that
[11:27:08] jahpereira_: I thought about the network design where should the databases be hosted and how should they interact
[11:27:11] slayerja_: has joined #RubyOnRails
[11:27:38] defsdoor: I'd deliver first
[11:27:39] jahpereira_: but didn???t give much thought about whether they should be relational or no-sql ones
[11:27:50] Detch: has joined #RubyOnRails
[11:28:08] defsdoor: jahpereira_, document your requirement and post it online for us to see
[11:28:21] jahpereira_: alright I ll try that
[11:28:27] defsdoor: and for a small consultancy fee ......
[11:28:35] dionysus69: https://gist.github.com/webzorg/2ebecbab96bda75d5045 here are my two files
[11:28:40] dionysus69: thanks in advance
[11:29:03] rvanlieshout: dionysus69: and the log for the request that didn't save your stuff
[11:29:06] maz-dev: has joined #RubyOnRails
[11:29:07] jahpereira_: ok but just to make sure I gor it right
[11:29:25] jahpereira_: if for example I just wanted to make a small change in one of my tables
[11:29:32] jahpereira_: how should I do it?
[11:29:40] rvanlieshout: for any change
[11:29:49] rvanlieshout: but you should not have your app generate migrations
[11:30:11] jahpereira_: but it can right?
[11:30:22] jahpereira_: not recommended but possible is that it?
[11:30:22] rvanlieshout: anything is possible
[11:30:49] rvanlieshout: you could even consider switching to windows again? :)
[11:31:03] rvanlieshout: while you're at it
[11:31:13] jahpereira_: I can run an alter table sql command from the controller
[11:31:28] jahpereira_: but that would be like destroying the purpose of rails is that i?
[11:32:00] rvanlieshout: it's not the purpose of rails
[11:32:02] jahpereira: has joined #RubyOnRails
[11:32:13] rvanlieshout: it conflicts with having a db with a static schema
[11:32:38] bronson: has joined #RubyOnRails
[11:33:03] jahpereira__: has joined #RubyOnRails
[11:33:43] jahpereira__: my internet connection keeps going down
[11:33:56] defsdoor: dionysus69, options for select needs the current value passing to it
[11:34:07] jahpereira__: just out of curiosity do you know why my nickname appears with underscores in front of it?
[11:34:21] rvanlieshout: jahpereira_: because the other one isn't disconnected yet
[11:34:24] jahpereira__: ???jahpereira??? + ???__??? when I am registered with NickServ just as ???jahpereira???
[11:34:44] jahpereira__: how can I disconnect it manually?
[11:34:48] defsdoor: dionysus69, selected: f.object.wine_type
[11:35:08] jahpereira__: with the logout command?
[11:35:14] Spami: has joined #RubyOnRails
[11:35:31] annlewis: has joined #RubyOnRails
[11:35:47] vdmo_: has joined #RubyOnRails
[11:36:08] defsdoor: dionysus69, https://gist.github.com/defsdoor/1b1247ee92708ca49cf1
[11:36:19] syath: has joined #RubyOnRails
[11:36:34] roxtrongo: has joined #RubyOnRails
[11:36:36] jahpereira__: has left #RubyOnRails: ()
[11:36:39] rvanlieshout: defsdoor: include the log plz :)
[11:37:14] defsdoor: https://gist.github.com/defsdoor/1b1247ee92708ca49cf1/revisions < you mean that ?
[11:37:25] jgt3: has joined #RubyOnRails
[11:37:29] rvanlieshout: tail -f log/development.log
[11:37:43] jahpereira: has joined #RubyOnRails
[11:37:44] rvanlieshout: look at the output for the request that doesn't save what you would expect
[11:38:34] defsdoor: rvanlieshout, you've completely lost me
[11:38:51] rvanlieshout: defsdoor: something is not saved to the db, right?
[11:39:11] defsdoor: rvanlieshout, he wants the form to display the value on the model
[11:39:23] quazimodo: has joined #RubyOnRails
[11:39:36] gurix: has joined #RubyOnRails
[11:39:37] rvanlieshout: and does it actually holds that value?
[11:39:37] defsdoor: "I have a select list on a model and when I edit the model and select some value with the select list, when I save and edit it again it shows me default blank, how can I make it show the value currently in DB?"
[11:39:49] defsdoor: yes according to his original post
[11:39:55] defsdoor: how can I make it show the value currently in DB?"
[11:40:18] defsdoor: it doesnt show because options_for_select needs to be told the current selected value
[11:40:27] rvanlieshout: yeah then that's the case
[11:41:14] defsdoor: dionysus69, I'd make your bottle types db driven persoanlly ;)
[11:41:58] defsdoor: the least I would do is move your array of types out of the form
[11:42:09] defsdoor: put it in the Bottle Model perhaps
[11:42:12] annlewis: has joined #RubyOnRails
[11:42:14] panych: has joined #RubyOnRails
[11:42:54] defsdoor: you can use it in the validation there then also
[11:43:04] defsdoor: I think hes gone to sleep
[11:43:31] rvanlieshout: i don't know in what TZ he / she lives
[11:44:06] herbst: has joined #RubyOnRails
[11:45:33] mary5030: has joined #RubyOnRails
[11:46:24] moeabdol: has joined #RubyOnRails
[11:47:22] arup_r: defsdoor: He seems got bored :)
[11:49:49] mary5030: has joined #RubyOnRails
[11:50:08] cobranet: has joined #RubyOnRails
[11:50:17] krisquigley: has joined #RubyOnRails
[11:51:50] burgestrand: has joined #RubyOnRails
[11:51:55] mary5030_: has joined #RubyOnRails
[11:55:47] drale2k: has joined #RubyOnRails
[11:55:51] ldnunes: has joined #RubyOnRails
[11:56:53] cobranet: has joined #RubyOnRails
[11:59:14] absklb: has joined #RubyOnRails
[11:59:22] mrmylanman: has joined #RubyOnRails
[12:00:02] dionysus69: defsdoor: I am up for imporvements hehe, how do I make it db driven and what does it even mean :D
[12:02:36] cobranet: has joined #RubyOnRails
[12:03:37] beauby: has joined #RubyOnRails
[12:04:42] herbst: has joined #RubyOnRails
[12:04:44] cobranet: has joined #RubyOnRails
[12:05:03] bePolite: has joined #RubyOnRails
[12:08:15] RegulationD: has joined #RubyOnRails
[12:08:48] nzst: has joined #RubyOnRails
[12:08:52] gerep: has joined #RubyOnRails
[12:09:23] gerep: Hi all, how can I use the l from I18n in my model: l(Time.new(self.year, self.month), format: :month)
[12:09:29] absklb: has joined #RubyOnRails
[12:09:32] rvanlieshout: gerep: you shouldn't
[12:09:45] rvanlieshout: models shouldn't know or care about the world where presentation lives
[12:09:53] gerep: rvanlieshout, You are correct
[12:10:21] gerep: rvanlieshout, I'm making a validation in my model and in case I find an error I need to return a message like this: "No transaction logs found for the month of %{month}"
[12:10:41] gerep: rvanlieshout, and I need the month name in English and Portuguese
[12:10:47] rvanlieshout: that's still wrong
[12:10:55] rvanlieshout: the thing that displays that error should take care of localization
[12:10:56] gerep: rvanlieshout, so should I return something to my controller?
[12:11:19] Detch: has joined #RubyOnRails
[12:12:06] gerep: rvanlieshout, Doing this in my model is also wrong? errors.add(:base, I18n.t('billings.new.no_logs_found'))
[12:12:14] gerep: rvanlieshout, no, right?
[12:12:35] charliesome: has joined #RubyOnRails
[12:13:11] jkamenik: has joined #RubyOnRails
[12:14:13] charliesome: has joined #RubyOnRails
[12:14:46] Detch: has joined #RubyOnRails
[12:16:42] _el_fer_: has joined #RubyOnRails
[12:18:21] alexhartley: has joined #RubyOnRails
[12:20:22] subshad: has joined #RubyOnRails
[12:22:26] cobranet: has joined #RubyOnRails
[12:24:32] Silex^^: hello, I need a bit of guidance reguarding acl9 vs pundit (maybe vs authority). Basically I need complex *editable* ACLs
[12:25:05] memnon34: has joined #RubyOnRails
[12:25:05] Silex: I originally started with cancan but it became unmaintenable. I was in the transition to migrate to pundit when I noticed acl9
[12:25:45] Silex: all the other authorization plugins seems kinda inactive (authority, declarative_authorization)
[12:26:04] atomical: has joined #RubyOnRails
[12:26:16] Scripore: has joined #RubyOnRails
[12:26:28] gurix: has joined #RubyOnRails
[12:26:55] Kallis: has joined #RubyOnRails
[12:27:07] absklb: how can i take data from db and while display it, paginate my html page automatically with help of rails?
[12:27:41] Ergo^: has joined #RubyOnRails
[12:28:18] Silex: baaasically my question is: acl9 *looks* well thought out and the authorization centralization is rather nice, while pundit policies are equally nice but the credentials verification is more spread out everywhere: How come acl9 is not more known?
[12:29:24] defsdoor: I've always roles my own auth/roles
[12:29:30] arup_r: has joined #RubyOnRails
[12:30:15] Silex: defsdoor: you probably never needed much granularity
[12:30:20] memnon34: has joined #RubyOnRails
[12:30:44] jas02: has joined #RubyOnRails
[12:31:02] jenrzzz: has joined #RubyOnRails
[12:31:05] arup_r1: has joined #RubyOnRails
[12:31:13] defsdoor: Silex, how do you come to that conclusion ?
[12:31:37] rvanlieshout: pundit doesn't have credential verification
[12:31:37] absklb: why to reinvent when we have so many readymade plugins?
[12:31:44] Silex: defsdoor: it's pretty massive to implement
[12:31:55] defsdoor: Silex, and I'm an idiot ?
[12:32:10] rvanlieshout: defsdoor: do you really want an answer? :)
[12:32:14] defsdoor: or are you the idiot for needing a gem to do it ? :p
[12:32:29] Silox|: has joined #RubyOnRails
[12:32:31] Silex: defsdoor: right... gem users are idiots :)
[12:32:50] carlesso: has joined #RubyOnRails
[12:33:42] vjdhama: has joined #RubyOnRails
[12:34:17] Silex: defsdoor: understand I'm talking dynamic ACLs, not just reinventing "rolify" with a bunch of basic route checks
[12:35:28] rickmasta: has joined #RubyOnRails
[12:36:10] krisquigley: has joined #RubyOnRails
[12:36:44] Silex: damnit, I just found out about "consul"
[12:36:45] bkulbida: has joined #RubyOnRails
[12:37:19] mary5030: has joined #RubyOnRails
[12:38:01] Silex: ACTION is lost
[12:38:21] jcromartie: has joined #RubyOnRails
[12:41:19] jmignault: has joined #RubyOnRails
[12:41:26] drptbl_: has joined #RubyOnRails
[12:41:38] yottanami: has joined #RubyOnRails
[12:42:16] alex88: has joined #RubyOnRails
[12:44:59] ericjphillips: has joined #RubyOnRails
[12:45:10] startupality: has joined #RubyOnRails
[12:45:24] ejnahc: has joined #RubyOnRails
[12:45:48] drptbl: has joined #RubyOnRails
[12:46:38] zlogan: has joined #RubyOnRails
[12:46:55] michael_mbp: has joined #RubyOnRails
[12:47:04] dionysus69: how do I add query to current url instead of generating totally new url?
[12:47:24] dionysus69: i want to achieve button toggle filter effect
[12:48:06] rvanlieshout: url_for(foo: :bar)
[12:48:29] dstarh: has joined #RubyOnRails
[12:48:47] jmignault: has joined #RubyOnRails
[12:49:20] Thib: has joined #RubyOnRails
[12:50:39] dionysus69: kk thanks ))
[12:51:46] michael_mbp: has joined #RubyOnRails
[12:52:35] bmalum: has joined #RubyOnRails
[12:55:04] maz-dev: has joined #RubyOnRails
[12:55:09] zpe: has joined #RubyOnRails
[12:55:22] dionysus69: hmm still overwrites whole url
[12:56:06] treehug88: has joined #RubyOnRails
[12:56:07] bmurt: has joined #RubyOnRails
[12:56:09] victortyau: has joined #RubyOnRails
[12:57:21] rvanlieshout: dionysus69: where did you use that?
[12:57:30] dionysus69: inside link_to
[12:57:43] rvanlieshout: what did you use exactly and what output did it generate?
[12:57:58] cornerma1: has joined #RubyOnRails
[12:57:58] rocknrollMarc: has joined #RubyOnRails
[12:58:18] dionysus69: <%= link_to "European Style", url_for(wine_type: "eu")
[12:58:23] dionysus69: i have 3 others like this
[12:58:44] dionysus69: when I push each, they regenerate url, its in index view
[12:59:08] rocknrollMarc: has joined #RubyOnRails
[12:59:16] rvanlieshout: what url is generated?
[12:59:17] dionysus69: so I want to achieve the effect where if I activate button it gets added to url
[12:59:38] dionysus69: localhost:5000/bottles?wine_type=eu
[12:59:39] hahuang65: has joined #RubyOnRails
[13:00:11] ramortegui: has joined #RubyOnRails
[13:00:50] syath: has joined #RubyOnRails
[13:01:14] jenrzzz: has joined #RubyOnRails
[13:01:27] zlogan: has joined #RubyOnRails
[13:01:33] dionysus69: I also want it to get removed from the url if I click it second time
[13:01:51] dionysus69: am I trying to do something very complex ? :D
[13:02:24] xsoapx: has joined #RubyOnRails
[13:05:11] mrmylanman: has joined #RubyOnRails
[13:05:16] gurix: has joined #RubyOnRails
[13:08:37] startupality: has joined #RubyOnRails
[13:11:06] rvanlieshout: dionysus69: that did exactly what i've expected
[13:11:09] rvanlieshout: what did you expect
[13:12:34] dionysus69: <%= link_to "European Style", url_for(wine_type: "eu", wine_type: "somethingElse"), I expected this to show 2 types of wine out of three, how do I filter this ? :D I figured it doesnt send 2 parameters of the same type to url
[13:13:16] drptbl_: has joined #RubyOnRails
[13:14:02] rvanlieshout: wine_type is 1 param
[13:14:20] rvanlieshout: if you want it to be an array, use wine_types: ["eu", "somethingElse"]
[13:14:26] quazimodo: has joined #RubyOnRails
[13:14:32] rvanlieshout: that should result in ?wine_types[]=...&wine_types[]=...
[13:14:36] dionysus69: wow, omg I have been bashing my head on that for 2 hours
[13:15:06] dionysus69: syntax problems in my life lmfo
[13:15:20] ejnahc: has joined #RubyOnRails
[13:15:50] jgpawletko: has joined #RubyOnRails
[13:17:57] startupality: has joined #RubyOnRails
[13:18:00] charliesome: has joined #RubyOnRails
[13:18:16] dionysus69: how do I get this result in a URL bar when I push hq and eu buttons seperately? wine_type[]=hq&wine_type[]=eu, I want to concatenate parameters :S
[13:19:47] rvanlieshout: using checkboxes displayed as buttons
[13:20:40] sevenseacat: has joined #RubyOnRails
[13:21:10] dionysus69: wow nice, I also just discovered this params.merge, might help
[13:21:15] dionysus69: thanks again!
[13:21:55] jmignault: has joined #RubyOnRails
[13:22:43] moeabdol: has joined #RubyOnRails
[13:24:20] jmignault: has joined #RubyOnRails
[13:26:06] The_Phoenix: has joined #RubyOnRails
[13:26:45] rickmasta: has joined #RubyOnRails
[13:28:14] jmignault: has joined #RubyOnRails
[13:30:35] stamina: has joined #RubyOnRails
[13:31:29] jsrn_: has joined #RubyOnRails
[13:32:03] browndawg: has joined #RubyOnRails
[13:32:06] memnon34: has joined #RubyOnRails
[13:32:49] browndawg: Does it make sense to have an activerecord validation for the length of something in the db, when it is already enforced by the schema?
[13:33:12] jgpawletko: has left #RubyOnRails: ()
[13:33:36] browndawg: eg if I have something like this -> ` t.string "fname", limit: 24, default: "", null: false`, then it's redundant to have a validates(:fname, length ... ), right?
[13:33:51] browndawg: or is skipping it a bad idea
[13:34:02] vjdhama_: has joined #RubyOnRails
[13:34:28] bronson: has joined #RubyOnRails
[13:34:54] rvanlieshout: browndawg: it depends
[13:34:58] jgpawletko: has joined #RubyOnRails
[13:35:00] rvanlieshout: do you want your user to be aware of that length
[13:35:20] rvanlieshout: cause the db will just drop excess data
[13:35:28] browndawg: rvanlieshout: OH!
[13:35:30] browndawg: yeah that's bad
[13:35:32] browndawg: so I should do both
[13:35:47] rvanlieshout: well.. at least the model validation
[13:35:54] browndawg: that's what I was trying to ask, will the consstraint on the db raise the same error or not
[13:36:02] browndawg: k doing both
[13:37:49] vjdhama: has joined #RubyOnRails
[13:38:27] allcentury: has joined #RubyOnRails
[13:39:07] allcentury: hi all - in rspec under a request spec, i'm unable to set a session hash correctly
[13:39:30] allcentury: I've tried session[:some_key] = "some val" in my test but when it goes to the controller action, the session is an empty hash
[13:39:56] nettoweb: has joined #RubyOnRails
[13:40:51] jgt3: has joined #RubyOnRails
[13:41:04] slayerjain: has joined #RubyOnRails
[13:42:43] vjdhama: has joined #RubyOnRails
[13:42:52] erich: has joined #RubyOnRails
[13:43:05] slayerjain: has joined #RubyOnRails
[13:44:58] slayerjain: has joined #RubyOnRails
[13:46:52] jcromartie: has joined #RubyOnRails
[13:47:18] greengriminal: has joined #RubyOnRails
[13:49:41] mattt: has joined #RubyOnRails
[13:50:07] burgestrand: has joined #RubyOnRails
[13:51:40] voltalio: has joined #RubyOnRails
[13:52:16] mattt: Hi all, i have a model that is using accepts_nested_attributes_for ; this allows me to create two associated resources in a form
[13:52:55] mattt: in the form i allow you to select an existing associated resource or create a new one ... however i need to add a validation to ensure that someone does attempt to do both
[13:53:03] mattt: any suggestions as to how this would be achieved?
[13:54:21] charliesome: has joined #RubyOnRails
[13:54:50] nfk|laptop: has joined #RubyOnRails
[13:58:46] ebragapa_: has joined #RubyOnRails
[14:01:47] bmalum: has joined #RubyOnRails
[14:02:17] rubyonrailed: has joined #RubyOnRails
[14:02:59] memnon34: has joined #RubyOnRails
[14:03:00] stannard: has joined #RubyOnRails
[14:05:09] vjdhama: has joined #RubyOnRails
[14:06:04] srinidhi: has joined #RubyOnRails
[14:06:22] HalcyonicStorm: has joined #RubyOnRails
[14:09:32] zlogan85: has joined #RubyOnRails
[14:09:54] x44x45x41x4E: has joined #RubyOnRails
[14:12:55] AzaToth: has joined #RubyOnRails
[14:13:56] yottanami: I want generate a model name sms but it have S character at the end and it will generate sm
[14:16:22] vjdhama: has joined #RubyOnRails
[14:17:02] greengriminal: has joined #RubyOnRails
[14:17:13] ebragaparah: has joined #RubyOnRails
[14:17:40] _el_fer_: has joined #RubyOnRails
[14:19:03] rromanch_: has joined #RubyOnRails
[14:19:41] zpe: has joined #RubyOnRails
[14:20:32] charliesome: has joined #RubyOnRails
[14:25:12] jobewan: has joined #RubyOnRails
[14:25:13] absklb: in my controller i have @users = User.paginate(:page => params[:page], :per_page => 5) and in my view i have <%= will_paginate @users %> and nothing is printed on my html page
[14:25:15] absklb: i have one user
[14:26:26] tbuehlmann: absklb, when having one user, there's no sense in displaying links for switching the page, right?
[14:26:46] pwnd_nsfw: I don't much like will_paginate anyways
[14:26:58] absklb: tbuehlmann: when we are developing there is no sense in creating 100 users just so that it will appear on page right?
[14:27:00] yaw: has joined #RubyOnRails
[14:27:10] absklb: tbuehlmann: if you have that much of free tiime plaease come and add those users in my db
[14:27:24] pwnd_nsfw: seeds.rb m8
[14:27:45] pwnd_nsfw: 100.times do { User.create(....) }
[14:27:45] tbuehlmann: absklb, add another 3 or 4 and change the per_page setting
[14:27:56] absklb: tbuehlmann: on another case, i have two courses in my db, but that is also not displed. what will you say there?
[14:28:14] tbuehlmann: I'd say, show us the corresponding code and output
[14:28:54] burgestrand: has joined #RubyOnRails
[14:31:32] arup_r: has joined #RubyOnRails
[14:31:39] charliesome: has joined #RubyOnRails
[14:32:11] RegulationD: has joined #RubyOnRails
[14:35:00] absklb: tbuehlmann: so it works after adding more courses. but it only prinths that part prev next 123.....8910etc . so I still have to manage to print the actual course?
[14:35:03] absklb: whats its use then?
[14:35:22] bronson: has joined #RubyOnRails
[14:35:43] pwnd_nsfw: will_paginate is only for pagination links
[14:36:07] pwnd_nsfw: tell me your view is only <%= will_paginate %>
[14:36:13] chouhoul_: has joined #RubyOnRails
[14:36:24] absklb: let me screenshot
[14:36:43] dopamean_: has joined #RubyOnRails
[14:37:43] tbuehlmann: absklb, yes, that's totally your task to do. will_paginate really only displays links in your view (and applies scopes in the controller)
[14:37:45] vjdhama: has joined #RubyOnRails
[14:37:56] absklb: pwnd_nsfw: http://imgur.com/GSiiL1k where are course names? i clearly have <%= will_paginate @allcrss %> in my view
[14:37:59] ebragaparah: has joined #RubyOnRails
[14:38:04] meatherly: has joined #RubyOnRails
[14:38:10] absklb: tbuehlmann: oh.
[14:38:15] dopie: has joined #RubyOnRails
[14:38:16] pwnd_nsfw: absklb, what's your view code? http://gist.github.com
[14:38:27] blackmesa: has joined #RubyOnRails
[14:38:43] absklb: i just pasted above
[14:38:53] pwnd_nsfw: yeah, you have to write that shit m8
[14:38:54] charliesome: has joined #RubyOnRails
[14:39:32] pwnd_nsfw: i heard will_paginate configures production server too
[14:39:52] pwnd_nsfw: rifk is to rofl as kek is to lol
[14:40:00] pwnd_nsfw: 'Cept rifk makes more sense.
[14:40:41] pwnd_nsfw: It's a habit
[14:41:03] code1o6: has joined #RubyOnRails
[14:41:05] Fire1o6: has joined #RubyOnRails
[14:41:37] p8m: has joined #RubyOnRails
[14:41:45] pontiki: has joined #RubyOnRails
[14:42:06] absklb: so, when i all records from db and try to show them how do i make sure 5 goes in first page
[14:42:37] absklb: and when i make my for loop only show first 5 how will it know when user clicked on second page and now to show next page?
[14:42:48] absklb: do you have any example link please?
[14:42:57] tbuehlmann: the scary thing is, you already have that
[14:43:21] tbuehlmann: User.paginate(:page => params[:page], :per_page => 5) will get 5 records, depending on the page param
[14:43:47] jobewan: has joined #RubyOnRails
[14:43:52] absklb: let me put it in for loop like regular var
[14:44:22] pwnd_nsfw: just treat it as you would User.all
[14:44:27] pwnd_nsfw: in the view
[14:44:38] memnon34: has joined #RubyOnRails
[14:44:38] pwnd_nsfw: It'll do what you want
[14:44:57] tbuehlmann: a first step could be this: https://gist.github.com/tbuehlmann/b56fdeecfbdadccb2210
[14:45:17] yottanami: Is any tools to use restful api in rails?
[14:45:26] speaking1ode: has joined #RubyOnRails
[14:45:32] pwnd_nsfw: yottanami, how do you mean..?
[14:45:42] gurix: has joined #RubyOnRails
[14:45:54] absklb: tbuehlmann: thanks.
[14:46:08] johnflux: has joined #RubyOnRails
[14:48:17] absklb: tbuehlmann: tell me, so when controller sends this data to view it has record of first 5 users right? when user click on 2nd page, how does view get next set of data?
[14:48:20] Kallis: has joined #RubyOnRails
[14:49:22] jenrzzz: has joined #RubyOnRails
[14:49:56] tbuehlmann: the browser will request "/users?page=2" then
[14:49:59] rubyonra_: has joined #RubyOnRails
[14:50:05] absklb: oh yeah right
[14:50:14] tbuehlmann: and will_paginate will use that (params[:page])
[14:52:27] absklb: tbuehlmann: plese check my view https://gist.github.com/absklb/53ca9d41ce41e478fac4 its giving me Page Error.
[14:52:32] dici: has joined #RubyOnRails
[14:53:18] tbuehlmann: can you add the error to the gist?
[14:53:51] absklb: tbuehlmann: adding
[14:54:33] absklb: tbuehlmann: please refresh
[14:54:53] Kallis: has joined #RubyOnRails
[14:55:01] bruno-: has joined #RubyOnRails
[14:55:13] absklb: wait thats syntax error
[14:56:47] mary5030: has joined #RubyOnRails
[14:57:41] absklb: tbuehlmann: it properly works. now. previously was not working because only had two courses and one user.
[14:57:43] Kallis: has joined #RubyOnRails
[14:57:43] absklb: thanks all.
[14:57:51] mary5030: has joined #RubyOnRails
[15:00:13] dionysus69: has joined #RubyOnRails
[15:02:37] ebragaparah: has joined #RubyOnRails
[15:03:14] bratsche: has joined #RubyOnRails
[15:05:38] artto: has joined #RubyOnRails
[15:06:28] arup_r: I am using acts_as_paranoid Gem. User acts as a paranoid. Now the issue is if I call like User.with_deleted getting error as
[15:06:40] arup_r: NoMethodError: undefined method `with_default_scope' for #<User::ActiveRecord_Relation:0xa7f49a0>
[15:07:05] arup_r: but I should be able to do https://github.com/ActsAsParanoid/acts_as_paranoid#filtering
[15:07:25] wildlander: has joined #RubyOnRails
[15:07:27] vjdhama: has joined #RubyOnRails
[15:07:33] dionysus69: https://gist.github.com/webzorg/7d58320d0451a87c72de is this going to post.rb model? I am confused on where author class goes
[15:08:27] Gustavo: has joined #RubyOnRails
[15:08:45] startupality: has joined #RubyOnRails
[15:09:21] arup_r: Why this scopes are not working ?
[15:10:51] skroon: has joined #RubyOnRails
[15:12:34] jgt3: has joined #RubyOnRails
[15:14:46] sandstrom: has joined #RubyOnRails
[15:16:14] centrx: has joined #RubyOnRails
[15:16:30] blackmesa: has joined #RubyOnRails
[15:19:11] arup_r: I have gem 'acts_as_paranoid', '~> 0.5.0.beta1' in my Gemfile.. Not present in the actual repo https://github.com/ActsAsParanoid/acts_as_paranoid/tree/master
[15:19:18] arup_r: am I missing something ?
[15:19:24] Peteykun: has joined #RubyOnRails
[15:20:23] banister: has joined #RubyOnRails
[15:20:55] michaeldeol: has joined #RubyOnRails
[15:22:10] yfeldblum: has joined #RubyOnRails
[15:23:12] yottanami: has joined #RubyOnRails
[15:24:06] tubbo: arup_r: do you have a specific reason you're using acts_as_paranoid?
[15:24:12] tubbo: arup_r: rather than, say, paranoia?
[15:24:20] tubbo: they have identical APIs (afaik) but paranoia is actually maintained.
[15:26:22] ngscheurich: has joined #RubyOnRails
[15:26:49] arup_r: no idea it was added to gemfile earlier
[15:26:59] gurix: has joined #RubyOnRails
[15:27:23] krz: has joined #RubyOnRails
[15:28:12] tubbo: give paranoia a shot, i had trouble getting acts_as_paranoid to work because it was made in the rails 2 days and didn't get updated with the new AR::Relation stuff
[15:29:44] [Butch]: has joined #RubyOnRails
[15:29:52] herpless: has joined #RubyOnRails
[15:30:25] cmisenas_: has joined #RubyOnRails
[15:30:37] cmisenas_: has left #RubyOnRails: ()
[15:31:31] drptbl: has joined #RubyOnRails
[15:32:03] arup_r: tubbo: got permission to use the later one :D
[15:32:09] arup_r: now removing it
[15:32:17] arup_r: need to update 8 tables data type
[15:32:43] ducklobster: has joined #RubyOnRails
[15:35:21] treehug88: has joined #RubyOnRails
[15:35:53] huck5: has joined #RubyOnRails
[15:36:17] bronson: has joined #RubyOnRails
[15:36:18] habitullence: Does anyone know how I can change Rails database config at runtime?
[15:37:58] bratsche: I just want to know why you'd even want to do that. It sounds dangerous. :D
[15:39:12] hardtail: has joined #RubyOnRails
[15:39:26] sshuff|gone: has left #RubyOnRails: ()
[15:40:12] vjdhama: has joined #RubyOnRails
[15:41:03] Scripore: has joined #RubyOnRails
[15:41:09] i: has joined #RubyOnRails
[15:42:02] RTG`: has joined #RubyOnRails
[15:43:18] maz-dev: has joined #RubyOnRails
[15:43:22] dopie: has joined #RubyOnRails
[15:44:36] Cervajz: has joined #RubyOnRails
[15:44:38] smathy: habitullence, usually people want to do that for the wrong reasons (like trying to handle a failover from within Rails), what are you trying to do?
[15:45:21] rubyonrailed: has joined #RubyOnRails
[15:45:56] sandstrom: has joined #RubyOnRails
[15:46:34] habitullence: hi smathy, I'm trying to do this because an external command doesn't have a param to specify a postgres schema. I've just realised that it's probably not going to work anyway because it's run on the system. I've looked at other solutions and they all seem a bit hacky so I'm thinking to namespace my tables and models instead. Does that make sense?
[15:46:43] Cervajz_: has joined #RubyOnRails
[15:48:01] smathy: Yeah, and yeah - I don't actually know much about PG schemas, but yeah, if namespacing your tables/models makes them use the schema then do that.
[15:48:39] smathy: habitullence, there's also a schema_search_path option for the database.yml in Rails.
[15:48:54] nfk: has joined #RubyOnRails
[15:49:43] michaeldeol: has joined #RubyOnRails
[15:49:44] smathy: habitullence, and I think you can use set_table_name to set the fully qualified schema.table name in individual models if you want.
[15:50:23] smathy: ...or actually it's `self.table_name =` now.
[15:50:41] yottanami: has joined #RubyOnRails
[15:51:02] habitullence: smathy: Cool.. yeah, I have to set schema_search_path to get the hstore type to work properly in my migration
[15:52:12] habitullence: smathy: I guess having tables like extension_model will save having to add schema_search_path to yml, little less config to get plugin up and running :)
[15:52:12] gurix: has joined #RubyOnRails
[15:53:31] centrx: has joined #RubyOnRails
[15:53:35] optimus55: has joined #RubyOnRails
[15:53:37] habitullence: smathy: would prefer to be able to use a schema with system command cause it's a neater solution but prefixing the tables seems easiest and least hacky... I'll give it a go. Thanks
[15:53:39] smathy: habitullence, oh right, instead of using a schema you're going to prefix the table names.
[15:54:18] corioliss: has joined #RubyOnRails
[15:54:22] smathy: habitullence, you _could_ just override the table_name method in a base class per namespace, and set the schema(s) in there.
[15:54:52] smathy: habitullence, ...and make all the tables in that namespace inherit from that base class.
[15:56:05] optimus55: Quick question about the rails 4 asset pipeline. I'm adding some external libraries to the vendor/assets/stylesheets and js folders. Rails 4 is telling my to add the precompile line to the setup for each css and js file. Do I actually need to do this and/or is there a way to just load the asssets without having to precompile for development?
[15:56:32] Mattickbot: has joined #RubyOnRails
[15:56:34] marr: has joined #RubyOnRails
[15:56:36] optimus55: E.g. Bootstrap.min.js. I don't really see the need to precompile this again for development
[15:56:45] optimus55: Am I missing somehting?
[15:56:58] maz-dev: has joined #RubyOnRails
[15:57:29] habitullence: smathy: neat solution. Would still need to be a prefix though rather than schema. Might not have explained very well... The problem is an extenal command that has to be run as part of the install for the gem, specifically osmosis (from OpenStreetMap) - no way of getting it to use a different schema without doing something like creating a system user, changing the search path for that user, and then running command as that user... Frickin' annoyin
[16:00:39] skroon: has joined #RubyOnRails
[16:01:03] nya: has joined #RubyOnRails
[16:01:44] TomyLobo: has joined #RubyOnRails
[16:02:34] Detch: has joined #RubyOnRails
[16:03:22] smathy: habitullence, oh right, so namespaced models will already automatically convert the :: into an _ for the table name.
[16:06:10] vjdhama: has joined #RubyOnRails
[16:06:13] Detch: has joined #RubyOnRails
[16:07:27] startupality: has joined #RubyOnRails
[16:09:09] richipargo: has joined #RubyOnRails
[16:12:22] moeabdol: has joined #RubyOnRails
[16:12:59] bricker: has joined #RubyOnRails
[16:13:20] greengriminal: has joined #RubyOnRails
[16:15:03] habitullence: smathy: oh, so I wouldn't need to do anything extra, it's baked into rails? never done namespaced models before :P
[16:15:38] Dreamer3: has joined #RubyOnRails
[16:16:28] momomomomo: has joined #RubyOnRails
[16:16:30] treehug88: has joined #RubyOnRails
[16:16:36] lulzmachine: has joined #RubyOnRails
[16:17:33] bmalum: has joined #RubyOnRails
[16:18:40] Detch: has joined #RubyOnRails
[16:20:30] habitullence: smathy: no way to change table prefix in external command either... back to the drawing board :)
[16:21:19] startupality: has joined #RubyOnRails
[16:21:33] yfeldblum: has joined #RubyOnRails
[16:22:26] smathy: habitullence, actually, sorry, I was mis-remembering. What happens is that if you use the rails generators to generate a namespaced model, then it creates the namespace module with the self.table_name_prefix method in it.
[16:23:20] habitullence: smathy: thanks, no matter what happens with current issue it's good to have this for future ref
[16:24:21] xcesariox: has joined #RubyOnRails
[16:24:47] yfeldblum: has joined #RubyOnRails
[16:27:04] momomomomo_: has joined #RubyOnRails
[16:27:32] herbst: has joined #RubyOnRails
[16:28:00] satinder: has joined #RubyOnRails
[16:29:34] Scriptonaut: has joined #RubyOnRails
[16:30:06] Cervajz: has joined #RubyOnRails
[16:30:22] greengriminal: Can someone take a quick look at this gist please: https://gist.github.com/davidpatters0n/dd2bb6313a0b924a0eb9
[16:30:24] lxsameer: has joined #RubyOnRails
[16:30:24] lxsameer: has joined #RubyOnRails
[16:30:34] greengriminal: has left #RubyOnRails: ("Leaving")
[16:31:36] Kallis: has joined #RubyOnRails
[16:31:51] n008f4g_: has joined #RubyOnRails
[16:32:54] Maletor: has joined #RubyOnRails
[16:32:58] satinder: has joined #RubyOnRails
[16:33:26] thsig: has joined #RubyOnRails
[16:34:57] arup_r: What they mean by the term "mark for destruction" ?
[16:35:02] djbkd: has joined #RubyOnRails
[16:36:55] herbst: has joined #RubyOnRails
[16:37:16] bronson: has joined #RubyOnRails
[16:38:22] tubbo: arup_r: who's "they"?
[16:38:39] wldcordeiro: has joined #RubyOnRails
[16:38:52] arup_r: Nah.. https://github.com/radar/paranoia#callbacks :)
[16:39:06] arup_r: ..destroy callback when the record is **marked as deleted**
[16:39:26] arup_r: I read the same term in some where Rails doc also
[16:40:10] tubbo: arup_r: the rails doc is probably talking about AR::Dirty or something...when you call `destroy` but it hasn't been deleted from the DB yet maybe? i don't know. anyway, paranoia marks a record as "deleted" by setting its deleted_at value to DateTime.now
[16:40:19] tubbo: arup_r: so a value being "deleted" means that deleted_at.present?
[16:41:48] arup_r: ok.. here it is **autosave** -> http://apidock.com/rails/ActiveRecord/Associations/ClassMethods/belongs_to
[16:41:52] krisquigley: has joined #RubyOnRails
[16:42:15] yfeldblum: has joined #RubyOnRails
[16:44:28] shinnya: has joined #RubyOnRails
[16:44:42] tubbo: arup_r: definitely not the same thing as what paranoia is talking about, just using the same terms
[16:45:07] arup_r: Yes.. that is why I confused.. I thought it something standard term
[16:45:16] arup_r: people are using IN an Out
[16:46:37] tfitts: I eat there once in a while
[16:46:56] tubbo: tfitts: jealous :)
[16:47:01] tubbo: we don't have them on the east coast
[16:47:33] tfitts: yeah, I don't think they go much east of Utah
[16:47:37] drptbl: has joined #RubyOnRails
[16:48:20] browndawg: has joined #RubyOnRails
[16:48:53] michaeldeol: has joined #RubyOnRails
[16:48:57] smathy: arup_r, http://devdocs.io/rails/activerecord/autosaveassociation#method-i-mark_for_destruction
[16:49:15] arup_r: You know every thing :) Congo!
[16:49:33] Scriptonaut: I tried IN an Out last time I was down in SF, was really dissapointed, just seemed like any other fast food place
[16:49:43] matty1234: has joined #RubyOnRails
[16:50:15] smathy: Scriptonaut, yeah, coming from Australia I had the same experience.
[16:50:29] smathy: It was like "Uhh, ok, so a slightly fresher McDonalds."
[16:50:34] tfitts: Scriptonaut: Californians over-hype it like nobody's business.
[16:50:55] nettoweb: has joined #RubyOnRails
[16:51:02] Scriptonaut: ya, I'd take the street food up here near Seattle over In N Out any day
[16:51:10] frmendes: has joined #RubyOnRails
[16:52:00] dionysus69: has joined #RubyOnRails
[16:52:04] jenrzzz: has joined #RubyOnRails
[16:52:27] Scriptonaut: since there's no much talkin goin on in here, hopefully people don't mind the offtopic, but where in AUS were you from smathy
[16:54:01] tejasmanohar: has joined #RubyOnRails
[16:54:34] Lytol: has joined #RubyOnRails
[16:54:43] mrmylanman: has joined #RubyOnRails
[16:54:57] Obfuscate: Scriptonaut: I've been in California off and on for decades, but have never heard anyone talk with any particular esteem for In N Out: it's a cheap baseline fast food joint. e.g. better than McDonalds, but that's not saying much.
[16:55:16] lxsameer: has joined #RubyOnRails
[16:55:37] Scriptonaut: people on the internet seem seriously fond of it
[16:55:39] smathy: Scriptonaut, Sydney.
[16:55:44] infoget: has joined #RubyOnRails
[16:55:45] tfitts: Obfuscate: maybe it's californians who leave california.
[16:55:51] romdi``: has joined #RubyOnRails
[16:55:55] Detch: has joined #RubyOnRails
[16:55:57] Scriptonaut: smathy: cool, I have a house in St Helens, Tasmania
[16:56:38] smathy: Obfuscate, that's not been my experience btw, in both San Diego and LA many people I spoke to seem to speak as if In N Out was a treat, or sort of a "real" hamburger.
[16:57:31] Obfuscate: Weird. I'm from San Diego, and no one really speaks of it.
[16:57:55] smathy: Scriptonaut, cool, looks like a lovely place.
[16:58:18] smathy: Scriptonaut, that's where you live, or it's a holiday place?
[16:58:34] Scriptonaut: I live north of Seattle, when my Grandpa died he gave us his house
[16:58:35] smathy: Obfuscate, different circles.
[16:58:40] Scriptonaut: Holiday place, though I could live there I suppose
[16:58:51] Scriptonaut: tickets are EXPENSIVE though
[16:59:38] Obfuscate: smathy: Well, I suppose they did (a very long time ago) set some sort of standard for hamburgers, but that time has certainly passed.
[17:00:34] smathy: Scriptonaut, gotcha. We went to Tassie once, Hobart, drove down around the Huon, did the Tahune skywalk thingy.
[17:01:09] smathy: Scriptonaut, yeah, some of the reason we moved to the US was because we were always holidaying here anyway, and yeah, it's a long and expensive flight.
[17:01:12] voltalio: has joined #RubyOnRails
[17:01:19] smathy: Obfuscate, makes sense.
[17:01:36] Scriptonaut: Cool, I did that as well, Hobart was really nice. Tassie is awesome, I could see myself hermitting up with my girlfriend there for a few years
[17:01:54] nik_-_: has joined #RubyOnRails
[17:02:03] petricore: has joined #RubyOnRails
[17:02:23] Scriptonaut: Everything there really is deadly though. Last time I was there I caught a huntsment the size of a dinner plate with a casserole dish
[17:02:45] Scriptonaut: tiger snakes every morning in the drive way, girl was attacked by a great white on our beach
[17:02:58] smathy: Heh, huntsmen aren't toxic though.
[17:03:05] charliesome: has joined #RubyOnRails
[17:03:12] Scriptonaut: True that, just scary as hell
[17:03:50] satinder: has joined #RubyOnRails
[17:04:45] smathy: Heh, we call them house spiders.
[17:05:09] smathy: They love loving inside the house, growing up we'd always call the huntsmen in our house "James" :)
[17:05:56] carlesso: has joined #RubyOnRails
[17:06:15] Scriptonaut: haha that's great
[17:06:32] smathy: Tiger snakes aren't too bad either, not like a brown snake.
[17:06:57] smathy: Great Whites are definitely the worst of all those three.
[17:07:06] smathy: Kill you without meaning it.
[17:07:22] rakm: has joined #RubyOnRails
[17:07:38] Macaveli: has joined #RubyOnRails
[17:07:56] Scriptonaut: crocs as well, though I never saw any in Tasmania
[17:08:15] Scriptonaut: I suppose we have to worry about Cougar/Bear/Moose where I live
[17:10:06] smathy: I grew up with the funnel web spider in my backyard, so nothing else really seems very dangerous.
[17:10:35] startupality: has joined #RubyOnRails
[17:11:29] Kallis: has joined #RubyOnRails
[17:11:49] annlewis: has joined #RubyOnRails
[17:12:41] banister: has joined #RubyOnRails
[17:14:08] jstew: has joined #RubyOnRails
[17:14:44] RegulationD: has joined #RubyOnRails
[17:14:44] vjdhama_: has joined #RubyOnRails
[17:15:10] jstew: has left #RubyOnRails: ()
[17:16:50] banjara: has joined #RubyOnRails
[17:17:12] PhantomSpank: has joined #RubyOnRails
[17:17:41] ebragaparah: has joined #RubyOnRails
[17:19:25] lagweezle: I've got a controller within a modeul, with views; how can I use render_to_string from the Rails console? Rails 4.2.3 if it matters.
[17:21:52] lagweezle: .. and, can I use that with partials?
[17:22:29] infoget: has left #RubyOnRails: ()
[17:22:50] dymk: has joined #RubyOnRails
[17:23:25] PhaseCode: has joined #RubyOnRails
[17:24:11] smathy: lagweezle, http://stackoverflow.com/a/22079218/152786
[17:25:19] lagweezle: smathy: Awesome! That's what I was trying to use yesterday. Now to find out, again, what the errors were... :/
[17:27:45] scoot: has joined #RubyOnRails
[17:28:02] mary5030: has joined #RubyOnRails
[17:28:23] jgt3: has joined #RubyOnRails
[17:29:07] smathy: lagweezle, it's really not a common thing to try to do in the console.
[17:29:27] otacon-: has joined #RubyOnRails
[17:29:36] smathy: lagweezle, mostly once it comes to the controller people tend to use either logging or debuggers.
[17:29:44] smathy: controller/view
[17:30:06] lagweezle: Yeah. I get that. I'm sadly in a much more exploratory phase.
[17:30:28] lagweezle: This wya I don't need all the supporting interactions and data as much.
[17:30:44] smathy: Understood.
[17:32:08] paulcsmith: has joined #RubyOnRails
[17:35:09] Lincee: has joined #RubyOnRails
[17:36:29] vjdhama: has joined #RubyOnRails
[17:37:10] bruno-: has joined #RubyOnRails
[17:37:11] yaymukund: has joined #RubyOnRails
[17:37:17] sypheren: has joined #RubyOnRails
[17:38:05] bronson: has joined #RubyOnRails
[17:38:37] lagweezle: Hallelujah! Success!
[17:38:55] lagweezle: Interesting. It returns a string.
[17:39:10] lagweezle: Wonder if that is the same as what rendeR_to_string would give me.
[17:40:02] arup_r: when I am soft deleting a user, I am just changing the ownership if the user owns any assets using a callback https://gist.github.com/aruprakshit/3a61601e0a4649b4d73e#file-user-rb-L8 . can I beautify this method /
[17:40:36] banjara1: has joined #RubyOnRails
[17:42:19] jenrzzz: has joined #RubyOnRails
[17:42:37] smathy: arup_r, What if asset.tenant.users.first *IS* self ?
[17:42:59] bricker: server explodes
[17:43:03] bricker: world ends
[17:43:24] bricker: arup_r floats through space forever reflecting on his code
[17:43:41] mrmylanman: has joined #RubyOnRails
[17:43:44] smathy: "Damnit, not again!"
[17:44:34] arup_r: smathy: That wouldn't happen. Because After destroy it is.
[17:44:45] arup_r: User deletion is soft deletion
[17:45:02] arup_r: User,first is the first active user
[17:45:40] arup_r: Look the second line of the model.. What power I gave it
[17:46:27] smathy: Only issue I really see is that you should use save! so any errors rollback the delete
[17:47:21] das3in: has joined #RubyOnRails
[17:47:32] havenwood: has joined #RubyOnRails
[17:47:54] _el_fer_: has joined #RubyOnRails
[17:48:05] arup_r: smathy: If something is wrong save will returns false and callback will stop and ROLLBACK ?
[17:48:10] lagweezle: If I need a model--some class to hold data and operate on the data--that will NOT exist in the database, is it considered bad to have that in the app/models directory structure? Is that likely to muck with autoloading and attempts to interact with the database?
[17:48:48] doerteDev: has joined #RubyOnRails
[17:48:58] thsig: has joined #RubyOnRails
[17:49:08] das3in: Hey everyone, something happened between last night and today and I'm not sure what... but every local rails app I have won't start. This https://gist.github.com/das3in/36a9460d6ad338f54413 same error on all (localhost:3000 for every)
[17:49:31] hippyphysicist: has joined #RubyOnRails
[17:49:33] dangelov: has joined #RubyOnRails
[17:50:26] tfitts: looks like a networking issue
[17:50:39] tfitts: is your box having internet connection issues?
[17:50:48] smathy: arup_r, well for a start, the result of an each is not the result from the block, and even if it was the block would only return false if the LAST .save failed, BUT it wouldn't matter anyway because after_ callbacks have to raise exceptions for rollback, returning false isn't enough.
[17:50:51] Hallucinations: has joined #RubyOnRails
[17:51:03] das3in: Nope I'm talking to you all
[17:51:17] defsdoor: das3in, cat /etc/hosts
[17:51:51] Scripore: has joined #RubyOnRails
[17:51:56] das3in: hmm, ok I think I got it
[17:52:16] das3in: I think I'd conigured lvh.me for some node stuff I was working on
[17:52:30] smathy: lagweezle, no, not bad at all.
[17:52:35] krisquigley: has joined #RubyOnRails
[17:52:55] das3in: where would I configure that in a Rails app?
[17:53:32] dangelov: hey folks, working on a quick simple app for myself, and I'm trying to implement fragment caching for a view (complete rails newbie btw)
[17:53:40] dangelov: but it seems like no matter what I do, the code in the fragment gets executed
[17:53:49] dangelov: here's a gist of the code: https://gist.github.com/dangelov/1ffc80b8a9095c930bc2
[17:54:57] achamian: has joined #RubyOnRails
[17:56:06] das3in: f it just sreset the hosts file lol. Thanks defsdoor
[17:57:06] jas02: has joined #RubyOnRails
[17:58:51] smathy: dangelov, take a read of http://guides.rubyonrails.org/caching_with_rails.html
[17:58:54] dangelov: ruby 2.2.3 and rails 4.2.4
[17:59:00] dangelov: smathy: i did go through that
[17:59:37] bruno-: has joined #RubyOnRails
[18:00:21] baweaver: has joined #RubyOnRails
[18:00:36] boombadaroomba: has joined #RubyOnRails
[18:00:45] smathy: dangelov, add this above your cache line: <%= Rails.configuration.action_controller.perform_caching %> and tell me what gets output in your browser.
[18:01:05] yfeldblum: has joined #RubyOnRails
[18:01:12] dangelov: smathy: i changed that to true in my environments/development.rb file
[18:01:23] vjdhama: has joined #RubyOnRails
[18:01:49] disgrntld: has joined #RubyOnRails
[18:02:04] smathy: dangelov, and you restarted your server?
[18:02:16] dangelov: smathy: added it to my views as well now, just in case, outputs "true"
[18:02:17] yfeldblum: has joined #RubyOnRails
[18:02:40] dangelov: running with `rails server` in dev mode, so it gets auto-reloaded afaik, but even then i restarted the server
[18:03:44] smathy: dangelov, ok, and if you add something on the line under your cache line like: <h1>Not caching :(</h1> you're telling me that's printed out?
[18:04:58] ericjphillips: has joined #RubyOnRails
[18:05:03] dangelov: smathy: so like add that between line 1 and 2 in the gist?
[18:05:10] blackmesa: has joined #RubyOnRails
[18:05:29] dangelov: smathy: just did, yes, it outputs "not caching"
[18:05:56] cnk: has joined #RubyOnRails
[18:07:14] smathy: dangelov, very odd, your exact code works fine for me.
[18:07:20] Guest54271: has joined #RubyOnRails
[18:08:28] frmendes: has joined #RubyOnRails
[18:08:48] lagweezle: Most folks in here are more EST less PST..?
[18:09:30] lagweezle: That, yeah. I've noticed that when I ask questions in *my* afternoon, it's pretty rare to get much response.
[18:10:06] stamina: has joined #RubyOnRails
[18:10:09] Ergo: has joined #RubyOnRails
[18:11:00] dangelov: smathy: yeah? That's strange. I tried a bunch of SO pages and blogs, and yeah they all suggest something akin to what I have
[18:11:05] Cervajz_: has joined #RubyOnRails
[18:11:08] tubbo: lagweezle: i'm east coast
[18:11:15] Scripore: has joined #RubyOnRails
[18:11:19] manfrin: has joined #RubyOnRails
[18:11:26] dangelov: are you testing it in dev mode btw? Could the fact that Rails reloads the code on each request somehow throw out the cache?
[18:12:09] smathy: dangelov, yes, dev mode.
[18:12:44] smathy: dangelov, no, the only trick in dev mode is the config setting and restarting.
[18:13:02] annlewis: has joined #RubyOnRails
[18:13:37] Kallis: has joined #RubyOnRails
[18:14:23] Cervajz: has joined #RubyOnRails
[18:14:42] voltalio: has joined #RubyOnRails
[18:15:04] dangelov: smathy: I tried running the server in -e production, then back to without it and now it seems caching works fine. Weird, but progress :) thanks for your suggestions and help
[18:15:19] reeve_: has joined #RubyOnRails
[18:15:35] Cervajz__: has joined #RubyOnRails
[18:16:32] smathy: dangelov, umm, are you using the standard webrick server?
[18:16:41] banjara: has joined #RubyOnRails
[18:16:46] dangelov: smathy: yeah
[18:16:53] smathy: dangelov, so, single process?
[18:17:17] dangelov: smathy: not sure. Whatever the defaults are, I haven't made any modifications afaik
[18:17:44] smathy: dangelov, ok, so yes. Might have been a spring issue, although weird that you were actually getting `true` output in the browser.
[18:18:17] Guest54271: has joined #RubyOnRails
[18:18:18] smathy: dangelov, and you said you restarted your server (I assume you mean the whole computer). Glad you got it working, I'll add that peculiar "fix" to my list of things to try :)
[18:18:53] fmcgeough: has joined #RubyOnRails
[18:19:30] dangelov: smathy: running this in an atlantic.net XS (they had a $0.99 promo a while back) server, where i installed rails. I didn't restart the actual machine, but just the rails server (Ctrl +C, ran it with -e production, complained about settings not being set, started without -e)
[18:19:31] scoot: has joined #RubyOnRails
[18:20:23] smathy: dangelov, ah ok, could still have been spring then.
[18:21:03] dangelov: i'll read up on spring :) this was literally day 1 of rails for me, but i really wanted to try it out on this super-simple side project
[18:21:11] baweaver: has joined #RubyOnRails
[18:21:22] smathy: dangelov, spring basically keeps your app loaded in memory even for the command line - it sometimes misbehaves and doesn't pick up new settings on server restarts so you have to `spring stop` before starting your app back up with `rails s`
[18:21:45] dangelov: that's a useful tip, thanks
[18:21:58] otacon-_: has joined #RubyOnRails
[18:21:58] smathy: dangelov, welcome to Rails.
[18:22:01] Guest54271: has joined #RubyOnRails
[18:22:03] momomomomo: has joined #RubyOnRails
[18:22:13] dangelov: smathy: thank you :)
[18:22:50] tfitts: has joined #RubyOnRails
[18:26:25] rromanchuk: has joined #RubyOnRails
[18:26:59] djbkd: has joined #RubyOnRails
[18:27:03] Guest54271: has joined #RubyOnRails
[18:27:18] crunk_bear: has joined #RubyOnRails
[18:29:17] momomomomo_: has joined #RubyOnRails
[18:30:43] Lightsword: has joined #RubyOnRails
[18:31:48] jenrzzz: has joined #RubyOnRails
[18:33:52] dionysus69: has joined #RubyOnRails
[18:33:54] rushed: has joined #RubyOnRails
[18:34:07] vjdhama: has joined #RubyOnRails
[18:35:04] mosez: has joined #RubyOnRails
[18:38:37] tsujp: has joined #RubyOnRails
[18:39:02] bronson: has joined #RubyOnRails
[18:39:09] mary5030: has joined #RubyOnRails
[18:39:19] Guest54271: has joined #RubyOnRails
[18:40:57] redondo: has joined #RubyOnRails
[18:40:58] Coldblackice: has joined #RubyOnRails
[18:41:19] dideler: has joined #RubyOnRails
[18:43:52] Guest54271: has joined #RubyOnRails
[18:44:33] tfitts: has joined #RubyOnRails
[18:48:25] isjaylee: has joined #RubyOnRails
[18:48:36] Lytol: has joined #RubyOnRails
[18:49:12] macq: has joined #RubyOnRails
[18:49:34] vircung|afk: has joined #RubyOnRails
[18:49:54] r0bby_: has joined #RubyOnRails
[18:50:13] blackmesa: has joined #RubyOnRails
[18:50:22] sakozdqqhytuagqn: has joined #RubyOnRails
[18:50:29] neanderslob: has joined #RubyOnRails
[18:51:36] isjaylee: has left #RubyOnRails: ()
[18:51:47] isjaylee: has joined #RubyOnRails
[18:52:26] isjaylee: I'm trying to search two models: blogs and tags. I have one input field. How do I make it so my search query returns blog results where name contains query and tags contains query without one overlapping the other?
[18:52:27] shoutsid06: has joined #RubyOnRails
[18:53:01] syath_: has joined #RubyOnRails
[18:53:33] srinidhi: has joined #RubyOnRails
[18:54:27] r0bby_: has joined #RubyOnRails
[18:54:31] toretore: has joined #RubyOnRails
[18:54:43] oogabubchub: has joined #RubyOnRails
[18:54:53] tubbo: isjaylee: what database are you using?
[18:54:54] targaf: Anyone have any experience using the attr_encrypted gem? I can't seem to figure out how to get model validations working around it.
[18:54:59] Scriptonaut: has anyone ever had nested attributes where the model with a belongs_to contains the model that is belongs to as a nested param?
[18:55:04] isjaylee: tubbo: postgres
[18:55:06] Scriptonaut: I'm having trouble getting it to play nice with strong_params
[18:55:31] tubbo: isjaylee: you could use the PgSearch gem's multisearch feature to do fulltext searching over multiple objects
[18:56:05] Scriptonaut: Users belong to accounts, and each account has many users: https://gist.github.com/robins35/b2d0e9fee668e7b996fd
[18:56:08] Scriptonaut: that's the strong params
[18:56:20] isjaylee: tubbo: hoping to not rely on a gem to do it. thinking it might be overkill for what i'm doing
[18:56:39] Scriptonaut: and I get this when I try to access user_params: Unpermitted parameters: account
[18:56:56] scoot: has joined #RubyOnRails
[18:58:00] CanTonic: has joined #RubyOnRails
[18:58:05] tubbo: isjaylee: well, it depends on what you want to do here and what the search is really for. are you trying to match on trigrams and partial matches of each word, or just the word itself? do you want to rank results differently?
[18:58:21] tubbo: like maybe blogs get higher precedence over tags unless the query begins with "#"
[18:58:41] tubbo: isjaylee: you should get over you fear of using 3rd-party gems or "bringing in a 'whole gem' just to do this <insert thing here>"
[18:58:49] manfrin: has joined #RubyOnRails
[18:58:57] isjaylee: tubbo: here's what I have so far: @blogs.where("name ilike ?", params[:query])
[18:59:07] tubbo: isjaylee: yes but didn
[18:59:14] srinidhi1: has joined #RubyOnRails
[18:59:16] tubbo: isjaylee: didn't you want to search on Tag as well?
[18:59:21] isjaylee: tubbo: my next line is: @blogs.tagged_with(params[:query])
[18:59:28] isjaylee: tubbo: right. which is where i'm getting stuck
[18:59:42] isjaylee: tubbo: otherwise one would override the other regardless of which one comes first
[18:59:49] netzfisch: has joined #RubyOnRails
[18:59:53] tweeeaks: has joined #RubyOnRails
[18:59:57] letitflow: has joined #RubyOnRails
[19:00:07] tubbo: isjaylee: right so you'd probably want that to be in the same query, with an OR
[19:00:25] tubbo: Blog.where("name ilike ?", params[:query]) # <-- bad idea btw
[19:00:29] tubbo: actually not sure about that
[19:00:34] tubbo: i might be wrong about rails string cleaning
[19:00:41] isjaylee: tubbo: there a nice way of doing that with the 'tagged_with' method?
[19:00:55] tubbo: Scriptonaut: so what happens when you change :account_attributes to :account?
[19:01:00] isjaylee: tubbo: because tag is it's own method
[19:01:02] tubbo: isjaylee: i don't know what tagged_with is
[19:01:11] tubbo: isjaylee: did you make that?
[19:01:13] rromanchuk: has joined #RubyOnRails
[19:01:27] Scriptonaut: tubbo: ActiveRecord::AssociationTypeMismatch (Account(#70144342866100) expected, got ActionController::Parameters(#70144234749560)):
[19:01:27] isjaylee: tubbo: *model. sorry. tagged_with is part of acts_as_taggable gem
[19:01:36] isjaylee: tubbo: essentially write a sql query
[19:01:40] slash_nick: tubbo: https://github.com/mbleigh/acts-as-taggable-on#finding-tagged-objects
[19:01:47] tubbo: Scriptonaut: so why are you sending 'account' as the param name rather than 'account_attributes'?
[19:01:52] isjaylee: tubbo: just wondering if there's a good way to do it without rewriting the sql
[19:02:08] tubbo: isjaylee: probably not.
[19:02:10] Scriptonaut: = form.fields_for :account, account do |builder|
[19:02:14] Scriptonaut: that's how I make it
[19:02:23] Scriptonaut: I do it like that in lots of places
[19:02:37] Scriptonaut: fields_for really confuses me I can never just get it to work
[19:02:43] tubbo: always seems to work for me
[19:02:48] isjaylee: tubbo: alright, thanks. didn't want to mess with sql if i didn't have to. thanks
[19:02:56] tubbo: Scriptonaut: why are you passing `account` as the second argument into fields_for? i never need to do that..
[19:03:03] tubbo: i just do `f.fields_for :associations`
[19:03:27] tubbo: Scriptonaut: it's a little wonky but once you get the hang of fields_for, it's like riding a bike :P
[19:03:31] Scriptonaut: so it has an actual object in there
[19:03:35] tubbo: isjaylee: well you kind-of already are :)
[19:03:38] tubbo: by using an ILIKE
[19:03:47] Scriptonaut: I've used fields_for so much on this app and it still trips me up
[19:03:56] vjdhama_: has joined #RubyOnRails
[19:04:05] tubbo: Scriptonaut: pretty sure you don't need to do that..
[19:04:11] tubbo: fields_for will create the form object for you
[19:04:23] isjaylee: tubbo: right, i get that. just didn't want to rewrite the method and do joins and whatnot
[19:04:34] jenrzzz: has joined #RubyOnRails
[19:04:36] tubbo: i also advocate the use of simple_form because rails forms are not good enough most of the time...
[19:04:58] tubbo: <%= f.input :the_attribute %> is better than going "okay...is this supposed to be a text field? select? radio?"
[19:05:47] tubbo: isjaylee: if this is truly a field that you're expecting people to just type whatever in and get both blog name and tag name results...you probably are going to need some kind of search thing anyway.
[19:05:53] tubbo: after a certain size, ILIKE becomes very slow
[19:05:57] tubbo: table size*
[19:07:27] Scriptonaut: tubbo: when should I use: account: vs account_attributes:
[19:07:30] Scriptonaut: in my strong params
[19:07:32] Scriptonaut: that's what's tripping me up
[19:07:37] isjaylee: has left #RubyOnRails: ()
[19:07:40] tsujp: has joined #RubyOnRails
[19:08:01] tubbo: Scriptonaut: it seems like `account_attributes:` is what you need here..
[19:08:21] Scriptonaut: I did that, but when I look at the plain params, it's just calling it account:
[19:08:30] Scriptonaut: but when I change it to account: in the strong params it gives me that mismatch error
[19:08:31] tubbo: Scriptonaut: you got accepts_nested_attributes_for in your model?
[19:08:44] tfittsy: has joined #RubyOnRails
[19:09:15] Scriptonaut: users belong_to accounts, and accounts has_many users. I have an accepts_nested_attributes_for :users in account
[19:09:26] Scriptonaut: since it's going the opposite way, do I also need one in users for accounts?
[19:09:57] tubbo: Scriptonaut: yeah...i mean...Account doesn't know User has that configured on it.
[19:10:22] momomomomo: has joined #RubyOnRails
[19:11:15] nym: has joined #RubyOnRails
[19:11:52] ericjphillips: has joined #RubyOnRails
[19:12:01] Scriptonaut: tubbo: that made no difference. I provided the plain params: https://gist.github.com/robins35/32ee589b1e1ca803398c
[19:12:25] Scriptonaut: user_params don't return the account params
[19:12:49] tubbo: Scriptonaut: you're still permitting :account_params rather than :account
[19:13:21] Scriptonaut: I can't do just account: I get: ActiveRecord::AssociationTypeMismatch (Account(#70144108970100) expected, got ActionController::Parameters(#70144234749560)):
[19:13:48] annlewis: has joined #RubyOnRails
[19:15:38] tubbo: that was before you did accepts_nested_attributes_for though
[19:15:57] Scriptonaut: I'm still getting that error even after adding that
[19:16:12] jas02: has joined #RubyOnRails
[19:17:05] bmalum: has joined #RubyOnRails
[19:17:29] startupality: has joined #RubyOnRails
[19:17:55] Scriptonaut: also, without providing account, it doesn't render anything in there
[19:17:58] tubbo: so a user belongs_to :account then
[19:18:09] jenrzzz: has joined #RubyOnRails
[19:18:09] Scriptonaut: and an account is nested inside a user in this form
[19:18:16] Scriptonaut: it's the opposite of normal
[19:18:30] annlewis: has joined #RubyOnRails
[19:18:54] memnon34: has joined #RubyOnRails
[19:19:19] tubbo: what does an Account represent in this case?
[19:19:56] Scriptonaut: an Account is what people pay for, it's a place for them to share a bunch of info with other users on their account, usually 2-40 users per account
[19:20:07] Scriptonaut: I just got it to work by adding account back in there
[19:20:14] Scriptonaut: I wonder if it was the nested_attributes all this time
[19:20:24] tubbo: Scriptonaut: that's pretty clear
[19:20:28] Scriptonaut: I don't quite understand why I had to pass fields_for an object
[19:20:35] Scriptonaut: rather than just let it infer
[19:20:48] tubbo: it's the one piece you didn't actually implement that should've been there...so i'd say it's a safe bet to assume that was the culprit
[19:21:04] vjdhama: has joined #RubyOnRails
[19:21:10] Scriptonaut: thanks for the help tubbo
[19:21:11] tubbo: fwiw i think the nested forms thing in rails is pretty nuts lol
[19:21:29] Scriptonaut: ya, it's the only thing that doesn't work smoothly for me
[19:21:59] jmaya: has joined #RubyOnRails
[19:22:19] lxsameer: has joined #RubyOnRails
[19:22:46] startupality: has joined #RubyOnRails
[19:22:56] baweaver: has joined #RubyOnRails
[19:26:00] frmendes: has joined #RubyOnRails
[19:27:05] Pumukel: has joined #RubyOnRails
[19:27:50] Wolland: has joined #RubyOnRails
[19:28:01] atmosx_laptop: has joined #RubyOnRails
[19:28:44] bratsche: has joined #RubyOnRails
[19:29:15] jahpereira: has joined #RubyOnRails
[19:29:28] jahpereira: I am back to get some clearance
[19:29:31] rhizome: has joined #RubyOnRails
[19:29:46] jahpereira: I am trying to get an ajax call to submit a form and then run javascript on success
[19:30:13] jahpereira: I have defined the ajax call as a POST and the url is $(this).attr(???action???)
[19:30:23] jahpereira: but unfortunately I keep getting a 404 not found
[19:30:45] jahpereira: I have POST request configured in my routes.rb
[19:31:01] jahpereira: because when I submit the form without ajax it gives me the correct answer
[19:31:44] tubbo: jahpereira: have you read http://guides.rubyonrails.org/working_with_javascript_in_rails.html?
[19:31:51] jmaya: has joined #RubyOnRails
[19:32:16] podman: has joined #RubyOnRails
[19:33:08] sandstrom: has joined #RubyOnRails
[19:33:08] tubbo: jahpereira: specifically, http://guides.rubyonrails.org/working_with_javascript_in_rails.html#form-for shows you an example of how to build a form that submits asynchronously, and how to bind a JS event handler to when the ajax request succeeds
[19:33:27] tubbo: here's some other events you can bind to. they work for both remote links and remote forms -> https://github.com/rails/jquery-ujs/wiki/ajax
[19:33:57] maz-dev: has joined #RubyOnRails
[19:35:47] baweaver: has joined #RubyOnRails
[19:37:47] yaymukund: has joined #RubyOnRails
[19:38:03] qejk: has joined #RubyOnRails
[19:39:56] bronson: has joined #RubyOnRails
[19:40:12] Guest54271: has joined #RubyOnRails
[19:41:12] jahpereira: ok read that
[19:41:24] jahpereira: but from reading that I have a new question
[19:41:34] jahpereira: when i add remote: true to the form
[19:41:51] jahpereira: i only have to worry about writing js to success or failure?
[19:42:08] jahpereira: or do I have to explicitly say to make a post request to the form???s action?
[19:42:41] ruurd: has joined #RubyOnRails
[19:44:04] bronson: has joined #RubyOnRails
[19:44:32] sarink: has joined #RubyOnRails
[19:45:39] lasker85: has joined #RubyOnRails
[19:46:13] dnewkerk: has joined #RubyOnRails
[19:46:49] memnon34: has joined #RubyOnRails
[19:47:48] tubbo: jahpereira: no, you just have to set remote: true on the form and bind handlers to the ajax events.
[19:48:03] jahpereira: not working then
[19:48:06] arooni: has joined #RubyOnRails
[19:48:07] tubbo: jahpereira: jquery_ujs makes the actual ajax request for you
[19:48:12] tubbo: jahpereira: !gist your code
[19:48:12] helpa: jahpereira: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[19:48:17] tubbo: fuck you helpa
[19:48:24] tubbo: jahpereira: post your code to http://gist.github.com
[19:48:30] lasker85: I'm having a hard time writing a destroy link https://gist.github.com/chrisbrunk/8ce1c4c99b41af5f5d8c
[19:48:37] arooni: has joined #RubyOnRails
[19:48:37] lasker85: That's what's in my controller
[19:49:01] lasker85: In my view i'm running through a .each item and trying to make a link to destroying the item
[19:49:28] jcromartie: has joined #RubyOnRails
[19:49:31] tubbo: lasker85: you gonna add the form code to that gist?
[19:49:38] lasker85: sure i'll do that
[19:49:45] Maletor: has joined #RubyOnRails
[19:49:49] bronson: has joined #RubyOnRails
[19:49:55] jahpereira: just a sec tubbo
[19:50:20] tubbo: lasker85: sorry, the code in which the delete link appears
[19:51:19] lasker85: https://gist.github.com/chrisbrunk/885429fb71246d3c4aa3
[19:51:38] bronson: has joined #RubyOnRails
[19:52:12] startupality: has joined #RubyOnRails
[19:52:20] stamina: has joined #RubyOnRails
[19:53:09] iamdevnul: you need the path helper in the link_to
[19:53:29] krisquigley: has joined #RubyOnRails
[19:53:39] vjdhama: has joined #RubyOnRails
[19:54:00] iamdevnul: like wardrobe_helper_destroy_path(item)
[19:54:05] iamdevnul: or w/e it is
[19:54:22] tubbo: lasker85: the fuck is this? <%= link_to 'Destroy', ?? %>
[19:54:48] tubbo: just pseudocode?
[19:55:01] kadoppe: has joined #RubyOnRails
[19:55:06] lasker85: that's the destroy link i'm trying tow rite
[19:55:14] Coldblackice: has joined #RubyOnRails
[19:55:41] tubbo: lasker85: ok...so the way you make "destroy" links in rails is by passing the model's URL (like the "show" path) as the href, and then set method: :delete
[19:55:41] rhizome: should be a button_to, but i'm not going to get into it again
[19:56:02] tubbo: rhizome: you're a button to
[19:56:11] rhizome: WHAT DID I SAY
[19:56:24] tubbo: rhizome: semantically, you mean?
[19:56:32] cnk: iamdevnul: this has a good example http://mixandgo.com/blog/how-to-use-link_to-in-rails
[19:56:40] rhizome: links should always be GETs
[19:56:56] Guest54271: has joined #RubyOnRails
[19:56:58] tubbo: probably true, unless it's like a "Cancel" button in a <form>.
[19:57:13] tubbo: you actually *can't* make that a button_to...
[19:57:27] cnk: And I think rhizome's point is kind of well taken - but rails will do a javascript nicity to turn the link into a post
[19:57:32] tubbo: basically why foundation lets you style <button> and <a> the same way
[19:57:46] rhizome: right, unless you're going to make it an alternate submit button that is redirected somewhere, but cancel in my world is usually just a link back to the front page or something
[19:58:01] tubbo: right. i typically use it in lieu of a close button for modal popup forms
[19:59:03] rhizome: i believe links are gets is part of the http spec, but i don't seem to have bookmarked it
[19:59:07] jahpereira: tubbo: can I pm you?
[19:59:11] iamdevnul: cnk: thanks. i had assumed he had written the proper entry in routes to make what he was doinging happen
[19:59:16] rhizome: and i don't have a photographic memory
[19:59:26] tubbo: jahpereira: i would rather you didn't, for the benefit of those who are lurking and may have a similar problem to yours.
[19:59:27] vjdhama: has joined #RubyOnRails
[19:59:38] jahpereira: so here is link to gist: https://gist.github.com/anonymous/c5eb5185cd16c8216438
[19:59:41] slash_nick: tubbo: for modals i use a "close" in top right, "cancel" button in footer, clicking the modal backdrop, or hitting the escape key as ways to escape
[19:59:56] jahpereira: I only pasted the code I think its useful
[20:00:15] jahpereira: let me say that I am still very green in RoR so I hve trying many things at the same time
[20:00:19] rromanchuk: has joined #RubyOnRails
[20:00:27] slash_nick: jahpereira: what's the problem again?
[20:00:32] tubbo: slash_nick: ahh yeah i wish foundation had a "prepend html" config option for reveal so i could *always* have the close button in there without thinking about it..
[20:01:00] jahpereira: I am not able to post form and run custom javascript
[20:01:22] jahpereira: in the gist file I just placed a simple alert, if I get it to work, I can go from there
[20:02:01] slash_nick: jahpereira: seems liek you want something like $("form").on("submit", function(){ alert('submit via ajax'); return false })
[20:02:14] kies^: has joined #RubyOnRails
[20:02:16] slash_nick: of course, replace alert() with something like $.ajax()
[20:02:29] tubbo: jahpereira: your JS code has syntax errors in it...
[20:02:45] tubbo: slash_nick: why would he want to do that when rails ujs does what he wants for him? :P
[20:02:46] Cervajz: has joined #RubyOnRails
[20:03:06] jahpereira: in the ajax success line right?
[20:03:15] Scripore: has joined #RubyOnRails
[20:03:23] tubbo: jahpereira: https://gist.github.com/anonymous/c5eb5185cd16c8216438#file-wizard-js-L10-L12 no closing paren or semicolon...
[20:03:26] jahpereira: that???s why I took so long to create my gist file??? I was trying to find out what???s wrong before sharing
[20:03:41] tubbo: jahpereira: also doesn't have a `function` declaration
[20:03:52] rhizome: you're very green in RoR, you don't know what's relevant or wrong
[20:03:57] tubbo: jahpereira: my first suggestion is to enusre you have no JS errors going on
[20:04:23] pvac: has joined #RubyOnRails
[20:04:28] jahpereira: when I replace my code with yours
[20:04:36] jahpereira: I know get ???SyntaxError: Unexpected token '{'. Expected ')' to end a argument list.???
[20:05:06] mices: can i adminstrate other classes from my admin controller
[20:05:23] tubbo: jahpereira: update the gist
[20:05:41] tubbo: mices: !vauge
[20:05:43] tubbo: mices: !vague
[20:05:43] helpa: mices: Your question has just been deemed vague; please consider rewording it. It may also help to give us any relevant code or errors so that we may better assist you.
[20:05:57] helpa: What "didn't work"? Did your server not start? Did your computer explode? Did your webpage turn bright pink? Did your client not pay your bill on time? You may have to be more specific. A Gist (http://gist.github.com) of the code that doesn't work (and the error you are getting) will be helpful.
[20:06:12] helpa: tubbo: ( -_・)σ - - - - - - - - ・
[20:06:16] slash_nick: it's not you.
[20:06:23] tubbo: oh it's not in here
[20:06:32] tubbo: mices: be more specific
[20:06:50] slash_nick: tubbo: !toss
[20:06:50] helpa: slash_nick ( ・_・)σ '````'-.,_,.-.,_,.©¤ tubbo
[20:06:55] slash_nick: it is in here...
[20:07:09] tubbo: oh wait yeah it is
[20:07:12] tubbo: but it can't speak b/c not registered
[20:07:24] slash_nick: makes sense...
[20:07:29] jahpereira: I am so tired, too many hours in front of the computer
[20:07:36] jahpereira: ok, I have to login in order to update the gist
[20:07:55] slash_nick: mices: from helpa-bot: "Your question has just been deemed vague; please consider rewording it. It may also help to give us any relevant code or errors so that we may better assist you."
[20:08:40] mices: ok here's my pre-code issue: i have my controllers all defined as only: show in before_action callback and now i've added a user model and an admin controller and so far the only thing i'm adminstrating are users, i need to adminstrate the things that my other controllers deal with
[20:09:26] tubbo: mices: shouldn't the UsersController be manipulating User records?
[20:09:30] cantonic_: has joined #RubyOnRails
[20:11:17] shinnya: has joined #RubyOnRails
[20:11:34] mices: i think i should gist my admin and users controllers
[20:11:50] jahpereira: tubbo: https://gist.github.com/jahpereira/c22fb4322305c64b02de
[20:12:01] jahpereira: I fixed the js syntax I think..
[20:12:13] jahpereira: my submit button does nothing at this moment :/
[20:12:38] Guest54271: has joined #RubyOnRails
[20:12:54] tubbo: jahpereira: if (!$("#wizard").length) return; that's weird.
[20:13:00] tubbo: jahpereira: you know what that's doing?
[20:13:09] jahpereira: that???s legacy code
[20:13:14] jahpereira: I got from another programmer
[20:13:21] jahpereira: I just added the onsuccess function
[20:13:29] tubbo: jahpereira: if an element with the id of "wizard" can't be found on the page, it stops executing the function.
[20:13:36] GnuYawk: has joined #RubyOnRails
[20:14:28] jahpereira: so that???s why wizard.js gets linked to my new.html.erb
[20:14:36] jahpereira: because the first line of my new.html.erb is <%= content_for :body_id, "wizard" %>
[20:15:05] tubbo: jahpereira: i don't know what that does.
[20:15:13] KensoDev: has joined #RubyOnRails
[20:15:26] mices: https://gist.github.com/mices/02416e8809ebb958cf25
[20:16:11] jahpereira: tell me something
[20:16:23] jahpereira: where is rails expecting the onsuccess or any other js to be
[20:16:30] jahpereira: for my new.html.erb?
[20:16:56] arup_r: jahpereira: assets/ may be
[20:18:03] arup_r: regarding the content_for, You have some placeholder code where you are passing dynamic html from new,html.erb
[20:18:20] arup_r: using the content_for method
[20:18:49] crdpink2: has joined #RubyOnRails
[20:18:50] jahpereira: tubbo: what do u think?
[20:18:54] jahpereira: I am lost here
[20:18:55] tubbo: jahpereira: rails isn't expecting anything, jquery_ujs merely defines some extra events onto forms, and uses jquery to make the ajax calls and query dom objects.
[20:19:33] jahpereira: but at the moment I dont think the button is posting anything at all
[20:19:53] jenrzzz_: has joined #RubyOnRails
[20:20:48] arup_r: may be somewhere in JS you have preventDefault()
[20:20:56] momomomomo: has joined #RubyOnRails
[20:21:03] arup_r: which is stopping to submit...
[20:21:52] mdel: has joined #RubyOnRails
[20:22:26] arup_r: ok.. so you went through JS code you have.. then good.
[20:23:42] jahpereira: even if I ignore the onsuccess event
[20:23:49] jahpereira: the post itself should return results
[20:23:57] jahpereira: but from the moment I added remote: true
[20:24:04] jahpereira: the button does nothing :/
[20:24:32] mices: tubbo: https://gist.github.com/mices/02416e8809ebb958cf25
[20:24:56] jahpereira: actually the button adds this to my url: ?utf8=???&button=#
[20:25:19] uris: has joined #RubyOnRails
[20:26:20] arup_r: humm... bug!
[20:26:30] jahpereira: it is submitting the wrong form
[20:26:39] achamian: has joined #RubyOnRails
[20:26:52] arup_r: you have then form inside a form ? :)
[20:27:10] jahpereira: i thought it would submit the inner one
[20:27:24] arup_r: I doubt it.. begining..
[20:27:26] vjdhama: has joined #RubyOnRails
[20:28:28] nya: has joined #RubyOnRails
[20:29:17] jahpereira: still now working
[20:29:19] jahpereira: cleaned other forms
[20:29:29] jahpereira: the button does nothing..
[20:30:04] jahpereira: except that in the resources when I inspect
[20:30:11] maze24: has joined #RubyOnRails
[20:30:12] jahpereira: I get a XHRs folder
[20:30:19] arup_r: messed up.. need more clean up
[20:30:24] jahpereira: NoMethodError in ProductsController#import
[20:30:43] arup_r: yes,, fix that first
[20:31:08] jahpereira: so through ajax
[20:31:11] jahpereira: the format is js?
[20:31:22] jahpereira: I cant use the code I had for html?
[20:32:04] Polysics: has joined #RubyOnRails
[20:32:12] arup_r: no.. remote: true enabled it for Ajax
[20:32:45] Polysics: hello! anyone can recommend a good article about has_one? I always feel like there should be more than just how it works
[20:32:54] maze24: Hi all. I have this problem maybe someone can help please? I have some logic to decide which record to load from the db in a helper. If a record related to the user input is not found, the helper loads a default record which is always in the db.. anyway, with the exact same code and records all works perfectly on local, but on production it just loads the default record
[20:33:03] Polysics: there should be a way to do seamless vertical partitioning, for example
[20:33:53] momomomomo: has joined #RubyOnRails
[20:34:07] arup_r: polysics: What about the official doc ?
[20:35:08] arup_r: Maze24: Need to debug
[20:35:38] VeryBewitching: has joined #RubyOnRails
[20:36:47] mices: my whole biographies controller is set to show only in before_action so how do i administrate biographies
[20:36:51] maze24: arup_r: i debuged on local the same exact code version and db and all works
[20:37:30] Polysics: arup_r: that's fine, I know what it does. It just feels like there are some advanced things I could do that I am not seeing
[20:38:01] jenrzzz: has joined #RubyOnRails
[20:38:22] arup_r: Maze24: code please
[20:38:47] arup_r: polysics: Like.. some advance examples you thought about ?
[20:39:10] arup_r: What are you dreaming with that... can you tell us?
[20:39:23] Polysics: so, I was thinking for example that has_one is essentially just vertical partitioning, so there might be a trick to make it transparent at the object level
[20:39:45] Polysics: like, I already have a huge Brand model. Each Brand needs about 10 Warranty settings
[20:39:54] Polysics: so Brand has_one Warranty
[20:40:05] Polysics: but then I end up having to delegate everything manually
[20:40:09] Polysics: that sort of thing
[20:40:20] Polysics: I might just have overdone it with the Adderall today.
[20:40:26] jobewan: has joined #RubyOnRails
[20:41:21] maze24: arup_r: After some more testing, i think i found the bug.. thanks for now
[20:41:25] towski_: has joined #RubyOnRails
[20:41:33] arup_r: Maze24: cool
[20:41:43] bruno-: has joined #RubyOnRails
[20:42:30] krisquigley: has joined #RubyOnRails
[20:42:44] arup_r: "Each Brand needs about 10 Warranty settings" then why has_one ?
[20:42:58] arup_r: What I am missing.. no idea.
[20:43:04] Polysics: they are all different specific entries
[20:43:17] Polysics: initial duration, initial cost, renewal cost, etc
[20:43:28] Polysics: so each Brand needs exactly one of all of those settings
[20:43:33] nfk: has joined #RubyOnRails
[20:43:36] ruurd: has joined #RubyOnRails
[20:43:56] Polysics: also, yeah, too much Adderall. The concept I was describing to you is accepts_nested_attributes_for. I should call it a day :)
[20:44:08] Polysics: I was reinventing nested models.
[20:44:28] Polysics: thanks for humoring me :)
[20:44:33] arup_r: "delegate everything manually" means ?
[20:44:43] rakm: has joined #RubyOnRails
[20:45:24] Polysics: Brand has_one Warranty, Warranty#initial_value, can't call brand.initial value without delegating, there's 14 columns in Warranty, 14 delegate calls
[20:45:30] simkessy_: has joined #RubyOnRails
[20:45:32] Polysics: no biggie as I only have to do it once
[20:45:59] Polysics: and, well, that is even not needs, as I;d rather have brand.warranty.initial_value
[20:46:11] Polysics: so yeah, d'oh :D
[20:46:43] arup_r: That is how we do... No delegation.. Just use one #includes though
[20:46:43] simkessy_: has joined #RubyOnRails
[20:46:57] Polysics: so it gets eager laoded?
[20:48:39] RTG`: has joined #RubyOnRails
[20:49:36] pixelhandler: has joined #RubyOnRails
[20:51:12] CanTonic: has joined #RubyOnRails
[20:53:32] yaymukund: has joined #RubyOnRails
[20:55:31] mrmylanman: has joined #RubyOnRails
[20:58:27] paulcsmith: has joined #RubyOnRails
[20:59:22] blackmesa: has joined #RubyOnRails
[20:59:42] otacon-: has joined #RubyOnRails
[21:00:21] dopie: has joined #RubyOnRails
[21:01:30] Rodya_: has joined #RubyOnRails
[21:01:31] yfeldblum: has joined #RubyOnRails
[21:01:34] momomomomo: has joined #RubyOnRails
[21:01:35] mwlang: has joined #RubyOnRails
[21:02:41] redondo: has joined #RubyOnRails
[21:02:46] mwlang: using the sqlserver-activerecord-adapter, is it possible to execute a multi-line T-SQL script? ActiveRecord::Base.connection.execute(some_tsql_script) fails saying syntax error near the ???GO??? keyword.
[21:03:25] manfrin: has joined #RubyOnRails
[21:03:39] mwlang: The script itself is fine, just that TinyTDS is kicking it back.
[21:04:05] yfeldblum: has joined #RubyOnRails
[21:04:29] crdpink: has joined #RubyOnRails
[21:04:44] rushed: mwlang: EXECUTE(' wheeeeeeeee')
[21:05:36] netzfisch: has joined #RubyOnRails
[21:05:37] mwlang: rushed: so you mean I should wrap the script in an ???EXECUTE(???)??? before passing to AR?
[21:06:10] annlewis: has joined #RubyOnRails
[21:06:13] mwlang: rushed: like this: ActiveRecord::Base.connection.execute "EXECUTE('#{sql_stmt}')"
[21:06:21] BaNzounet: Hey I've a controller PropertyController, what should the index do? List all the Property or List all the property added by an user?
[21:06:50] rushed: BaNzounet: you tell us?
[21:06:53] mwlang: BaNzounet: Doesn???t that depend on what you want it to do?
[21:07:11] Lytol: has joined #RubyOnRails
[21:07:24] BaNzounet: I'm wondering what the most REST answer
[21:08:11] vjdhama: has joined #RubyOnRails
[21:09:04] rushed: BaNzounet: the most REST would be to return "REST" for sure~
[21:09:46] sanjayu: has joined #RubyOnRails
[21:10:19] BaNzounet: If the index of site should list all the property, should it be the responsability of the PropertyController#index to list all of them, or should it be the homeController#index ?
[21:11:42] Maletor: Rails callbacks are definitely run in the order they are defined right? before_destroy :foo; before_destroy :bar. foo runs before bar every time right?
[21:12:36] mwlang: rushed: nevermind, hacked my way around the problem altogether: ActiveRecord::Base.connection.execute sql_stmt.split("GO\n").join(";\n")
[21:13:38] mwlang: BaNzounet: perhaps transfer the responsibility of the site???s index to the property controller???s index?
[21:14:35] mwlang: BaNzounet: you???ll have to describe your project a little and what your goals are to get a considered answer to what I think you might be asking.
[21:15:35] tubbo: rushed: +1
[21:15:47] mwlang: maletor: unknown! I would suggest a single before_destroy event and then be very explicit about what you???re doing.
[21:17:28] arup_r: maletor: Yes it excutes in order
[21:18:09] arup_r: if one of them failed.. all will be failed
[21:18:53] baweaver: has joined #RubyOnRails
[21:19:07] Puffball: has joined #RubyOnRails
[21:20:12] FrankD: has joined #RubyOnRails
[21:20:35] arup_r: maletor: You can test it by hand.. just inside the foo method wirte puts "foo" and inside the bar method puts "bar"
[21:20:47] arup_r: and run it in console and see the output order
[21:21:01] arup_r: that is the easiest way to check
[21:21:15] arup_r: anyway.. time to sleep..
[21:23:05] Maletor: arup_r: no kidding.
[21:23:29] arup_r: maletor: means ?
[21:25:44] arup_r: well. tata
[21:26:01] fschuindt: has joined #RubyOnRails
[21:26:05] arup_r: maletor: I didn't kid. I was telling you how to confirm.
[21:26:08] fschuindt: Radar: are you there?
[21:27:23] achamian: has joined #RubyOnRails
[21:28:22] CheckYourSix_: has joined #RubyOnRails
[21:30:02] maxw: What is the best way to seed users for playing around in rails console on development? Users are devise + github_omniauth, and only have uid, provider, and devise password.
[21:30:25] FailBit: user = User.create! :name => 'Administrator', :email => 'user@example.com', :password => 'please', :password_confirmation => 'please'
[21:30:29] gurix: has joined #RubyOnRails
[21:32:51] nyandoge: has joined #RubyOnRails
[21:33:20] momomomomo_: has joined #RubyOnRails
[21:34:40] Gustavo: has joined #RubyOnRails
[21:35:00] jake_g: has joined #RubyOnRails
[21:40:37] workmad3: has joined #RubyOnRails
[21:44:45] Scripore: has joined #RubyOnRails
[21:45:12] zlogan: has joined #RubyOnRails
[21:45:35] roxtrongo: has joined #RubyOnRails
[21:49:01] w09x: has joined #RubyOnRails
[21:50:14] thsig: has joined #RubyOnRails
[21:51:00] jmaya: has joined #RubyOnRails
[21:51:03] Cervajz: has joined #RubyOnRails
[21:51:38] CanTonic: has joined #RubyOnRails
[21:54:33] subshad: has joined #RubyOnRails
[21:54:36] bronson: has joined #RubyOnRails
[21:55:25] rromanchuk: has joined #RubyOnRails
[21:58:59] baweaver: has joined #RubyOnRails
[22:01:14] dopie: has joined #RubyOnRails
[22:01:59] dopamean_: has joined #RubyOnRails
[22:02:35] lasker85: has joined #RubyOnRails
[22:04:34] diegoviola: has joined #RubyOnRails
[22:04:51] jstew: has joined #RubyOnRails
[22:06:27] allcentury: has joined #RubyOnRails
[22:06:43] rhizome: i hit 'save' too often in autorun tests
[22:06:58] benhuda: has joined #RubyOnRails
[22:08:18] stamina: has joined #RubyOnRails
[22:10:09] lasker85: has joined #RubyOnRails
[22:10:16] diego2: has joined #RubyOnRails
[22:10:26] baweaver: has joined #RubyOnRails
[22:10:28] diego2: has joined #RubyOnRails
[22:10:44] momomomomo_: has joined #RubyOnRails
[22:11:12] jas02: has joined #RubyOnRails
[22:11:58] manfrin: has joined #RubyOnRails
[22:12:40] deavid: has joined #RubyOnRails
[22:14:15] Fire-Dragon-DoL: has joined #RubyOnRails
[22:15:06] chipotle: has joined #RubyOnRails
[22:16:24] mustmodify: has joined #RubyOnRails
[22:16:43] Fire-Dragon-DoL: is action mailer default delivery_method :smtp for production?
[22:17:07] bruno-: has joined #RubyOnRails
[22:17:16] Fire-Dragon-DoL: having hard time finding the default, but in PHP it was :email (I believe the `mail` executable?), hence the question
[22:17:37] frmendes: has joined #RubyOnRails
[22:18:29] mary5030: has joined #RubyOnRails
[22:19:00] mustmodify: I'm having an issue with the asset pipeline. It seems clear that some js files ( angular controllers ) were not cached but some template files ( not js ) were cached. That wouldn't necessarily be surprising, but the template in question had just been renamed, which suggests that the JS file referencing it was cached. So some JS files are cached and not others... but those two things, the template filenames and the controllers, come across in the sam
[22:19:35] baweaver: has joined #RubyOnRails
[22:20:12] startupality: has joined #RubyOnRails
[22:20:43] smathy: Fire-Dragon-DoL, it's smtp: http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration
[22:20:53] smathy: Fire-Dragon-DoL, but when/if in doubt, why not just set it.
[22:21:00] grotewold: has joined #RubyOnRails
[22:22:10] smathy: mustmodify, IRC has limits to message length, your was just truncated at "across in the sa"
[22:22:22] smathy: mustmodify, !code anyway
[22:22:22] helpa: mustmodify: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[22:22:44] smathy: By which I mean put your codes online at gist.github.com
[22:23:05] Fire-Dragon-DoL: smathy: I usually do that but I found that the company I'm working with, didn't have it explicitly set, so I was trying to understand if we were doing something extremely slow to send emails :P
[22:23:49] smathy: Fire-Dragon-DoL, there are extremely slow delivery methods?
[22:23:50] Fire-Dragon-DoL: the code* I'm working with I mean
[22:24:34] Fire-Dragon-DoL: smathy: I remember with PHP there where the mail() function which you could use to send a single email and SMTP, to send bulk emails (a few) and then <put bulk mail service here>
[22:25:57] Scriptonaut: has left #RubyOnRails: ()
[22:26:09] bruno-: has joined #RubyOnRails
[22:27:51] smathy: Fire-Dragon-DoL, ok, so you're not talking about how long it takes the emails to be delivered, but how quickly your application is unblocked?
[22:28:09] achamian: has joined #RubyOnRails
[22:30:29] recurrence: has joined #RubyOnRails
[22:30:48] recurrence: Anyone know how to convert what sleect row_to_json returns to something you can render: json with?
[22:31:23] smathy: Fire-Dragon-DoL, both smtp and sendmail will take a list of recipients and handle making the individual connections.
[22:31:27] startupality: has joined #RubyOnRails
[22:32:26] smathy: recurrence, what's select row_to_json ?
[22:32:30] rhizome: gist what row_to_json returns
[22:32:53] drale2k: has joined #RubyOnRails
[22:32:57] recurrence: oh, it???s a postgres function that returns json. Super nice as I can send it through in a second what takes rails to_json minutes :D
[22:33:44] recurrence: so you ostensibly get a Pg:Result that contains json but in a weird nested array with string key/value pairs format
[22:35:54] das3in: has joined #RubyOnRails
[22:36:00] rhizome: sounds like valid json
[22:36:21] scoot: has joined #RubyOnRails
[22:36:48] w09x: has joined #RubyOnRails
[22:38:08] EminenceHC: has joined #RubyOnRails
[22:38:47] Coldblackice: has joined #RubyOnRails
[22:38:52] djbkd: has joined #RubyOnRails
[22:41:15] das3in: Hey everyone. So something weird happened with my rails installation I think. For every local app I can't run "rails console." It hangs, when I quit I get this error https://gist.github.com/das3in/36a9460d6ad338f54413
[22:41:15] EminenceHC: I am saving uploaded pdfs to my public folder. These files need to be private so I am told to put them in a custom directory within the rails root. I would like to add a conditional statement when the request is made to retrieve the file (only users that are logged in). Will someone point me in the right direction?
[22:42:17] chouhoulis: has joined #RubyOnRails
[22:43:15] rhizome: if current_user; @pdf = Thing.find(params[:id]); else; redirect_to root_path
[22:43:19] smathy: recurrence, so render :json calls the `to_json` method on whatever you pass it, if you already have a JSON string then you probably just want to render text: "that string"
[22:43:53] smathy: das3in, run `killall -m spring` and try again.
[22:43:56] recurrence: Hi smathy it???s in a funky format though, the to_json result is mangled. I can convert it, was hoping someone had done it before so I don???t need to dig through it :)
[22:44:13] smathy: recurrence, what's a funky format? What you get from PG?
[22:44:39] recurrence: it???s a multiple nested array with an odd encoding. Nothing like you???d expect a json collection to look like :)
[22:44:43] recurrence: I???ll figure it out, thanks :)
[22:44:47] rhizome: gist yo json
[22:44:47] das3in: BAM thanks smathy that was perfect
[22:44:53] smathy: recurrence, np.
[22:44:59] das3in: smathy can you explain what was happening there?
[22:46:02] smathy: das3in, most common cause is that you had a rails app with a certain name, ran rake or rails inside it which started spring, then deleted that directory/app and created another one with the same name, and things went downhill from there.
[22:46:06] w09x: has joined #RubyOnRails
[22:46:15] smathy: das3in, assuming all that gels, it's this problem: https://github.com/rails/spring/issues/247
[22:47:16] smathy: eminencehc, you handle that sort of thing in your httpd.
[22:47:18] EminenceHC: rhizome: I see that working in order to show or hide the link to retrieve the file. I am wondering the best way to prevent anyone actually accessing that file unless current_user == true
[22:47:28] towski_: has joined #RubyOnRails
[22:47:35] lasker85: has joined #RubyOnRails
[22:49:00] arashb: has joined #RubyOnRails
[22:49:05] voltalio: has joined #RubyOnRails
[22:49:21] EminenceHC: smathy: So setting file permissions with httpd I get, but I am not sure how to get rails to set those permissions conditionally.
[22:49:39] quazimodo: has joined #RubyOnRails
[22:49:43] smathy: eminencehc, sorry, I thought you wanted something different.
[22:50:10] smathy: eminencehc, you want to use Rails to authorize access to those files, but you don't want to reveal their raw URLs (so people can never access the files directly).
[22:50:16] bruno-: has joined #RubyOnRails
[22:50:45] EminenceHC: smathy: Yes that sounds like a reasonable approach.
[22:51:11] rhizome: just off the top of my head, i think anything within public will be accessible if the accessor knows the filepath
[22:51:54] smathy: eminencehc, so, still put them in your public directory, but just name it something ridiculously long that no one will ever guess it, then you create a rails action which does the auth and uses `send_file` to trigger the httpd to send the file back to the user.
[22:51:59] smathy: They will never see the raw path.
[22:52:36] manfrin: has joined #RubyOnRails
[22:52:54] cnk: I agree with smathy, though I would probably put the files outside of public so they really can't be accessed without going through the rails controller
[22:53:12] EminenceHC: smathy: rhizome: Do you think that is enough protection for sensitive files? I am told that anything in public is accessible regardless if a user is logged in.
[22:53:21] EminenceHC: cnk: rhizome: ah gotcha
[22:53:45] rhizome: well, truly sensitive files shouldn't be accessible over the internet
[22:53:46] smathy: eminencehc, it is, but they still need to know the URL.
[22:54:05] smathy: eminencehc, if your URL includes a 300 character random string, that seems unlikely.
[22:54:12] smathy: eminencehc, BUT...
[22:54:31] EminenceHC: rhizome: Good point.
[22:55:14] smathy: eminencehc, if you're really concerned and if you're using nginx then you can configure a location block with the `internal` directive, that *can only* be served by nginx through an internal redirect like X-Sendfile.
[22:55:19] w09x: has joined #RubyOnRails
[22:55:22] EminenceHC: smathy: If I create a custom folder in my rails root, its automatically not accessible to anyone unless they are requesting from a rails path/controller?
[22:55:43] cnk: eminencehc: right
[22:55:45] rhizome: anything outside of public necessarily has to go through rails
[22:55:51] maz-dev: has joined #RubyOnRails
[22:56:00] smathy: eminencehc, yeah, but you don't want a Rails process/thread handling the streaming of a file to the browser.
[22:56:34] smathy: eminencehc, so, even if you put it outside of public, in order to hand off the streaming to your httpd you will still need to have a location/virtual-directory mapped to it.
[22:56:39] sanjayu: has joined #RubyOnRails
[22:56:46] Kallis: has joined #RubyOnRails
[22:57:17] smathy: eminencehc, as I mentioned above, either just name that folder something unguessable (and turn of and directory indexing modules/config ;) or mark it as internal if you're in nginx (and apache might have an equivalent).
[22:58:06] cnk: People used to use xsendfile to take care of that issue. Not sure if that is current state of the art or not http://makandracards.com/makandra/990-speed-up-file-downloads-with-rails-apache-and-x-sendfile
[22:58:22] jstew: has joined #RubyOnRails
[22:58:25] EminenceHC: smathy: So a link_to would use rails to render the file to the browser, what about handing that functionality off to a background job? I am using sidekiq.
[22:58:32] smathy: cnk, it is, that's what I mentioned right at the get-go.
[22:58:40] EminenceHC: I guess that is still rails though.
[22:58:43] smathy: cnk, that's what Rails's `send_file` method does.
[22:58:58] cnk: excellent!
[22:59:05] smathy: eminencehc, sidekiq can't step in and take over an open socket connection.
[22:59:18] smathy: eminencehc, you hand it off to your httpd, I'm not sure why we're still discussing this.
[22:59:19] cnk: I used it back in Rails 2 - but you had to configure it yourself
[22:59:44] smathy: cnk, actually send_file was around then too :)
[23:00:00] startupality: has joined #RubyOnRails
[23:00:19] EminenceHC: smathy: I understand, thanks for educating me. I am curious as to why we dont want a Rails process/thread handling the streaming of a file to the browser. Performance?
[23:00:20] smathy: cnk, oh, actually, nevermind - you're right, it probably didn't do the header thing.
[23:00:35] cnk: right send_file was there but the handoff was more manual
[23:00:55] smathy: eminencehc, Rails processes/threads are scarce resources, why have it tied up doing something that the httpd can do better.
[23:01:09] grotewold: has joined #RubyOnRails
[23:01:50] EminenceHC: smathy: Just for ease of implementation I suppose. Assuming I don't experience much of a performance hit.
[23:03:10] smathy: eminencehc, well if you don't do the `internal` thing then the implementation is precisely the same (just with the send_file method you need to create a longer directory name).
[23:03:24] smathy: eminencehc, with the internal thing, you're talking about three extra lines in your vhost.conf
[23:04:25] smathy: eminencehc, the other big advantage of using an nginx location block is that later, when you run out of disk space and have to move this to the cloud, nginx will happily reverse proxy that internal redirect to a cloud URL :)
[23:04:43] smathy: (3 or 4 more lines :)
[23:04:53] smathy: ACTION makes a note for another protip video
[23:05:28] EminenceHC: has joined #RubyOnRails
[23:10:29] voltalio: has joined #RubyOnRails
[23:10:59] RegulationD: has joined #RubyOnRails
[23:12:03] EminenceHC: has joined #RubyOnRails
[23:13:14] twilling: has joined #RubyOnRails
[23:14:29] grotewold: has joined #RubyOnRails
[23:15:51] baweaver: has joined #RubyOnRails
[23:16:07] jas02: has joined #RubyOnRails
[23:16:36] djbkd: has joined #RubyOnRails
[23:22:18] jas02: has joined #RubyOnRails
[23:22:27] FrankD: has joined #RubyOnRails
[23:22:36] FrankD: has joined #RubyOnRails
[23:24:18] yaymukund: has joined #RubyOnRails
[23:26:13] bonhoeffer: has joined #RubyOnRails
[23:26:25] achamian: has joined #RubyOnRails
[23:31:03] startupality: has joined #RubyOnRails
[23:38:04] mices: different controllers can use the same model?
[23:39:11] Cervajz: has joined #RubyOnRails
[23:39:41] arashb: has joined #RubyOnRails
[23:40:17] smathy: mices, give it a try.
[23:41:12] mices: is it ok convention
[23:45:04] smathy: mices, no, it's terrible.
[23:45:09] frmendes: has joined #RubyOnRails
[23:47:54] annlewis: has joined #RubyOnRails
[23:48:16] FailBit: I'd say it depends on your usecase
[23:48:46] FailBit: do not orient 2 controllers around the same model, unless one is hidden for administration
[23:49:06] FailBit: speaking of that avoid ActiveAdmin
[23:52:13] voltalio: has joined #RubyOnRails
[23:52:56] dopamean_: has joined #RubyOnRails
[23:54:49] bronson: has joined #RubyOnRails
[23:56:17] pwnd_nsfw: FailBit, I wish I knew that earlier, but I still blame my usage of it on the client
[23:56:32] pwnd_nsfw: "I want 3 month long project in 1 month"
[23:56:35] pwnd_nsfw: "ok bro, see it your way"
[23:57:33] cnk: FailBit: Has anyone written a good blog post about the limitation's of ActiveAdmin?
[23:57:45] bricker: smathy: FailBit not all website conform perfectly to Rails convention, often you need to reference the same model from two different controllers. It's not terrible at all.
[23:57:50] pwnd_nsfw: Using it basically will explain it cnk
[23:57:59] cnk: I understand it being painful if you want a fully custom backend
[23:58:00] pwnd_nsfw: Like.. first couple minutes of using it.
[23:58:06] pwnd_nsfw: It's nice for simple things if you need a quick interface
[23:58:21] pwnd_nsfw: ye, that's basically what that comes down to cnk
[23:58:41] cnk: I am using Django at work and don;t love it but as an 70 or 80% solution, their admin is really nice
[23:58:43] jenrzzz: has joined #RubyOnRails
[23:58:45] startupality: has joined #RubyOnRails
[23:58:53] smathy: bricker, ha! I misread his question as two models from the same controller.
[23:59:01] cnk: better and more maintinable than scaffolding an admin
[23:59:04] bricker: smathy: that's not terrible either
[23:59:12] smathy: Yes it is.
[23:59:32] bricker: smathy: What if I want to show two different types of data on the same page?
[23:59:41] cnk: pwnd_nsfw: I am sure you hit pain points, I am just wondering if anyone has enumerated them