Undefined method

hi,

I am trying to make use of a method located in my model (see below)
directly at my view but I am getting undefined method. how can solve
this ?

app/model/operation.rb

def all_products_have_same_posters_count?

  • products.all? { |p| p.posters.count == products.first.posters.count
    }*
  • end*

_show.html.haml
-if @operations.all_products_have_same_posters_count?

  •  ="foobar"*
    

any recommendations ?
thanks.

On 2 April 2015 at 16:50, Rails_beginner [email protected] wrote:

_show.html.haml
-if @operations.all_products_have_same_posters_count?
=“foobar”

any recommendations ?

Is @operations possibly an array of operations rather than an operation?
If you think it is just one post the line of code that sets it up.

Otherwise please post the complete error message here.

Colin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs