public
Fork of deimos1986/book_mdar
Description: Life On The Edge With Merb, DataMapper & RSpec
Homepage: http://blog.new-bamboo.co.uk
Clone URL: git://github.com/rubymaverick/book_mdar.git
Search Repo:
cleaned up DM update and destroy
rubymaverick (author)
Thu Jun 12 17:12:37 -0700 2008
commit  4a9683be1c4a9485e573985387deb932dfb7981f
tree    22b9bf5046f178a8bcad9f0fdb21da18b16432d0
parent  1eb1e6a8b5d5883fc02fd0e66d73165ee72c7bfd
...
1
2
3
 
4
5
6
...
14
15
16
17
 
 
 
18
19
20
...
22
23
24
25
 
26
27
28
29
 
30
31
32
...
130
131
132
 
133
134
135
...
385
386
387
388
 
389
390
391
...
1
2
 
3
4
5
6
...
14
15
16
 
17
18
19
20
21
22
...
24
25
26
 
27
28
29
30
 
31
32
33
34
...
132
133
134
135
136
137
138
...
388
389
390
 
391
392
393
394
0
@@ -1,6 +1,6 @@
0
 ## Models
0
 
0
-(TODO) - rewrite for DM 0.9, and make this section clearer
0
+(TODO) - Started the rewrite for DM 0.9, finish it!
0
 
0
 ### Getting started
0
 
0
@@ -14,7 +14,9 @@ This will make a post model for you, provided that you have defined an orm and t
0
 
0
 When you run `rake dm:db:automigrate`, it will create the database table and all the properties, but take care this is a destructive method!
0
 
0
-You can set the name of the database table in your model if it is called something different with:
0
+You can set the name of the database table in your model if it is called something different with:
0
+
0
+(TODO): this doesn't work anymore, how does it work in 0.9?
0
 
0
     set_table_name 'list_of_posts'
0
     
0
@@ -22,11 +24,11 @@ This is only necessary if you are using an already existing database.
0
 
0
 #### Properties
0
 
0
-So DataMapper models differ a bit from ActiveRecord models as previously stated. Defining the database columns is achieved with the `property` method.
0
+DataMapper models differ a bit from ActiveRecord models as previously stated. Defining the database columns is achieved with the `property` method.
0
 
0
 app/models/post.rb
0
 
0
- property :title, String, :lazy => false
0
+ property :title, String, :lazy => false
0
     
0
 This is the `title` property of the post model. As we can see, the parameters are the name of the table column followed by the type and finally the options.
0
 
0
@@ -130,6 +132,7 @@ DataMapper > 0.9 now supports has_many :through. For example, if you have a Pos
0
 #### Validation
0
 
0
 (TODO) - custom validation, and validatable gem
0
+(TODO) - does this really need all the user bashing fluff?
0
 It’s a known fact that users are stupid. They screw up; it happens. They enter information in the wrong format, leave required fields blank, or even enter in completely horrid data because they’re idiots and that’s what idiots do. I point you at [YouTube](http://www.youtube.com) video comments, [Digg](http://www.digg.com) (as a whole), and [MySpace](http://www.myspace.com) as proof of web users’ collective idiocy.
0
 
0
 But, alas, they’re how we make our money online. Thus, we need to guard against user error by validating anything that we need to save out to our persistence layers. Sometimes that means guarding against hack attempts, but most of the time it means guarding against invalid data and accidents.
0
@@ -385,7 +388,7 @@ Here is a list of the valid operators:
0
 * like - like
0
 * in - will be used automatically when an array is passed in as an argument
0
     
0
-TODO: no more find_by_sql, but im sure there is another way to just execute SQL.
0
+(TODO): no more find_by_sql, but im sure there is another way to just execute SQL.
0
 
0
 ##### Aggregates
0
 

Comments

    No one has commented yet.