aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTeddy Wing2017-06-15 11:32:18 +0200
committerTeddy Wing2017-06-15 11:32:18 +0200
commit133bb6b8471df2ec1057d061dc170712a94a9425 (patch)
tree6a3f2f3fd1a8a33216c49541c307bd0920b6d0b6 /lib
parentf9e02316991801782f2d3c4e23525c8d4cb6545c (diff)
downloadchouette-core-133bb6b8471df2ec1057d061dc170712a94a9425.tar.bz2
TableBuilder;Link: Remove default `:get` for HTTP method
Don't set links as `method: :get` by default. This shows up as: link_to _, _, method: :get If we set the method to `nil` instead, we don't get a `data-method="get"` attribute in our HTML output. Instead, we get no `data-method` attribute, which is a lot better and cleaner. I had originally used `:get` as a default because I wanted to generalise links and certain ones we create need `:delete` or `:put` methods. I figured, since we're always going to be passing `method:` to `link_to`, we should have a sane default for that option. However, using `nil` is even better as a default because then we don't get an extra attribute in our HTML at all. Refs #3479
Diffstat (limited to 'lib')
-rw-r--r--lib/link.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/link.rb b/lib/link.rb
index 911f189c9..c875b85ac 100644
--- a/lib/link.rb
+++ b/lib/link.rb
@@ -1,7 +1,7 @@
class Link
attr_reader :name, :href, :method, :data
- def initialize(name: nil, href:, method: :get, data: nil)
+ def initialize(name: nil, href:, method: nil, data: nil)
@name = name
@href = href
@method = method