Both are used in a view, and duplicate content is summarized.
I understand this, but I don't understand how to use it and when.
As a result of the investigation,
Helper → Library called from template
Was mentioned, but the meaning was not clear.
It's a very elementary content, but can you tell me?
Answer # 1
Think of partial as a subroutine in html.erb.
If you write a similar description many times or it is too long and the whole view becomes difficult to understand, it is used when you make it a partial with a name that understands "what to view" and go out ..
helper can make something like returning html,
Write a method that returns a value when you need to perform a complicated calculation to obtain the value to be displayed in the view.
Please note that it is better to write in model if you can write it as method of model.
- ruby on rails 5 - i don't understand the difference between model and controller methods
- ruby on rails - i don't understand template is missing
- i don't really understand the difference between php's "print" and "echo"
- ruby - [rails] i want to find the date difference using the model created_at
- ruby on rails - i don't understand the content of the error
- ruby - i want to distinguish between rails 0 and nil
- ruby on rails - mechanism of cooperation between web services and smartphone apps
- ruby on rails - the link between the model created by devise and the model originally created does not work
- ruby on rails 5 - ruby: i don't understand the meaning of the two inequality signs
- ruby on rails - i want to be able to understand the group administrator
- ruby on rails - i don't understand the description of the form object pattern
- rspec - i don't understand the difference between let and let! behavior (an error occurs in requestspec)
- ruby on rails 6 - when i press new user registration, i get an error of no route matches [get] "/ users"
- ruby on rails - i get an error without being created
- ruby on rails - rails60 i can't log in
- ruby on rails - [rails] the initial image of the icon for the user is not displayed
- ruby - partial template is not displayed (rails)
- ruby - i can't transition to my page for each user after logging out (rails)
- python - you may need to restart the kernel to use updated packages error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- dart - flutter: the instance member'stars' can't be accessed in an initializer error
- sh - 'apt-get' is not recognized as an internal or external command, operable program or batch file
- i want to call a child component method from a parent in vuejs
- python 3x - typeerror: 'method' object is not subscriptable