Current page or route that has a specific content using include method in RAILS 3.2 -


hi can't seem make work in view,

if current_page?(question_path).include?("question 1") 

i have condition display particular html element if current page detects text "question 1"

what best way satisfy it?

because, if use specific route specific id it's not dynamic.

if current_page?(question_path(1)) 

the id: 1 can changed if has been deleted right?

snippet (what have right now):

.reference_display   .reference_container     - if current_page?(question_path).include?("question 1")       .reference_lip_ref         .lip_arrow{:title => "click expand"} ◀         .close_btn{:title => "close"}         .lip.close_btn{:title => "close"}         .slide           .preloader           %ul{"data-orbit" => "", "data-options" => "timer_container_class: hide; timer_paused_class: hide; timer_progress_class: hide; timer_speed:240000;"}             - @question.references.order("my_order").each |r|               %li                 %img.referenceimage{:alt => "reference data", :src => "#{r.image_url}", :style => "border: 1px solid #ccc;"}/     - elsif @questions.last       .reference_lip         .lip_arrow{:title => "click expand"} ◀         .close_btn{:title => "close"}         .lip.close_btn{:title => "close"}         .slide           .preloader           %ul{"data-orbit" => "", "data-options" => "timer_container_class: hide; timer_paused_class: hide; timer_progress_class: hide; timer_speed:240000;"}             - @question.references.order("my_order").each |r|               %li                 %img.referenceimage{:alt => "reference data", :src => "#{r.image_url}", :style => "border: 1px solid #ccc;"}/ 

you try this:

- if request.path.include?('suggestion')   = code 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -