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 8028523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:09:41+00:00 2026-06-05T00:09:41+00:00

I am new to RoR and I am trying to build simple web application

  • 0

I am new to RoR and I am trying to build simple web application that uses ActiveResource ActiveRecord

I have one simple rails project hosted on localhost:3001. The application has welcome controller that looks like this

class WelcomeController < ApplicationController
  def index
    @persons = []
    num = 0
    until num < 10 do
      @persons[num] = Person.new
      @persons[num].name = [*('A'..'Z')].sample(8).join
      @persons[num].surname = [*('A'..'Z')].sample(64).join 
      @persons[num].dob = Time.at(rand * Time.now.to_i)      
      num+1      
    end

    respond_to do |format|
      format.xml { render :xml => @persons}
    end
  end
end

Person class looks like this:

class Person
  attr_accessor :name, :surname, :dob
end

This rails application should use as REST service for other application hosted on localhost:3000

The model in letter application looks like this:

class Person < ActiveResource::Base
   self.site = "http://localhost:3001"
end

Now, my question is how to list all 10 persons on the view?

I have tried to use Person model as ActiveResource, in person controller:

class PersonController < ApplicationController
  def index
   @persons= Person.find(":all")   
  end
end

by I get message ActiveResource::ResourceNotFound in PersonController#index

Thanks in advance.

  • 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-05T00:09:43+00:00Added an answer on June 5, 2026 at 12:09 am

    First of all, I’m not sure why you’re trying to create 10 People in your WelcomeController, but here’s a better way.

    class WelcomeController < ApplicationController
      def index
        10.times do
          person = Person.new
          person.name = [*('A'..'Z')].sample(8).join
          person.surname = [*('A'..'Z')].sample(64).join
          person.dob = Time.at(rand * Time.now.to_i) 
          person.save # This part is necessary for data to persist between requests
        end
    
        @persons = Person.all
    
        respond_to do |format|
          format.xml { render :xml => @persons}
        end
      end
    end
    

    Then, of course in your PersonController you can use

    @persons = Person.all
    

    or

    @persons = Person.find(:all)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to RoR and I'm trying to create a web application that acts
I am a fairly new to ROR. I'm trying to build my first web
I have RoR 3.0 web application which is acting as an OAuth API provider.
I'm trying a simple RoR application and using nifty generator scripts for scaffolding, layout
I'm trying to communicate with u rban airship API using a ROR web application.
Am new to RoR paperclip gem and i have been trying out some examples
I'm (completely) new to ROR and have got an application to maintain and upgrade.
I am new to ROR. I am trying add translations to my application. I
Trying to install the new Rails 3 release on OSX 10.6. Have never touched
I have a Ruby on Rails application that needs to find a home in

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.