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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:10:41+00:00 2026-06-07T23:10:41+00:00

I have a jquery date selector in my view that sends the :start_date and

  • 0

I have a jquery date selector in my view that sends the :start_date and :end_date into my model which successfully creates an entry in my queries model which has attributes start_date and end_date.

In my controller I have a line in a mySQL query that takes string variables query.start_date and query.end_date. Those successfully pull from the model if I hand-define the start_date and end_date methods with individual dates.

In my controller, I also have query = Query.new to instantiate a class.

Finally, here is the code in my model, with my main page reloading on successful entry of a date range (which should then generate a graph with said date range):

class Query < ActiveRecord::Base
  attr_accessible :name, :created_at, :start_date, :end_date

  validates_presence_of :start_date, :end_date

  def start_date
    start_date = Query.last.start_date
  end

  def end_date
    end_date = Query.last.end_date
  end

Currently, I’m getting an error undefined methodlast’ for ActiveRecord::AttributeMethods::Query:Module`

I’m a bit confused about how to grab that last entry and have my page reload to display those date values.

  • 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-07T23:10:42+00:00Added an answer on June 7, 2026 at 11:10 pm

    Try Query.all.last.end_date or Query.find(:all).last.end_date

    Edit

    Query is probably a reserved word. It isn’t listed in the official
    list of reserved words, but rails is finding a conflicting file. Just
    change the model name as a workaround.

    https://stackoverflow.com/a/4331159/643500

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

Sidebar

Related Questions

I'm in search for a jQuery-based Date/Time Selector. I have found a few that
I have a jQuery script which returns the current date into a text box.
I have a jquery datepicker which is renders the current date by default as
I have a jquery ui framework that is constructing the Date Picker elements. I
I have a jQuery UI datepicker that, when you click on a date, clears
I have a standard Jquery date picker which shows 2 textboxes. One textbox has
I know that there are lots of jQuery date pickers available and I have
I have a Date Input text box generated by jquery Date Picker which is
I have several or a unknown amount of jQuery Date selectors on a view.
I have a jQuery UI DatePicker calendar that alerts when a date is clicked

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.