Every repository with this icon (
Every repository with this icon (
tree d53aafb78ecf1c861f614f7df68eee75f32bf59f
parent 35c634fd9b06d1f5e00de5a2621b0329d3fa32d9
| name | age | message | |
|---|---|---|---|
| |
.gitignore | ||
| |
MIT-LICENSE | ||
| |
README.textile | ||
| |
Rakefile | ||
| |
generated/ | ||
| |
init.rb | ||
| |
install.rb | ||
| |
lib/ | ||
| |
templates/ | ||
| |
test/ | ||
| |
uninstall.rb |
ObjectiveResource
This plugin creates objective c models from the routes declared in routes.rb for use with ObjectiveResouce
Usage
rake objective_resource:generate
Example 1
If you have a routes.rb file that contains the following
map.resources :people do |person|
person.resources :dogs
end
The plugin will create 3 class files
ObjectiveResourceSetup
The file ObjectiveResourceSetup contains settings for the framework (url , user info , etc)
Person , Dog
The model files discovered from the routes above. The attributes found in the columns_hash will be converted to objective c types. Also , the nested routes for dogs will be generated
The Person model will also have
-(NSArray *)findAllDogs;
which will get all the person’s dogs
Example 2
If you have a routes.rb file that contains the following
map.resources :people do |person|
person.resources :dogs , {:member=>{:pet => [:post]},:collection =>{ :search => [:any]}}
end
The plugin will generate the same files as above but will also generate the following stubs with most likely incomplete boilerplate code.
- (BOOL)postPetWithError:(NSError **)error;
- (id)getSearchWithError:(NSError **)error;
- (BOOL)postSearchWithError:(NSError **)error;
Todo
- Models that are nested in multiple models are not created correctly
- tests
Copyright © 2009 James Burka, released under the MIT license








