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 .
Sunny B. 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?
Daniel W. wrote:
Sunny B. 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.
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
IMPLEMENTATION :
“BEFORE”
@album.album_photos.photos
“AFTER”
@album.photos
Sincerely,
Reinhart
http://teapoci.blogspot.com