Runtime assertions for Ruby literal.fun
ruby
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

Make Rails EnumType handle serializing pre-serialized values (#256)

Co-authored-by: Stephen Margheim <stephen.margheim@gmail.com>

authored by

Joel Drapper
Stephen Margheim
and committed by
GitHub
c7f8fbe8 475cec28

+7 -3
+7 -3
lib/literal/rails/enum_type.rb
··· 22 22 when @enum 23 23 value.value 24 24 else 25 - raise Literal::ArgumentError.new( 26 - "Invalid value: #{value.inspect}. Expected an #{@enum.inspect}.", 27 - ) 25 + if @enum[value] 26 + value 27 + else 28 + raise Literal::ArgumentError.new( 29 + "Invalid value: #{value.inspect}. Expected an #{@enum.inspect}.", 30 + ) 31 + end 28 32 end 29 33 end 30 34