You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a Child class of Virtus::Attribute called SortedComponents
Which looks like this:
class SortedComponents < Virtus::Attribute
def coerce(components)
components = (components).sort! { |a, b| a["description"] <=> b["description"] }
components = nest_components(components)
end
def self.nest_components(components)
components.delete_if do |c|
/[0-9]+[A-Z]+/ =~ c["description"] ? true : false
end
end
end
However, I'm not able to call "nest_components" in "coerce" and get the error:
app/models/SortedComponents.rb:4:in `coerce': undefined method `nest_components' for #<SortedComponents:0x007fcd132ea300> (NoMethodError)
How can I call methods from coerce in my Virtus::Attribute because not being able to break up some of the steps in coerce into seperate methods will make coerce huge?
The text was updated successfully, but these errors were encountered:
I have a Child class of
Virtus::Attribute
calledSortedComponents
Which looks like this:
However, I'm not able to call "nest_components" in "coerce" and get the error:
How can I call methods from coerce in my Virtus::Attribute because not being able to break up some of the steps in coerce into seperate methods will make coerce huge?
The text was updated successfully, but these errors were encountered: