My app doesnt use a database, it gets all it''s information from an api. I was wondering whether i should put the code for pulling the api data into an array in the controller or a model? This is a pretty simple app right now with only one controller, I may expand it later but I have no plans to do so right now. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Koalemos wrote:> My app doesnt use a database, it gets all it''s information from an > api. I was wondering whether i should put the code for pulling the api > data into an array in the controller or a model? > > This is a pretty simple app right now with only one controller, I may > expand it later but I have no plans to do so right now.I''m curious what others say. I''m going to be in the same boat in a few days. But it sounds like a model to me. The API to fetch the data is logically the same as the API to the database methods to fetch the data. Thats my thought anyway. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
In the model, All your data objects should be in the models, and the controller is simply a bridge between the models and the views, pooling out only the data the view needs, so you''d write methods for retrieving and creating data in your model and then call those functions in your controllers and parse those arrays etc into your views. Cam On Aug 2, 1:47 pm, Koalemos <swimming.b...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> My app doesnt use a database, it gets all it''s information from an > api. I was wondering whether i should put the code for pulling the api > data into an array in the controller or a model? > > This is a pretty simple app right now with only one controller, I may > expand it later but I have no plans to do so right now.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Definitely in a model. Here''s the Rails hint: ActiveResource::Base (edge/2.0) is similar to ActiveRecord::Base. On Aug 1, 11:47 pm, Koalemos <swimming.b...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> My app doesnt use a database, it gets all it''s information from an > api. I was wondering whether i should put the code for pulling the api > data into an array in the controller or a model? > > This is a pretty simple app right now with only one controller, I may > expand it later but I have no plans to do so right now.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---