Last active
December 12, 2015 05:18
-
-
Save Benjmin/4720543 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class Page < ActiveRecord::Base | |
belongs_to :book | |
attr_accessible :link, :summary, :title | |
before_save :normalize_link, :unless => :title? | |
def normalize_link. | |
@title = @link.match( /(?<=http:\/\/)(.*)(?=.com)/ ) | |
end | |
scope :title?, where(@title == True) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment