Home>
The problem I want to solve
[email protected] cms_site.pages.root.children.published.each do | seminar |
li
= link_to seminar.url (relative: true), {class:'seminars-card'}
.seminars-card-image
// Followed by the code below
The part of this code that is cms_fragment_content (: redirect_url, seminar)
If there is cms_fragment_content (: redirect_url, seminar)
As cms_fragment_content (: redirect_url, seminar) otherwise
seminar.url (relative: true)
I want to
The contents of the li tag
--if cms_fragment_content (: redirect_url, seminar) .present?
= link_to cms_fragment_content (: redirect_url, seminar), {class:'seminars-card'}
--other
= link_to seminar.url (relative: true), {class:'seminars-card'}
.seminars-card-image
// Followed by the code below
I tried it, but with this, the content under .seminars-card-image is
If cms_fragment_content (: redirect_url, seminar) .present? Is not called, it will not work as expected.
If anyone knows the solution, could you please tell me?
-
Answer # 1
Related articles
- ruby on rails - you cannot change the keychain after downloading the pem file when creating an ec2 instance the matter that come
- ruby on rails 5 - i want to change the location of views in rails 5
- ruby on rails - i want to change only a part of the partial template
- ruby on rails - about the argument of rubyonrails params
- ruby on rails 6 - i want to change the display of the product detail page according to the user's conditions
- ruby on rails - i want to change from the state where only one posted image is displayed to the state where two posted images ar
- ruby on rails 5 - transaction exception handling doesn't work
- ruby on rails - rails tutorial chapter 13 cooperation between heroku and aws s3 region
- ruby on rails - i want to solve the problem that "we're sorry, but something went wrong" is displayed in the productio
- ruby on rails - i want to launch rails with a new file
- ruby - [rails 5] i want to send an email to a specific user using action mailer
- ruby - the last db setting doesn't work when deploying rails app on aws
- about validation of ruby on rails
- ruby on rails - i get an error in a program that changes over time
- ruby on rails - i want to solve the problem that scss is not applied after modifying the scss file with rails
- ruby on rails - about the legitimacy of db design
- [sqlite, ruby, rails] i want to sort the hash value data obtained from the table as i expected
- ruby on rails - not created
- ruby - [rails] how to resolve activerecord errors
Related questions
- ruby - passing variables using render partial
- ruby - deployment error on heroku
- ruby - output the total integer value held by each user
- ruby - i want to use the search method for active hash data
- ruby - destroy action does not respond
- ruby - how do you see the rails controller relative path? (carrierwave directory deleted)
- ruby - when deploying on capistrano, i get the error "access denied for user'ec2-user' @'localhost' (using password: no)&qu
- javascript - run multiple times with js + each do
- how to reflect the layout downloaded from the external site in ruby on rails?
- ruby - how nice! function routes do not pass well (relation) [rails]
If it exists, that's it, and if it doesn't, it's different, so I think it's a good idea to use presence to put it together.
However, if you put it as it is, it will be difficult to understand as above, so it is better to put it in the variable once.