Welcome to Working With Rails

 

Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
urgent: need help with listing multiple table entries
2 Posts
urgent: need help with listing multiple table entries

Hi Rails Beginner,

I'm not going to write your application for you, but I'd be more than happy to help with specific issues or even suggest a way that you might be able to best deal with a problem, as I'm sure many others in the community here would also be willing to do.

A couple suggestions to start with and a few of my own questions to follow:

Suggestion 1) when naming a table try and follow some of the conventions, while idlist is technically acceptable, id_list is preferable and a best practice.

Suggestion 2) I would highly recommend going through some basic Rails training either with the Agile Web Development with Ruby on Rails (one of several Ruby on Rails "bibles") or some of Lynda.com's Rails training courses. It sounds to me by your question that you may not fully be in tune with how Rails models relate to each other and how to make use of them throughout the application.

So, now for my questions in hopes to help you with your specific problem. What are you hoping to achieve with the id_list table? It honestly sounds rather redundant since you already have a list of the user id's in the users table. Please clarify what you need with that and we might be able to help you further.

Good luck!

hi, i am a rails beginner. i use aptana rad rails as the ide, and use rails 1.2.6.

i have two tables idlist and users idlist - id (automatically created by rails), user_id users - id (automatically created by rails), name, location

idlist has one and belongs to user and user has one and belongs to idlist.

when a user is created in the users table, the idlist table should automatically be added with a record where the user_id field will be the id of the users table.

how do i do this?

now, in the users view pages, i want the info of the users table and the corresponding user_id from the idlist table. how do i do this? please help me with this. very urgent.

thanks in advance.

2 Posts
Login to add your message