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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:11:05+00:00 2026-05-24T19:11:05+00:00

I’ve got this basic model, where a provision object, a nested resource of a

  • 0

I’ve got this basic model, where a provision object, a nested resource of a bill, can have three types of effective date types. Suffice to say, if the client picks the third option “On a specific date”, I got a bit of JQuery popping up a second field with a datepicker so he can select that datetime value.

However, for the past few hours I’ve been pulling my hair trying to figure out why the server receives the parameters correctly, but enters the value for the datetime as nil. I’ve tried every single trick in the book to resolve this (even tried dropping the column and recreating it). I’m sure I’m missing something quite obvious. Please help 🙁

Here’s my code, let’s start

first with the Server response (the parameter in question is called date_of_effect):

Started POST "/bills/1/provisions" for 127.0.0.1 at 2011-08-18 22:27:42 -0400
  Processing by ProvisionsController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"v6B+sgSsOsPXOGl2TulguIpfXaRmvTBzUJ7Qge/aNhM=", "provision"=>{"article"=>"2", "text"=>"testing this", "in_effect"=>"3", "date_of_effect"=>"08/25/2011"}, "commit"=>"Create Provision", "bill_id"=>"1"}
  SQL (0.6ms)  INSERT INTO "provisions" ("article", "bill_id", "created_at", "date_of_effect", "in_effect", "order_id", "text", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?)  [["article", 2], ["bill_id", 1], ["created_at", Fri, 19 Aug 2011 02:27:42 UTC +00:00], ["date_of_effect", nil], ["in_effect", 3], ["order_id", nil], ["text", "testing this"], ["updated_at", Fri, 19 Aug 2011 02:27:42 UTC +00:00]]
  Bill Load (0.1ms)  SELECT "bills".* FROM "bills" WHERE "bills"."id" = 1 LIMIT 1
Redirected to http://localhost:3000/bills/1
Completed 302 Found in 230ms

The relevant fields of my view look like this:

<div class="datelabel">Select a date</div>
<div class="datelabel"><%= f.text_field(:date_of_effect) %></div>

…

<% content_for :bottom do %>
<script>
$(function() {
    $(".datelabel").hide();
    $('#provision_date_of_effect').datepicker();
    $('#provision_in_effect').change(function() {
    ($(this).val() == '3') ? $('.datelabel').show('puff') : $('.datelabel').hide();
    }); 
});
</script>
<% end %>

And finally my create method in the controller (notice the comment lines are me trying out different methods to get the datetime to stick, to no avail unfortunately):

  def create
    @provision = Provision.new(params[:provision])
    @provision.bill_id = params[:bill_id]
    @provision.save
   # @provision.date_of_effect = params[:provision][:date_of_effect]
   # @provision.save(:validate => false)
    flash[:notice] = "Section added"
    redirect_to @provision.bill
  end

Any help would be greatly appreciated, thanks 🙂

  • 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-24T19:11:06+00:00Added an answer on May 24, 2026 at 7:11 pm

    You can do this:

     @provision.date_of_effect = Date.strptime(params[:provision][:date_of_effect], '%m/%d/%Y') if !params[:provision][:date_of_effect].blank?
    

    Or you can change format for datepicker. Date can’t parse this format “08/25/2011”

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have some data like this: 1 2 3 4 5 9 2 6
i got an object with contents of html markup in it, for example: string
Does anyone know how can I replace this 2 symbol below from the string
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text

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.