[Jifty-commit] r3080 - in jifty/trunk: .
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Mon Apr 2 01:22:09 EDT 2007
Author: trs
Date: Mon Apr 2 01:22:07 2007
New Revision: 3080
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/Manual/Cookbook.pod
Log:
r20560 at zot: tom | 2007-04-02 01:21:31 -0400
* Make =head2 sections consistently titled
* Add section on using models/actions outside of a Jifty app
Modified: jifty/trunk/lib/Jifty/Manual/Cookbook.pod
==============================================================================
--- jifty/trunk/lib/Jifty/Manual/Cookbook.pod (original)
+++ jifty/trunk/lib/Jifty/Manual/Cookbook.pod Mon Apr 2 01:22:07 2007
@@ -125,7 +125,7 @@
zone appropriately. All dates are stored in UTC in the database, to
ensure consistency.
-=head2 How do I emulate 'created_on' field like Rails ?
+=head2 Emulate 'created_on' field like Rails ?
In Rails, if you have a field named 'created_on', it's automatically
set to the creation time of the record. How can I emulate this
@@ -154,7 +154,7 @@
$attr->{'created_on'} = DateTime->now;
};
-=head2 How do I emulate 'updated_on' ?
+=head2 Emulate 'updated_on' ?
If a lot of column could change, you can override C<_set> method:
@@ -254,7 +254,7 @@
pluralise or pluralises differently.
-=head2 How do I perform ajax canonicalization on a given field ?
+=head2 Perform ajax canonicalization on a given field ?
Asking user to input something in a form is really common in a web
app. For some certain form fields you want them to have a certain
@@ -371,3 +371,20 @@
};
Otherwise, everything should work as expected.
+
+=head2 Reuse Jifty models and actions outside of a Jifty app
+
+ use lib '/path/to/MyApp/lib';
+
+ use Jifty::Everything;
+ BEGIN { Jifty->new; }
+
+ use MyApp::Model::Foo;
+ use MyApp::Action::FrobFoo;
+
+From there you can use the model and action to access your data and run your
+actions like you normally would.
+
+If you've actually installed your app into C<@INC>, you can skip the
+C<use lib> line.
+
More information about the Jifty-commit
mailing list