-
-
Save flakd/5915812 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <%= form_for OpenStruct.new(:message => ''), :url => ... do |f| %> | |
| <%= f.text_field :message %> | |
| <% end %> | |
| # config/initializers/open_struct_extensions.rb | |
| class OpenStruct | |
| def respond_to?(symbol, include_private = false) | |
| true | |
| end | |
| end | |
| # Create object through OpenStruct | |
| require "ostruct" | |
| App = OpenStruct.new({ | |
| :name => "Amitesh", | |
| :friend => OpenStruct.new({ | |
| :name => "dexter" | |
| }) | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment