Skip to content

Commit

Permalink
add wp_redirect concern
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiaandegeus committed Jul 7, 2015
1 parent 59499e2 commit b37d5ef
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( name slug description count )
end

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

0 comments on commit b37d5ef

Please sign in to comment.