D
D
Damir Nurgaliev2014-12-04 13:14:31
Ruby on Rails
Damir Nurgaliev, 2014-12-04 13:14:31

Relationship of RoR models?

There are two models ( User and Calendar ). It is necessary to make a connection so that each user has his own calendar with his own (created) events. to be url /user/id1/edit_calendar for example) Thanks in advance

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Renat Ibragimov, 2014-12-04
@damirik

User
has_many :calendars
Calendar
belongs_to :user
is in the models
and the second one already said just nested-resources in the routing to prescribe

V
Viktor Vsk, 2014-12-04
@viktorvsk

guides.rubyonrails.org/association_basics.html#the...
guides.rubyonrails.org/routing.html#nested-resources

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question