Hi, I''m new to ruby on rails and I have little problem. I need to make application that creates list of items on startup. So model shouldnt have database. 1. Is the best choice to use standard class as model, for example item.rb in models folder? 2. What''s the best way to create collection of model on controller startup? Is it creating array of model classes in initialize() method of controller? 3. My app should have search functionality based on items name. Is the best way to simply search array in for loop and return searched items? Is there any better and simplier approach than this I described? Thanks in advance -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Thu, Jun 21, 2012 at 4:25 PM, Amer Zildzic <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi, > > I''m new to ruby on rails and I have little problem. I need to make > application that creates list of items on startup. So model shouldnt > have database. > > 1. Is the best choice to use standard class as model, for example > item.rb in models folder? > > 2. What''s the best way to create collection of model on controller > startup? > Is it creating array of model classes in initialize() method of > controller? > > 3. My app should have search functionality based on items name. Is the > best way to simply search array in for loop and return searched items? > > Is there any better and simplier approach than this I described? > > Thanks in advance > >Hi, maybe this could help you http://railscasts.com/episodes/326-activeattr http://railscasts.com/episodes/193-tableless-model Best, Martin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Thu, 21 Jun 2012 16:54:46 -0300 Martin Aceto <martin.aceto-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I''m new to ruby on rails and I have little problem. I need to make > > application that creates list of items on startup. So model shouldnt > > have database. > > maybe this could help you > > http://railscasts.com/episodes/326-activeattr > http://railscasts.com/episodes/193-tableless-modelThe table-less model railscast is kinda outdated and can lead into something wrong I think :)) It''s better to watch this one: http://railscasts.com/episodes/219-active-model Or read Yehuda''s introduction: http://yehudakatz.com/2010/01/10/activemodel-make-any-ruby-object-feel-like-activerecord/ -- Sincerely yours, Aleksey V. Zapparov A.K.A. ixti FSF Member #7118 Mobile Phone: +34 677 990 688 Homepage: http://www.ixti.net JID: zapparov-962d5TIgE1qHXe+LvDLADg@public.gmane.org *Origin: Happy Hacking!
Thanks for the answers. Can you tell me hwt''s the best way to make collection of this model classes on app startup - is it initialize method of controller and what''s the best way to search that collection - make serch action in controller ? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.