Class: Georgia::Link
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Georgia::Link
- Includes:
- Concerns::Contentable
- Defined in:
- app/models/georgia/link.rb
Instance Method Summary collapse
- #ensure_forward_slash ⇒ Object
-
#slug ⇒ Object
returns only the last part of the url.
Instance Method Details
#ensure_forward_slash ⇒ Object
16 17 18 19 20 |
# File 'app/models/georgia/link.rb', line 16 def ensure_forward_slash self.contents.each do |content| content.text.insert(0, '/') unless content.text =~ Regexp.new('(^/)|(^http)') end end |
#slug ⇒ Object
returns only the last part of the url
23 24 25 |
# File 'app/models/georgia/link.rb', line 23 def slug @slug ||= text.match(/([\w-]*)$/)[0] end |