PotatoChipz

Activity Graph

Page 1 of 2 | Next »

2016-07-23

[11:55:17] PotatoChipz: has joined #RubyOnRails
[11:56:27] PotatoChipz: Hi guys, what do you usually use for a polymorphic hierarchy model? Is acts_as_dag gem any good?
[12:45:31] PotatoChipz: Quit: Page closed

2016-07-17

[12:38:49] PotatoChipz: has joined #RubyOnRails
[14:43:14] PotatoChipz: Quit: Page closed

2016-07-10

[08:14:59] PotatoChipz: has joined #RubyOnRails
[08:17:55] PotatoChipz: hello. i created an activerecord class method and i'm wondering if it's possible to get the current collection from there. so i can call something like... @ar_collection.my_method
[08:18:29] PotatoChipz: 'cos right now i can only map the IDs of the records of that collection
[08:19:21] PotatoChipz: so basically I want to add an AR relation method...
[10:33:42] PotatoChipz: Ping timeout: 250 seconds

2016-07-09

[13:36:25] PotatoChipz: has joined #RubyOnRails
[13:37:17] PotatoChipz: Hello. I am trying to add a new DSL to Grape API. And I just added a new class in lib/grape/dsl directory. But.. I cannot make it work.
[13:37:24] PotatoChipz: Am i doing it wrong?
[15:55:55] PotatoChipz: Quit: Page closed

2016-07-07

[03:20:54] PotatoChipz: has joined #RubyOnRails
[03:34:35] PotatoChipz: Ping timeout: 258 seconds

2016-07-05

[04:21:02] PotatoChipz: has joined #RubyOnRails
[11:00:09] PotatoChipz: Quit: sleep is for the weak but...
[11:08:21] PotatoChipz: has joined #RubyOnRails
[11:31:05] PotatoChipz: Quit: sleep is for the weak but...

2016-07-04

[08:00:49] PotatoChipz: has joined #RubyOnRails
[08:01:16] PotatoChipz: Can anyone explain to me the concept of post_initialize in Sandi Metz examples :S
[11:03:48] PotatoChipz: Quit: sleep is for the weak but...
[11:10:09] PotatoChipz: has joined #RubyOnRails
[12:25:58] PotatoChipz: Quit: sleep is for the weak but...

2016-06-30

[04:50:47] PotatoChipz: has joined #RubyOnRails
[08:39:25] PotatoChipz: Quit: sleep is for the weak but...
[08:45:38] PotatoChipz: has joined #RubyOnRails
[13:14:37] PotatoChipz: Quit: adios amigos!

2016-06-29

[03:16:38] PotatoChipz: has joined #RubyOnRails
[03:30:08] PotatoChipz: has joined #RubyOnRails
[03:57:46] PotatoChipz: has joined #RubyOnRails
[04:10:22] PotatoChipz: Quit: sleep is for the weak but...
[04:16:29] PotatoChipz: has joined #RubyOnRails
[04:36:20] PotatoChipz: Quit: sleep is for the weak but...
[04:43:44] PotatoChipz: has joined #RubyOnRails
[07:40:23] PotatoChipz: Quit: sleep is for the weak but...
[07:41:03] PotatoChipz: has joined #RubyOnRails
[13:01:16] PotatoChipz: Quit: sleep is for the weak but...

2016-06-28

[03:58:51] PotatoChipz: has joined #RubyOnRails
[04:41:58] PotatoChipz: Quit: sleep is for the weak but...
[04:53:13] PotatoChipz: has joined #RubyOnRails
[05:20:53] PotatoChipz: if I use nested with_locks .... which lock releases the lock if something is encountered in the inner lock? Is it safe to have nested with_lock?
[07:21:43] PotatoChipz: Quit: sleep is for the weak but...
[07:30:03] PotatoChipz: has joined #RubyOnRails
[08:01:30] PotatoChipz: hello. Is it bad to use nested with_lock ?
[08:12:01] PotatoChipz: rvanlieshout well...it just so happen that an inner service locks the same instance. but i need to lock it outside as well.
[08:12:12] PotatoChipz: i'm just worried about the releasing of locks.
[08:12:30] PotatoChipz: if an error is encountered within the inner lock, will it release both locks?
[13:06:55] PotatoChipz: Quit: sleep is for the weak but...

