Page 1 of 2 | Next »
[11:56:27] PotatoChipz: Hi guys, what do you usually use for a polymorphic hierarchy model? Is acts_as_dag gem any good?
[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
[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.
[08:01:16] PotatoChipz: Can anyone explain to me the concept of post_initialize in Sandi Metz examples :S
[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?
[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:30] PotatoChipz: if an error is encountered within the inner lock, will it release both locks?
[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
[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: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: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: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.
[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:55:05] PotatoChipz: Binarymaster yeah thanks. I've been searching for security risks if I use 16-digit numbers... is this common?
[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?
[17:53:51] PotatoChipz: Is it possible for me to use my custom validators (in app/validators ) in my API service?
[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: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
[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?
[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: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
[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
[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: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: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
[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
[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
[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
[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
[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
[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?
[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
[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
[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:27:38] PotatoChipz: ahh! since we're using polymorphic..you should add child like this :: Link.create_edge Food.first, Ingredient.first
[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...
[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: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: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'