lib/ripple/conversion.rb in ripple-0.8.0.beta2 vs lib/ripple/conversion.rb in ripple-0.8.0
- old
+ new
@@ -12,24 +12,29 @@
# See the License for the specific language governing permissions and
# limitations under the License.
require 'ripple'
module Ripple
+ # Provides ActionPack compatibility for {Ripple::Document} models.
module Conversion
include ActiveModel::Conversion
+ # True if this is a new document
def new_record?
new?
end
+ # True if this is not a new document
def persisted?
!new?
end
+ # Converts to a view key
def to_key
new? ? nil : [key]
end
+ # Converts to a URL parameter
def to_param
key
end
end
end