From: comopasta Gr Date: 2012-11-28T18:21:32+09:00 Subject: Using model methods without an object for that model Hi, I'm implementing an API to create records for one type of object in batches. I have model called kpivalues but the standard rest rules mostly deal with acting on single records. So I've created an api where using kpivalues with post, update or delete will execute create, update or delete on a group of records defined in json as part of the body request. I know that is no restful, I checked around and that was pointed as a valid approach. I'm not obsessed with rest and anyway that is not the doubt I have, though might be related. In my controller api I receive the json and can iterate through the set of entries in the json and create, update or delete for each kpivalue. There is some checks to do before proceeding with the real action on the object and it is all in the controller which makes is a bit too crowded. I know I should move that to the model, but those actions I do are auxiliary tasks like checking if the json parsing fails, or checking if some element in the json for an entry is valid to proceed, and so on. Where would that code belong? Should I anyway move it to the model and use it like Kpivalue::parseEntries for example? Should I use a module and use it from the controller (I'm not sure what difference would that make, I guess more testability but in the end it would be included in the controller anyway)? Any good hints? Thanks. -- Posted via http://www.ruby-forum.com/.