Explain the difference between a has_one and belongs_to association in Ruby on Rails.
A product has_one provider, a customer has_one order.
복습용 저장
복습용 저장
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
WithoutBook은 주제별 면접 질문, 온라인 연습 테스트, 튜토리얼, 비교 가이드를 하나의 반응형 학습 공간으로 제공합니다.
Know the top Ruby On Rails interview questions and answers for freshers and experienced candidates to prepare for job interviews.
Know the top Ruby On Rails interview questions and answers for freshers and experienced candidates to prepare for job interviews.
Search a question to view the answer.
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Public, protected, and private.
Public methods can be called by all objects and subclasses of the class in which they are defined in.
Protected methods are only accessible to objects within the same class.
Private methods are only accessible within the same instance.
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
The ! indicates that the method is about to change the object itself.
Here’s an example:
foo = "A TEST STRING" # a string called foo foo.downcase! # modifies foo permanently a test string puts foo # prints modified foo a test string
Similarly if you did not want the object to be changed you could have something simple like:
foo2 = "A 2nd Test String" # a string called foo foo2.downcase # modifies foo temporarily a 2nd test string puts foo2 nbsp; # prints original foo A 2nd Test String
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.