If you want to set up a one-to-one relationship between two models, you'll need to add belongs_to to one, and has_one to the other. How do you know which is which?
Answer / Nikul Singh
In a one-to-one relationship, `belongs_to` is used on the dependent model (the one that 'belongs to' another model). Conversely, `has_one` is used on the parent model (the one that 'has one' dependent model).
| Is This Answer Correct ? | 0 Yes | 0 No |
what are some advantages of using ruby on rails?
Is it possible to build a 50% bespoke e-commerce platform hence having the ability to customize everything down the line? For example would it make sense to start coding an application on the Ruby on Rails framework but where the most complex/time consuming code pieces (e.g. shopping cart, etc) can be initially bolted on (hence diminishing development time and cost) having the ability to change them completely further down the line?
Mention the log that has to be seen to report errors in Ruby Rails?
What are gemsets in rails?
Tell me what is mixin in rails?
Explain about restful architecture?
What is the use of super in Ruby Rails?
Write the command to update rvm in rails.
What is the rail console?
Explain dry in rails?
Do you know the role of garbage collection in ruby on rails?
What is the difference between symbol and string?