Skip to content

Commit

Permalink
Merge pull request #43 from wponrails/feature/redirects
Browse files Browse the repository at this point in the history
Feature/redirects
  • Loading branch information
sebastiaandegeus committed Jul 13, 2015
2 parents 59499e2 + 02ad4f9 commit eb0505e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions app/models/concerns/wp_redirect.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module WpRedirect
extend ActiveSupport::Concern

def update_wp_redirect_attributes(json)
return unless json.is_a?(Hash)

self.wp_id = json['id']
self.from = json['from']
self.to = json['to']

save!
end

# implements class methods
module ClassMethods
def mappable_wordpress_attributes
%w( id from to )
end

def wp_type
to_s.demodulize.underscore.pluralize
end
end
end

0 comments on commit eb0505e

Please sign in to comment.