Dear folks, I want to know whether the following things are right or wrong, in the first place. Then to know the right way to do the same, if it is wrong. I am having a table with the name "cd_details". using models, I am accessing data from this. my model is having the code like this. model filename : cd_detail.rb -------- class CdDetail < ActiveRecord::Base def self.find_data find ( :all, :select => "id,cd_label" ) end end --------- I am using the able model in a controller like the following ---------- def bootable @cd_details= Cd_detail.find_data end ---------- If I run this code, it is saying the following error; ---------- uninitialized constant cd_detail. ---------- I want any one of you to correct this. Please tell me what is the problem. Thanks in advance. -- with regds, Nahalingam N. Kanakavel. (http://www.nahalingam.bravehost.com/PlanetN/) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060722/5fea4b03/attachment.html
Change @cd_details= Cd_detail.find_data to @cd_details= CdDetail.find_data On 7/21/06, Nahalingam N. Kanakavel <nahalingam@gmail.com> wrote:> Dear folks, > > I want to know whether the following things are right or wrong, in the first > place. > Then to know the right way to do the same, if it is wrong. > > I am having a table with the name "cd_details". > using models, I am accessing data from this. > my model is having the code like this. > > model filename : cd_detail.rb > -------- > class CdDetail < ActiveRecord::Base > def self.find_data > find ( :all, > :select => "id,cd_label" > ) > end > end > --------- > I am using the able model in a controller like the following > ---------- > def bootable > @cd_details= Cd_detail.find_data > end > ---------- > > If I run this code, it is saying the following error; > ---------- > uninitialized constant cd_detail. > ---------- > > I want any one of you to correct this. > Please tell me what is the problem. > > Thanks in advance. > > -- > with regds, > Nahalingam N. Kanakavel. > (http://www.nahalingam.bravehost.com/PlanetN/) > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
Hi, I have some more doubts, Can we fetch data from tables, whihc is not having ID field. On 7/22/06, Peter Michaux <petermichaux@gmail.com> wrote:> > Change > > @cd_details= Cd_detail.find_data > > to > > @cd_details= CdDetail.find_data > > > > On 7/21/06, Nahalingam N. Kanakavel <nahalingam@gmail.com> wrote: > > Dear folks, > > > > I want to know whether the following things are right or wrong, in the > first > > place. > > Then to know the right way to do the same, if it is wrong. > > > > I am having a table with the name "cd_details". > > using models, I am accessing data from this. > > my model is having the code like this. > > > > model filename : cd_detail.rb > > -------- > > class CdDetail < ActiveRecord::Base > > def self.find_data > > find ( :all, > > :select => "id,cd_label" > > ) > > end > > end > > --------- > > I am using the able model in a controller like the following > > ---------- > > def bootable > > @cd_details= Cd_detail.find_data > > end > > ---------- > > > > If I run this code, it is saying the following error; > > ---------- > > uninitialized constant cd_detail. > > ---------- > > > > I want any one of you to correct this. > > Please tell me what is the problem. > > > > Thanks in advance. > > > > -- > > with regds, > > Nahalingam N. Kanakavel. > > (http://www.nahalingam.bravehost.com/PlanetN/) > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- with regds, Nahalingam N. Kanakavel. (http://www.nahalingam.bravehost.com/PlanetN/) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060722/8252f9bd/attachment.html
Hi, Thanks, this is working. @cd_details= CdDetail.find_data On 7/22/06, Nahalingam N. Kanakavel <nahalingam@gmail.com> wrote:> > Hi, > > I have some more doubts, > > Can we fetch data from tables, whihc is not having ID field. > > > On 7/22/06, Peter Michaux <petermichaux@gmail.com > wrote: > > > > Change > > > > @cd_details= Cd_detail.find_data > > > > to > > > > @cd_details= CdDetail.find_data > > > > > > > > On 7/21/06, Nahalingam N. Kanakavel <nahalingam@gmail.com> wrote: > > > Dear folks, > > > > > > I want to know whether the following things are right or wrong, in the > > first > > > place. > > > Then to know the right way to do the same, if it is wrong. > > > > > > I am having a table with the name "cd_details". > > > using models, I am accessing data from this. > > > my model is having the code like this. > > > > > > model filename : cd_detail.rb > > > -------- > > > class CdDetail < ActiveRecord::Base > > > def self.find_data > > > find ( :all, > > > :select => "id,cd_label" > > > ) > > > end > > > end > > > --------- > > > I am using the able model in a controller like the following > > > ---------- > > > def bootable > > > @cd_details= Cd_detail.find_data > > > end > > > ---------- > > > > > > If I run this code, it is saying the following error; > > > ---------- > > > uninitialized constant cd_detail. > > > ---------- > > > > > > I want any one of you to correct this. > > > Please tell me what is the problem. > > > > > > Thanks in advance. > > > > > > -- > > > with regds, > > > Nahalingam N. Kanakavel. > > > (http://www.nahalingam.bravehost.com/PlanetN/) > > > _______________________________________________ > > > Rails mailing list > > > Rails@lists.rubyonrails.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > -- > > with regds, > Nahalingam N. Kanakavel. > (http://www.nahalingam.bravehost.com/PlanetN/) >-- with regds, Nahalingam N. Kanakavel. (http://www.nahalingam.bravehost.com/PlanetN/) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060722/c8e668d7/attachment.html