0

Sorry for the badly worded title, I currently have this if statement:

- if request.fullpath == "/" || "/info"

Which works fine, but the other one, that should do the opposite, ignores the second address.

- if request.fullpath != "/" || "/info"

It acts as if it just says:

- if request.fullpath != "/"
Carla Dessi
  • 9,086
  • 9
  • 39
  • 53

4 Answers4

1

Or with Rails String in? method :

- unless request.fullpath.in?("/", "/info")

or

- if !request.fullpath.in?("/", "/info")
Anthony Alberto
  • 10,325
  • 3
  • 34
  • 38
0

Try this:

- if request.fullpath != "/" || request.fullpath != "/info"

the part on the right is evaluated independantly of the equality test on the left

0

Wait a minute, you are using ruby:

- if %w(/ /info).include? request.fullpath
#and opposite
- unless %w(/ /info).include? request.fullpath

Check if a value exists in an array in Ruby

Community
  • 1
  • 1
Mik
  • 4,117
  • 1
  • 25
  • 32
0

try

unless request.fullpath != "/" && "/info"
Aayush Khandelwal
  • 1,071
  • 7
  • 11