Ruby on Rails Tuesday, February 24, 2015

Please quote the previous message so that it is easier to follow the
thread. Anyone reading your message will have no idea what you are
talking about.

On 24 February 2015 at 12:55, Sai Ch <lists@ruby-forum.com> wrote:
> In golf course game, some user create some course, after then he may
> want to give course credentials to other users. for that purpose i will
> take user_ids in array format.

You have course belongs_to user, that means it belongs to only one
user. You cannot have an array of users that it belongs to. If you
want a course to be associated with multiple users you need
has_and_belongs_to or has_many :through. Have a look at the Rails
Guide on ActiveRecord Associations for more information.

If you have not already done so then I advise working right through a
good tutorial such as railstutorial.org (which is free to use online).
That will show you the basics of rails.

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvQeMiMBtQiumZj8%2Bx_O6aaTN2Y6mWc6iL0FLLZHS0zAQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment