[Jifty-commit] r5978 - in JiftyX-ModelHelpers/trunk: lib/JiftyX t/Simapp/t
Jifty commits
jifty-commit at lists.jifty.org
Sun Nov 2 10:42:01 EST 2008
Author: gugod
Date: Sun Nov 2 10:41:59 2008
New Revision: 5978
Modified:
JiftyX-ModelHelpers/trunk/ (props changed)
JiftyX-ModelHelpers/trunk/dist.ini
JiftyX-ModelHelpers/trunk/lib/JiftyX/ModelHelpers.pm
JiftyX-ModelHelpers/trunk/t/Simapp/t/helpers.t
JiftyX-ModelHelpers/trunk/t/Simapp/t/m-helper.t
Log:
r24708 at yra: gugod | 2008-11-02 23:38:53 +0800
Fix document and increase test coverage.
r24709 at yra: gugod | 2008-11-02 23:41:03 +0800
Release 0.21
Modified: JiftyX-ModelHelpers/trunk/dist.ini
==============================================================================
--- JiftyX-ModelHelpers/trunk/dist.ini (original)
+++ JiftyX-ModelHelpers/trunk/dist.ini Sun Nov 2 10:41:59 2008
@@ -1,5 +1,5 @@
name = JiftyX-ModelHelpers
-version = 0.20
+version = 0.21
author = Kang-min Liu <gugod at gugod.org>
license = MIT
copyright_holder = Kang-min Liu
Modified: JiftyX-ModelHelpers/trunk/lib/JiftyX/ModelHelpers.pm
==============================================================================
--- JiftyX-ModelHelpers/trunk/lib/JiftyX/ModelHelpers.pm (original)
+++ JiftyX-ModelHelpers/trunk/lib/JiftyX/ModelHelpers.pm Sun Nov 2 10:41:59 2008
@@ -85,9 +85,9 @@
# Load a colllection of books
$books = M("BookCollection", author => "Jesse");
-If you want more sugar:
+Or, even better:
- use JiftyX::ModelHelper ':auto';
+ use JiftyX::ModelHelper;
# Load the record of book with id = $id
$book = Book($id);
@@ -175,9 +175,9 @@
Book
BookCollection
-But only when use use C<JiftyX::ModelHelpers> with an C<:auto> tag:
+The are generated and imported when you say:
- use JiftyX::ModelHelpers ':auto':
+ use JiftyX::ModelHelpers;
The record function takes either exact one argument or a hash. When it
is given only one argument, that argument is treated as the value of
@@ -248,6 +248,11 @@
# Don't want BookCollection function
use JiftyX::ModelHelpers qw(Book);
+Or you can only import the M() function, which is likely
+much less problematic:
+
+ use JiftyX::ModelHelpers qw(M);
+
=head2 Development
The code repository for this project is hosted on
Modified: JiftyX-ModelHelpers/trunk/t/Simapp/t/helpers.t
==============================================================================
--- JiftyX-ModelHelpers/trunk/t/Simapp/t/helpers.t (original)
+++ JiftyX-ModelHelpers/trunk/t/Simapp/t/helpers.t Sun Nov 2 10:41:59 2008
@@ -2,7 +2,7 @@
use warnings;
use strict;
-use Jifty::Test::Dist tests => 3;
+use Jifty::Test::Dist tests => 6;
use JiftyX::ModelHelpers;
{
@@ -25,3 +25,14 @@
is( $b->name, "Good Book A" );
}
+{
+ my $b = BookCollection;
+ is( ref($b), "Simapp::Model::BookCollection" );
+}
+
+
+{
+ my $b = BookCollection(name => "Good Book A");
+ is( ref($b), "Simapp::Model::BookCollection" );
+ is( $b->count, 1 );
+}
Modified: JiftyX-ModelHelpers/trunk/t/Simapp/t/m-helper.t
==============================================================================
--- JiftyX-ModelHelpers/trunk/t/Simapp/t/m-helper.t (original)
+++ JiftyX-ModelHelpers/trunk/t/Simapp/t/m-helper.t Sun Nov 2 10:41:59 2008
@@ -2,7 +2,7 @@
use warnings;
use strict;
-use Jifty::Test::Dist tests => 3;
+use Jifty::Test::Dist tests => 6;
use JiftyX::ModelHelpers qw(M);
{
@@ -25,3 +25,14 @@
is( $b->name, "Good Book A" );
}
+{
+ my $b = M("BookCollection");
+ is( ref($b), "Simapp::Model::BookCollection" );
+}
+
+{
+ my $b = M("BookCollection", name => "Good Book A");
+ is( ref($b), "Simapp::Model::BookCollection" );
+ is( $b->count, 1 );
+}
+
More information about the Jifty-commit
mailing list