ruby on rails - Method definition gets 'syntax error, unexpected '=', expecting keyword_then or ';' or '\n' -


i trying define method in model , on last elsif line syntax error stating "/app/models/purchase.rb:23: syntax error, unexpected '=', expecting ')' elsif (self.invoices.sum(:current_balance) = 0 ^ ".

  def payment_status     if self.invoices.blank?       self.payment_status = "no invoices"     else       if self.invoices.sum(:current_balance) > 0         self.payment_status = "open"       elsif self.invoices.sum(:current_balance) < 0         self.payment_status = "overpaid"       elsif self.invoices.sum(:current_balance) = 0         self.payment_status = "paid"       end     end   end 

i mean use equals sign there, i'm lost problem is. ideas?

  elsif self.invoices.sum(:current_balance) = 0                                             ^--- 

that's assignment operation. want equality test, ==.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -