Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8641255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:28:42+00:00 2026-06-12T11:28:42+00:00

I have a Ruby On Rails local server running which serves me the following

  • 0

I have a Ruby On Rails local server running which serves me the following JSON:

[ { "content" : "Here is content",
    "created_at" : "2012-10-07T01:06:51Z",
    "id" : 4,
    "name" : "Joe",
    "title" : "Title 1",
    "updated_at" : "2012-10-07T01:06:51Z"
  },
  { "content" : "Here is content",
    "created_at" : "2012-10-07T01:07:09Z",
    "id" : 5,
    "name" : "John",
    "title" : "Title2",
    "updated_at" : "2012-10-07T01:07:09Z"
  }
]

I am using RestKit to parse this into Post model objects like so:

- (void)loadObjects
{
    RKObjectMapping *objectMapping = [RKObjectMapping mappingForClass:[Post class]];
    [objectMapping mapKeyPath:@"id" toAttribute:@"postId"];
    [objectMapping mapKeyPath:@"created_at" toAttribute:@"createdAt"];
    [objectMapping mapKeyPath:@"content" toAttribute:@"content"];
    [objectMapping mapKeyPath:@"title" toAttribute:@"title"];
    [objectMapping mapKeyPath:@"name" toAttribute:@"name"];
    [objectMapping mapKeyPath:@"updated_at" toAttribute:@"updatedAt"];

    RKObjectManager* manager = [RKObjectManager objectManagerWithBaseURLString:@"http://localhost:3000/"];
    [manager loadObjectsAtResourcePath:@"/posts" objectMapping:objectMapping delegate:self];
}

- (void)objectLoader:(RKObjectLoader *)objectLoader didLoadObjects:(NSArray *)objects {
    NSLog(@"%@", objects);
}

This works fine, however the loadObjectsAtResourcePath:objectMapping:delegate: is deprecated. I assume I should therefore be using loadObjectsAtResourcePath:delegate:, but I cannot figure out a way to set the objectMapping. Any thoughts?

Update

I am now setting the delegate like so:

[manager loadObjectsAtResourcePath:@"/posts" usingBlock:^(RKObjectLoader *loader) {
    loader.objectMapping = objectMapping;
    loader.delegate = self;
}];
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T11:28:43+00:00Added an answer on June 12, 2026 at 11:28 am

    The restkit documentation says that if you use loadObjectsAtResourcePath:usingBlock: you can set the objectMapping from inside the a block.

    - (void)loadObjectUsingBlockExample {
        [[RKObjectManager sharedManager] loadObjectsAtResourcePath:@"/monkeys.json" usingBlock:^(RKObjectLoader *loader) {
            loader.objectMapping = [[RKObjectManager sharedManager].mappingProvider objectMappingForClass:[Monkey class]];
        }];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ruby on rails app running a server and sometimes it needs
I have a Ruby on Rails app running on my server, and I can't
I have a number of Rails 3.1 applications running on a local server, remote
I have a rails application which is running well in local (OsX, WEBrick). I've
I have a local development machine which has started to give me the following
I have a Ruby on Rails website at which I force all connections to
I have a Rails 3.2.3 site running on Ruby 1.9.2. I use the rails-i18n
I have server (WHM, ruby 1.9.2, Rails 3.0.3, centOS, passenger) and I just deploy
I have ruby on rails installed on my ubuntu 8.10 desktop. Script/generate came up
I have Ruby on Rails 3.1 application and i use for Sphinx + Thinking

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.