如何结合两个条件

时间:2017-03-02 09:13:36

标签: ruby-on-rails ruby

我有两个条件:

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="app" ng-controller="ctrl">
  <button ng-disabled="firstBtn"   > one</button>
  <button ng-disabled="secondBtn" ng-click="firstBtn = false"> two</button>
</div>

我正在尝试将它们都应用。我试过了:

x = Equipment.last.try(:category_id) # => 1
y = WantedEquipment.pluck(:category_id) # => [1, 1, 1, 1, 1] 
y.include? x # => true

Equipment.last.try(:sub_category_id) # => 2 
b = WantedEquipment.pluck(:sub_category_id) # => [3, 3, 2, 2, 2] 
b.include? a # => true

有人可以告诉我这样做的正确方法是什么?

1 个答案:

答案 0 :(得分:7)

os.system("gnome-terminal --tab --working-directory=/repo/ -e 'tcsh -c \"source myfile.csh\"'")

将使解释器混淆何时执行y.include? x && b.include? a 和方法调用。相反,只需自己放置括号:

&&