2016-06-27

[10:50:33] PotatoChipz: has joined #RubyOnRails
[11:18:51] PotatoChipz: Quit: sleep is for the weak but...
[11:35:32] PotatoChipz: has joined #RubyOnRails
[11:37:23] PotatoChipz: Hello! If I'm calling an API for a payment gateway and I have to update balance of my database right after, should I use locking or transaction?
[11:37:57] PotatoChipz: I should wrap the whole 2 processes, I'm thinking. But I'm not sure which of the 2
[11:47:33] PotatoChipz: Ping timeout: 240 seconds
[13:22:57] PotatoChipz: has joined #RubyOnRails
[13:23:21] PotatoChipz: Does with_lock automatically reloads the instance locked?
[13:41:12] PotatoChipz: matthewd: interesting. 'cos I tried wrapping my codes using @instance.with_lock and i ran two servers to test it.... when both processes got the instance. they have the same values. When I actually puts inside the lock they have different values. The second instance already has the updated value from the first lock.
[13:42:02] PotatoChipz: so is it safe to assume that... while inside the @instance.with_lock do # Rails reloaded here??? end
[15:37:00] PotatoChipz: Quit: Page closed

2016-06-24

[01:33:02] PotatoChipz: has joined #RubyOnRails
[04:57:49] PotatoChipz: has joined #RubyOnRails
[05:18:19] PotatoChipz: has joined #RubyOnRails
[05:54:00] PotatoChipz: Quit: sleep is for the weak but...
[06:07:05] PotatoChipz: has joined #RubyOnRails
[12:18:18] PotatoChipz: Quit: potatochipz

2016-06-23

[04:19:40] PotatoChipz: has joined #RubyOnRails
[04:29:23] PotatoChipz: Quit: sleep is for the weak but...
[04:41:03] PotatoChipz: has joined #RubyOnRails
[07:53:52] PotatoChipz: Quit: sleep is for the weak but...
[07:55:39] PotatoChipz: has joined #RubyOnRails
[09:25:33] PotatoChipz: return 'foo' if array.include?('foo')
[09:25:34] PotatoChipz: -- is there a shortcut for this in Ruby?
[09:25:35] PotatoChipz: something like with Hash it has, array.fetch(:foo, nil)
[12:25:43] PotatoChipz: Quit: sleep is for the weak but...

2016-06-22

[02:18:59] PotatoChipz: has joined #RubyOnRails
[02:46:51] PotatoChipz: Quit: sleep is for the weak but...
[03:00:37] PotatoChipz: has joined #RubyOnRails
[03:16:29] PotatoChipz: Quit: sleep is for the weak but...
[03:55:37] PotatoChipz: has joined #RubyOnRails
[10:36:55] PotatoChipz: Quit: sleep is for the weak but...

2016-06-21

[04:55:31] PotatoChipz: has joined #RubyOnRails
[10:18:33] PotatoChipz: Quit: sleep is for the weak but...
[10:32:56] PotatoChipz: has joined #RubyOnRails
[13:16:44] PotatoChipz: Quit: sleep is for the weak but...

2016-06-20

[14:13:02] PotatoChipz: has joined #RubyOnRails
[15:35:14] PotatoChipz: what's the difference between a wrapper and an interface?
[15:37:22] PotatoChipz: Say, I have the twitter API, I laid out all the API calls…that I need and I’m calling it via a TwitterInterfaceHandler .. Am i calling in right? Or is this a wrapper? Are they the same?
[15:41:22] PotatoChipz: hmm.. thank you. so if in my example, the handler is an interface. can you give me an example of a wrapper with respect to my example?
[15:41:40] PotatoChipz: wait, it's the other way around.
[15:41:57] PotatoChipz: so if in my example, the handler is a wrapper. can you give me an example of an interface with respect to my example?
[15:42:14] PotatoChipz: i just can't wrap my head around it. no pun intended.
[15:48:17] PotatoChipz: hmm sounds just like a simple service object then?
[15:48:25] PotatoChipz: in Ruby are these just service objects?
[15:53:26] PotatoChipz: I see then. looks like it has something to do with ruby being dynamically typed or something. perhaps the reason why interfaces are more likely involved in Java..idk. maybe im saying nonsense here.
[15:53:31] PotatoChipz: anyway thank you for answering
[16:06:44] PotatoChipz: Ping timeout: 250 seconds

2016-06-17

[06:37:57] PotatoChipz: has joined #RubyOnRails
[06:47:58] PotatoChipz: Hi, so I'm designing a RESTful API for loyalty card.
[06:47:59] PotatoChipz: loyaltycards/<resource_id>/rewards
[06:48:00] PotatoChipz: Which is the RESTful and secured way? Is there a right / wrong answer for this?
[06:48:00] PotatoChipz: So, I'm confused if I should use the card # as resource id or the database table's PK.
[06:48:55] PotatoChipz: number_to_human(1536, :format => '%n%u', :units => { :thousand => 'K' })
[06:49:02] PotatoChipz: something like that.
[06:55:05] PotatoChipz: Binarymaster yeah thanks. I've been searching for security risks if I use 16-digit numbers... is this common?
[06:56:57] PotatoChipz: Alright then... thank you
[09:50:49] PotatoChipz: Quit: potatochipz

2016-06-16

[14:39:55] PotatoChipz: has joined #RubyOnRails
[16:31:11] PotatoChipz: Quit: Page closed

2016-06-15

[03:44:17] PotatoChipz: has joined #RubyOnRails
[03:45:42] PotatoChipz: I know there's a column_exists? method to check if a certain table column exists for that model but.. how do i make sure.. upon loeading my module that the field really exists?
[03:48:24] PotatoChipz: that the column actually exists.. but how do i make sure that upon loading my rails concern, the column exists? I mean, where do I put the checking?
[03:51:50] PotatoChipz: arathald http://pastebin.com/P3MiiE9q -- it's a re-usable module. i just want to make sure the the developer who will include it will make sure the column exists..
[03:52:37] PotatoChipz: oops sorry. arathald here's a pastie link http://pastie.org/private/yeo6jmi77m2xj4tca3ceg
[03:55:34] PotatoChipz: tjbiddle i read before that models (ideally) should just deal with associations, scopes, validations etc... so i think service objects will help DRY the models
[03:58:09] PotatoChipz: arathald aaah yes! I just want to check it once at load.. If i wanna do that, where should i do it?
[12:39:10] PotatoChipz: Quit: adios amigos!

2016-06-13

[10:17:02] PotatoChipz: has joined #RubyOnRails
[10:18:22] PotatoChipz: has joined #ruby
[12:05:35] PotatoChipz: has left #ruby: ()
[12:05:35] PotatoChipz: has left #RubyOnRails: ()

2015-09-11

[17:52:56] PotatoChipz: has joined #RubyOnRails
[17:53:51] PotatoChipz: Is it possible for me to use my custom validators (in app/validators ) in my API service?
[18:41:06] PotatoChipz: Quit: Page closed

2015-09-07

[13:21:11] PotatoChipz: has joined #RubyOnRails
[13:25:27] PotatoChipz: so I'm making custom validators...i wanted to pass some params from a method but I couldnt http://pastie.org/private/6z0ea5jzwwii3tseolya
[13:27:31] PotatoChipz: For some reason, it's giving me this: ActiveRecord::SubclassNotFound (The single-table inheritance mechanism failed to locate the subclass: ???SomeType::SubType'. This error is raised because the column 'type' is reserved for storing the class in case of inheritance. Please rename this column if you didn't intend it to be used for storing the inheritance class or overwrite ResponseType.inheritance_column to use another col
[13:27:44] PotatoChipz: I am calling the validator from an STI model
[13:28:31] PotatoChipz: it's a totally different thing, why is it giving me that. If i uncomment my validator it's back to norma...
[13:30:04] PotatoChipz: arup_r the method is just a string! :S like.. a 'please output me' saved in a method
[14:58:28] PotatoChipz: Ping timeout: 246 seconds

2015-08-30

[18:44:45] PotatoChipz: has joined #RubyOnRails

2015-08-15

[13:39:36] PotatoChipz: has joined #RubyOnRails
[13:40:29] PotatoChipz: Hello! I am reading about the Observer design pattern. I'm having a hard time understanding it. Can anyone guide me by citing an example where it would be beneficial?
[13:42:26] PotatoChipz: I meant Observable pattern. sorry
[13:46:24] PotatoChipz: do callbacks follow observable pattern?
[13:46:32] PotatoChipz: because that's what they do, right?
[13:46:49] PotatoChipz: elaptics -- thanks
[14:49:55] PotatoChipz: Ping timeout: 246 seconds

2015-07-28

[11:24:12] PotatoChipz: has joined #RubyOnRails
[11:25:04] PotatoChipz: I'm dealing with CSV. Does anyone know how to use orce_quotes: true ...in just 1 field of my csv?
[11:25:28] PotatoChipz: Or I just want to be able to print double quotes in export/print in csv
[11:25:40] PotatoChipz: *force_quotes
[11:29:26] PotatoChipz: OK. So how do you usually print double quoted string in CSV? I tried escaping to no avail.
[11:46:51] PotatoChipz: workmad3 "This is a ""quoted"" string in CSV" produces This is a quoted"" string in CSV in CSV
[11:47:15] PotatoChipz: I'm using CSV.generate
[11:59:41] PotatoChipz: Radar http://pastie.org/private/iligwlpdt0upvetyotyo6g
[12:01:04] PotatoChipz: Papierkorb if it's just ""this"" it's an error.
[12:01:09] PotatoChipz: I tried %Q as well
[12:26:28] PotatoChipz: Ping timeout: 246 seconds

2015-07-27

[10:01:13] PotatoChipz: has joined #RubyOnRails
[10:02:07] PotatoChipz: how do you print double quoted string?
[10:02:22] PotatoChipz: I want to print something like this>>>> ="0000001"
[10:03:13] PotatoChipz: print as in i'm gonna export it to an excel file...but I want to save it in a variable first
[10:03:27] PotatoChipz: "=""0000001""" ---- my example results to this.
[10:04:29] PotatoChipz: "=\"0000001\" produces "=""0000001"""
[10:08:15] PotatoChipz: universal -- if whatever is a variable?
[10:16:43] PotatoChipz: Ping timeout: 246 seconds

2015-07-25

[06:21:16] PotatoChipz: has joined #RubyOnRails
[06:21:49] PotatoChipz: Hello!!! Is it possible for associated model to be updated after destroying the other model?
[06:23:34] PotatoChipz: Say, ModelB has_one ModelA record.... ModelA record is deleted... I want ModelB's status field to be updated....
[06:24:02] PotatoChipz: In short, I don't want it to be destroyed...rather I just want it to update one of its field.
[06:25:01] PotatoChipz: I'm thinking....maybe I should use callbacks? But maybe there's another way.
[06:26:51] PotatoChipz: I'm deleting ModelA record through controller -- yup
[06:30:38] PotatoChipz: Welp. If I use after_destroy or before_destroy, and ModelA is not the only model that has ModelB... I should also do the checking there? Like if it modelB then update, otherwise do nothing...
[06:31:53] PotatoChipz: Hmmmm autosave true... perhaps I should explore that
[06:34:04] PotatoChipz: Wait I did not get it haha. If I destroy the parent model, what happens to the associated model if I set it to autosave=true ?
[06:37:58] PotatoChipz: busterarm "with whatever rails has its values set to"--can you tell me more about this?
[06:40:29] PotatoChipz: Ah well I'm trying a generic approach because several models are gonna do this. I don't want to do it all over my destroy action several times again
[06:45:56] PotatoChipz: busterarm you mean through a callback right? I believe this can happen through a callback
[06:47:57] PotatoChipz: Alright. Thanks!
[07:43:58] PotatoChipz: How can I get all the models that use a specific concern?
[08:09:10] PotatoChipz: Ping timeout: 246 seconds

2015-07-08

[10:49:48] PotatoChipz: has joined #RubyOnRails
[11:02:49] PotatoChipz: A product has man classifications. A classification has many attributes. A property has many options. Hence I can do this to get the properties: product.classifications.each_with_object([]) do |c, props| props << c.properties.pluck(:id).flatten end How can I get all the properties associated with all the classifications without having to use a loop? Like this: product.classifications.properties
[11:03:42] PotatoChipz: How can I get all the properties associated with all the classifications without having to use a loop? http://pastie.org/private/znwszjuf4cpw7x4iodmw
[12:05:14] PotatoChipz: Quit: Page closed

2015-06-24

[08:20:56] PotatoChipz: has joined #RubyOnRails
[08:21:54] PotatoChipz: hi! Can I iterate through an AR result set and remove items from it without my result becoming array?
[08:22:19] PotatoChipz: what I do now is... result_set.each_with_object, but of course it will be stored as an array
[08:54:47] PotatoChipz: Quit: Page closed

2015-06-19

[04:45:18] PotatoChipz: has joined #RubyOnRails
[04:48:39] PotatoChipz: Is it possible to use a model method or some service method inside find_each...and it will still return ActiveRecord type
[04:48:41] PotatoChipz: http://pastie.org/private/advarypxqfahwwfulow
[04:51:13] PotatoChipz: that code snippet is wrong but that's the idea hahah
[07:25:33] PotatoChipz: Quit: Page closed

2015-06-09

[09:10:37] PotatoChipz: has joined #RubyOnRails
[09:11:09] PotatoChipz: hi can someone help me figure out why im passing an argument but it becomes nil when it reaches the method
[09:11:11] PotatoChipz: http://pastie.org/private/bw34dwsoeaj9tiefagbya
[09:12:43] PotatoChipz: rvanlieshout I printed it in the console ...
[10:42:55] PotatoChipz: Quit: Page closed

2015-06-07

[07:05:27] PotatoChipz: has joined #RubyOnRails
[07:11:49] PotatoChipz: hello! I was trying to do the auto-vivify thin in hashes.... but I can't make it work... The first one in this pastie works but I want to make the 2nd one work.... http://pastie.org/private/qg3kd8vmdmzlouoo0wsqa
[07:11:59] PotatoChipz: *auto-vivify thing
[07:15:25] PotatoChipz: help? http://pastie.org/private/0zyuzjdfevgokd35bdcdw
[08:20:37] PotatoChipz: Ping timeout: 246 seconds

2015-05-26

[08:26:41] PotatoChipz: has joined #RubyOnRails
[08:27:36] PotatoChipz: Hello! Is it not good practice if I use "build" as method name in a service object that I'm creating?
[08:27:52] PotatoChipz: I mean, it's reserved for AR only, right?
[08:29:15] PotatoChipz: no conflicts with AR's .build?
[10:13:00] PotatoChipz: Quit: Page closed
[11:21:51] PotatoChipz: has joined #RubyOnRails
[11:23:19] PotatoChipz: Hello! how do you usually name your services directory folder? like, if i am using a service that is shared by 2-3 controllers... should i put it inside some kind of directory instead of it being in the application layer service
[11:48:40] PotatoChipz: Ping timeout: 246 seconds

2015-05-08

[08:45:50] PotatoChipz: Any help??? TL;DR: Calling the method 'children' queries the base class instead of the STI type class name. My codes, models and samples are all here: http://pastie.org/private/jvf9mnhohrwwxyzk60dfoa
[08:47:35] PotatoChipz: universal: yes but it's not the problem...it results to the same thing either way
[08:50:48] PotatoChipz: universal: I swear I did it again just now and it still results to the same thing. Still queries the base class. -- SELECT `links`.* FROM `links` WHERE `links`.`ancestor_id` = 94 AND `links`.`ancestor_type` = 'Product' AND `links`.`direct` = 1
[08:51:19] PotatoChipz: universal: I also restarted my DB, rails console etc...
[08:52:54] PotatoChipz: ohhhh my bad.
[08:53:00] PotatoChipz: OK will do that
[08:58:39] PotatoChipz: universal: Still the same result...
[09:02:45] PotatoChipz: rvanlieshout: What do you mean STI and polymorphic dont go well together? Like, I shouldnt use them both at the same time? (-_-)
[09:21:45] PotatoChipz: What happened when you retrieve children?
[09:25:56] PotatoChipz: I see you removed the descendant_class_names haha
[09:27:38] PotatoChipz: ahh! since we're using polymorphic..you should add child like this :: Link.create_edge Food.first, Ingredient.first
[09:28:01] PotatoChipz: At least, that's what's in the docs..
[09:31:27] PotatoChipz: OK give me a sec... Do you think it has something to do with this http://stackoverflow.com/questions/9628610/why-polymorphic-association-doesnt-work-for-sti-if-type-column-of-the-polymorph ?
[09:46:53] PotatoChipz: universal: do you have a lead on why it inserts correctly but the select query is wrong...
[09:47:13] PotatoChipz: I mean it sets the type correctly..obviously.

2015-05-07

[11:28:48] PotatoChipz: anyone here used acts-as-dag before? I'm desperate. Damn it. :P
[11:33:03] PotatoChipz: helpa: OK sorry give me a sec
[11:38:20] PotatoChipz: So I've been trying out acts-as-dag gem because I want not just a tree-like structure in my model. I want a hierarchy that each entry/node can have multiple parents and children. My prob is I have a base model Food-- Chinese, Thai, Italian just inherit from Food. Everything's cool. I have a links table where the gem stores the relationships. However, I'm using STI and whenever I call the method "children" it queries the ba
[11:46:22] PotatoChipz: ....However, I'm using STI and whenever I call the method "children" it queries the base class and not the "type" (STI class name)
[11:48:48] PotatoChipz: universal: I'm using STI
[11:52:39] PotatoChipz: universa1: Hmmm, I followed the acts-as-dags docs and to connect the links model and my model -- I used the acts_as_dag_links and has_dag_links (I'm sorry, is this what you're asking? :S )
[12:00:15] PotatoChipz: universal: What I have is something like this: http://pastie.org/private/iptwrrwxm4ybdiza6krnow --yes I followed the polymorphic true thingy :S
[12:02:57] PotatoChipz: universal: It says here https://github.com/resgraph/acts-as-dag#optional-parameters-1
[12:03:51] PotatoChipz: universal: what do you mean by STI derived class?
[12:10:50] PotatoChipz: universal: Sorry do you mean that if I dont specify the descendant and ancestor class names it's still ok?
[12:15:05] PotatoChipz: universal: Tried it. Yeah. Looks like I don't even need those at all. But still the problem is there... when I call @food.children, it queries--- SELECT `edges`.* FROM `edges` WHERE `edges`.`ancestor_id` = 94 AND `edges`.`ancestor_type` = 'Product' AND `edges`.`direct` = 1
[12:16:21] PotatoChipz: The one inserted in my database using create_edge ... the ancestor_type is 'Food'
[12:20:55] PotatoChipz: universal: http://pastie.org/private/lphxef57ndxdbet7qsx33w --- hopefully I explained it well here (sorry !!! )