Last active
June 11, 2019 11:33
-
-
Save sinsoku/f18ab57d04b8bacc31265d57050979d6 to your computer and use it in GitHub Desktop.
This file contains 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
<% A.foo(@user) do |f| %> | |
<%= f.label :name %> | |
<%= f.text_field :name %> | |
<% end %> |
This file contains 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
module A | |
def self.foo(obj, options = {}, &block) | |
# もっと簡単な方法は無いものか... | |
options[:url] ||= Rails.application.routes.url_helpers.polymorphic_path(obj, format: :json) | |
options[:builder] ||= CustomBuilder | |
# これも良いのか微妙 | |
ApplicationController.helpers.form_for(obj, options, &block) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment