hi,actually i am doing a one web related project, i want know that in project fetching data using model ya using query which is efficient? and how i am always confuse about model so hoe use model in application efficiently . -- 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 -~----------~----~----~----~------~----~------~--~---
Sunny Bogawat wrote:> hi,actually i am doing a one web related project, i want know that in > project fetching data using model ya using query which is efficient? and > how > i am always confuse about model so hoe use model in application > efficiently .It''s rough, but I think you''re asking how to use a Rails'' model efficiently. Is that correct? Do you have an example of a model you''ve created we can look at? -- 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 -~----------~----~----~----~------~----~------~--~---
Daniel Waite wrote:> Sunny Bogawat wrote: >> hi,actually i am doing a one web related project, i want know that in >> project fetching data using model ya using query which is efficient? and >> how >> i am always confuse about model so hoe use model in application >> efficiently . > > It''s rough, but I think you''re asking how to use a Rails'' model > efficiently. Is that correct? > > Do you have an example of a model you''ve created we can look at?ya , its correct for example i am fetching photo object using model like @album.album_photos.photos so internally it query on three table but i can directly fetch photos on query on photo table? so which is efficient? if data cm from model it cached or not? explain brief. -- 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 -~----------~----~----~----~------~----~------~--~---
Maybe you can use rails relational mapping. example : .................................... class Album < ActiveRecord has_many :album_photos, :dependent => true has_many :photos, :through => :album_photos .................................... class Photo < ActiveRecord has_many :album_photos, :dependent => true has_many :albums, :through => :album_photos .................................... class AlbumPhoto < ActiveRecord belongs_to :album belongs_to :photo .................................... I hope this Trough Association matter can help your problem. Sincerely, Reinhart http://teapoci.blogspot.com -- 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 -~----------~----~----~----~------~----~------~--~---
IMPLEMENTATION : ----------------- "BEFORE">@album.album_photos.photos"AFTER" @album.photos Sincerely, Reinhart http://teapoci.blogspot.com -- 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 -~----------~----~----~----~------~----~------~--~---