Browse files

added view models part to the readme.

  • Loading branch information...
Elad Meidar
Elad Meidar committed Nov 13, 2009
1 parent 6e40944 commit c55c4a9bac406ae8d81b2b544d8c7383a90ae303
Showing with 12 additions and 0 deletions.
  1. +12 −0 README.textile
@@ -11,6 +11,7 @@ as for now this is only available as a plugin, install as follows:
h3. Usage
+h2. create a migration
First you'll have to generate a migration
<pre>script/generate migration create_users_and_views</pre>
@@ -37,6 +38,17 @@ end</pre>
* *use_algorithm* - again, don't know if this is a cross DBMS option but on MySQL you can choose between @:definer@ or @:invoker@
* *check_option* - same deal, on MySQL you can choose between @:cascaded@ and @:local@
+h2. creating a model
+based on the name you chose to your view, you can create a model based on the existing rails naming conventions,
+you can always name it whatever you want and specify the view name in @set_table_name@.
+Note that the view model inherits from @ActiveRecord::View@ and not from @ActiveRecord::Base@:
+<pre>class ThisIsAView < ActiveRecord::View
+ set_table_name 'special_view_name'
h3. Database support
I investigated a bit, and the basic usage (@select@ / @base_model@) should run successfully on:

0 comments on commit c55c4a9

Please sign in to comment.