Tuesday, June 5, 2012

Re: [Rails] Beginner's:Problem with populating database

On 5 June 2012 01:02, cyber c. <lists@ruby-forum.com> wrote:
> Hi,
>
> I wanted to populate the DB with (name,data) pairs based on some rules.
> I have created a scaffold with name and data as attributes. In the
> controller file under the def for index, i have changed the line
> @data_pairs = DataPair.all to
> @data_pairs = DataPair.get_all_pairs
>
> and in the corresponding models file i have defined this function
>
> def self.get_all_pairs
> //LOGIC
> end
>
> i get an error undefined method 'name' for ".":String
> in line -> <td><%=data_pair.name %></td>
>
> Im a beginner in ROR. Can someone help me out ?

Have a look at the Rails Guide on Debugging for techniques you can use
to debug your code. Also you say that you are a beginner. If you
have not already done so then work right through some tutorials on
Rails. railstutorial.org is good and is free to use online.

Colin

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate