Skip to content

jjburka/objective_generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Rails plugin to create ObjectiveResource Models

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published