I’m using Rails 4.2. It is not an option to upgrade at this time. I have this model
class OrderItem < ApplicationRecord
…
enum type: { data: “Data”, product: “Product” }
How do I initialize my object by referencing my enum? I tried this
@order_item = OrderItem.new(
order_item_params.merge(
type: :product
)
)
…
@order_item.save
But this results in the error
NoMethodError:
undefined method `safe_constantize' for :product:Symbol