Hello, recently I ran into Ruby Structs<http://www.ruby-doc.org/core-1.9.3/Struct.html>. Some examples:
# Create a structure with a name in StructStruct.new("Customer", :name, :address) #=> Struct::CustomerStruct::Customer.new("Dave", "123 Main") #=> #<struct Struct::Customer name="Dave", address="123 Main"> # Create a structure named by its constantCustomer = Struct.new(:name, :address) #=> CustomerCustomer.new("Dave", "123 Main") #=> #<struct Customer name="Dave", address="123 Main"> Automatic key -> symbol, key -> string, key -> method accessing: Customer = Struct.new(:name, :address, :zip)joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345) joe["name"] = "Luke"joe[:zip] = "90210" joe.name #=> "Luke"joe.zip #=> "90210" It seems to me it fits Model representation perfectly, so I wonder if a Model could have advantages being represented by a Struct class (performance, coherence...). -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/4KvuuN8HbnMJ. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.