Method: Spree::Variant#option_value

Defined in:
app/models/spree/variant.rb

#option_value(opt_name) ⇒ String

Fetches the option value for the given option name.

Parameters:

  • opt_name (String)

    the name of the option whose value you want

Returns:

  • (String)

    the option value



283
284
285
# File 'app/models/spree/variant.rb', line 283

def option_value(opt_name)
  option_values.detect { |o| o.option_type.name == opt_name }.try(:presentation)
end