vmg / rinku

Autolinking. Ruby. Yes, that's pretty much it.
ISC License
597 stars 67 forks source link

target parameter #22

Closed meandkareem closed 7 years ago

meandkareem commented 12 years ago

undefined method `each_pair' for "target='_blank'":String

on rails 3.2.5

ckreutz commented 12 years ago

Same here. Rails 3.2.2, Rinku 1.7.

jroes commented 12 years ago

Looks like tag_options changed in Rails 3.2 to always expect a hash. The following should work:

auto_link('hello www.google.com', :all, :target => '_blank')

Not sure if we should update the docs to refer to the new syntax.

ckreutz commented 12 years ago

Great. Works like charm. Thanks a lot.

somazx commented 8 years ago

Yes please to updating the documentation.

AdamDenoon commented 8 years ago

Again, please update the documentation

kivikakk commented 7 years ago

The docs refer to the base Rinku usage, which has not changed:

>> gem 'rinku', '2.0.1'
=> true
>> require 'rinku'
=> true
>> Rinku.auto_link('http://www.pokemon.com', :all, 'target="_blank"')
=> "<a href=\"http://www.pokemon.com\" target=\"_blank\">http://www.pokemon.com</a>"

They also note that the monkey-patched Rails method mimics the original (i.e. per the Rails docs). I'll add a note to the README with a Rails specific example so this is harder to mistake.