casey_jones 0.0.107 → 0.0.108

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,7 @@ module ActsAsLinkable
6
6
  end
7
7
 
8
8
  module ActionViewExtensions
9
- def link(obj)
9
+ def link(obj, options={}, html_options={})
10
10
  raise "I can't link to nil." unless obj
11
11
  if (obj.class == Array) || (obj.class == ActiveRecord::Relation)
12
12
  obj.map{|v| link(v)}.to_sentence
@@ -17,13 +17,12 @@ module ActsAsLinkable
17
17
  obj_name = (p[:object_name] ||= obj.class.name.underscore).to_s.to_sym
18
18
  (render :partial => p[:partial], :locals => {obj_name => obj}).strip
19
19
  else
20
- opts = {}
21
- link_attr = obj.link_attr
22
- link_attr.each do |key, val|
23
- link_attr[key] = obj.send(val) if val.class == Symbol
20
+ name = obj.link_attr[:name]
21
+ link_attr.except(:name).each do |key, val|
22
+ html_options[key] ||= obj.send(val) if val.class==Symbol
24
23
  end
25
- opts[:title] = link_attr[:title] if link_attr.has_key?(:title)
26
- link_to link_attr[:name], obj, opts
24
+ url = self.send("#{obj.class.name.tableize}_path", obj, options.except(:remote))
25
+ link_to name, obj, html_options, :remote => options[:remote]||true
27
26
  end
28
27
  end
29
28
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: casey_jones
3
3
  version: !ruby/object:Gem::Version
4
- hash: 201
4
+ hash: 199
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 107
10
- version: 0.0.107
9
+ - 108
10
+ version: 0.0.108
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tyler Gannon
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-24 00:00:00 -07:00
18
+ date: 2010-07-25 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies: []
21
21