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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:16:10+00:00 2026-05-23T16:16:10+00:00

This question is about 2 rails apps I’m building. I’m trying to get my

  • 0

This question is about 2 rails apps I’m building. I’m trying to get my head around Rails and restful web services. Most of the code is pseudo but If required I suppose i could attempt some examples.

There are also a few basic rails and web requests thrown in.

Imagine I have rails programs A and B. I want A to send a post request which will basically contain an object formatted in JSON (not required but planned) and B to recieve it and turn it into the object I want. So heres my plan or concept at least and I’d love some feedback on it.

So focusing on B for the moment.

A url like this

127.0.0.1:8080/receive

would link to something like

def recieve (assuming routes are setup correctly)


@object = (this is where im a bit lost. how do i receive it from URL)
@request = UserRequest.new(params[:request])

A lot of tutorials seem to focusing on sending post requests but never receiving or processing them. anyone point me in the right direction?


And for A

I know how to send a post request

 @stringParams = 'www.stackoverflow.com'
    @hostURL = 'http://127.0.0.1:20000/requests/add'
    #This is a post request that needs to post json to my recieveing crawler
    res = Net::HTTP.post_form(URI.parse(@hostURL),
    {'url' =>  @stringParams})
    #puts res.body

I know how to create a JSON object from a hash

 @myHash = HASH.new
    @myHash =
    {
      "url" => 'www.stackoverflow.com'
       #Assume theres more than one variable
    }

@myJsonHash = @myHash.to_json

So the question for A is how do I send that @myJsonHash in a post request. Or is that something thats really stupid to do and have I misunderstood the requirments?

  • 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-05-23T16:16:11+00:00Added an answer on May 23, 2026 at 4:16 pm

    You’ll receive data in the parameters. You should know which params contain what.

    def receive
      @object = Object.new({:name => params[:name], :address => params[:address] })
      if @object.save
        #ok
      else
        #error
      end
    end
    

    Beware of cross sites posts, you should implement some sort of authentication.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im just messing around with Ruby on Rails and HTML. This question isn't about
This question about Timers for windows services got me thinking: Say I have (and
I was reading this question about how to parse URLs out of web pages
This is a rails question about migration versions So i have a few migrations
I have a very simple question about rails console, if I want to get
I know how to run functional/integration tests in Rails, this question is about best
This comes from the Rails world, but is a pretty generic question about Single
(This is really a newbie question about Rake & Rails & dependencies in general.
** Update: This question is about a bug in Rails: ** https://rails.lighthouseapp.com/projects/8994/tickets/267 ** End
This is probably a silly question, but I'm following a videocast about Rails, right

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.