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

  • Home
  • SEARCH
  • 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 1868190
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T06:39:12+00:00 2026-05-17T06:39:12+00:00

I am currently working on rails3 application that uses jQuery. I have a javascript

  • 0

I am currently working on rails3 application that uses jQuery. I have a javascript plugin that returns an array of JSON data based on selections that the user has made. I have a save button that reads this array of data form the java script plug in and posts it back to the rails application to be saved. The javascript seems to be working, it makes the correct ajax call and sends the data back to the rails application. The problem seems to be the way rails is encoding the data that has been PUT back to the server.

The problem is the nested data I am trying to post back to the rails application. I have an array of shifts that seems to be getting treated as one long string and not the hash of values I am expecting. Here is the output of the data rails is getting.

Parameters:
{“shifts”=>”[{\”start_time\”:\”Wed Oct
06 2010 09:30:00 GMT+0100
(BST)\”,\”end_time\”:\”Wed Oct 06 2010
13:00:00 GMT+0100
(BST)\”,\”active\”:true,\”occurrence\”:\”weekly\”,\”company_id\”:\”1\”},{\”start_time\”:\”Thu
Oct 07 2010 09:30:00 GMT+0100
(BST)\”,\”end_time\”:\”Thu Oct 07 2010
13:00:00 GMT+0100
(BST)\”,\”active\”:true,\”occurrence\”:\”weekly\”,\”company_id\”:\”1\”}]”,
“id”=>”1”}

I would expect to be able to then use the following code in my controller

params[:shifts].each do |shift|
  puts shift.inspect # would expect a hash of values here
end

However instead of the hash of values there is just a single string. Any suggestions as to why rails is not encoding the hash values as you would expect it too.

  • 1 1 Answer
  • 2 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-17T06:39:13+00:00Added an answer on May 17, 2026 at 6:39 am

    I believe you would need to parse it as JSON first. “require ‘json'” at the top of your controller then try JSON.parse(params[:shift]).each {|shift| shift.inspect} .

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

Sidebar

Related Questions

Background Currently, I am working on a Rails application. I have different products that
Hello Ruby/Rails/Merb developers! Im currently working on a web project that will have a
I am currently working on a WCF application that consumes a Rails REST Service.
I have a rails application that I've added jquery datepicker to a date field.
I'm working on a Rails application where I have users that can add each
Hi Currently i am working on a rails project . where i have to
I currently have hostingrails.com. But following their tutorial on deploying rails application with FASTCGI
i am currently working on a rails application. brief regarding the application is as
I'm working on a Ruby on Rails application that used the Devise authentication system.
I'm working on a Rails application and it is currently hosted on a shared

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.