SHIMADA Koji
null+****@clear*****
Wed Sep 19 17:11:32 JST 2012
SHIMADA Koji 2012-09-19 17:11:32 +0900 (Wed, 19 Sep 2012) New Revision: dee76c6c658f2696e38bc0b2abc501783c2dbeb0 https://github.com/logaling/logaling-server/commit/dee76c6c658f2696e38bc0b2abc501783c2dbeb0 Log: Use ActiveAttr Modified files: app/models/term.rb Modified: app/models/term.rb (+4 -14) =================================================================== --- app/models/term.rb 2012-09-19 17:11:12 +0900 (8613803) +++ app/models/term.rb 2012-09-19 17:11:32 +0900 (8e73b1b) @@ -1,20 +1,10 @@ #coding: utf-8 class Term - include ActiveModel::Validations - include ActiveModel::Conversion - extend ActiveModel::Naming + include ActiveAttr::Model - attr_accessor :source_term, :target_term, :note + attribute :source_term, type: String, default: '' + attribute :target_term, type: String, default: '' + attribute :note, type: String, default: '' validates_presence_of :source_term, :target_term - - def initialize(attributes = {}) - attributes.each do |name, value| - send("#{name}=", value) - end - end - - def persisted? - false - end end -------------- next part -------------- An HTML attachment was scrubbed... Download