public
Description: Rails plugin to create ObjectiveResource Models
Homepage:
Clone URL: git://github.com/jjburka/objective_generator.git
jjburka (author)
Sat Mar 21 09:56:49 -0700 2009
commit  040b80bc99f2ce1891c9d0548715f1fa9b7f38b8
tree    d53aafb78ecf1c861f614f7df68eee75f32bf59f
parent  35c634fd9b06d1f5e00de5a2621b0329d3fa32d9
README.textile

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