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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:11:15+00:00 2026-05-13T15:11:15+00:00

So I am working on an application where I want to display a video

  • 0

So I am working on an application where I want to display a video on the main page of the site. The video model has an actual_date and public_filename attribute. Now a user sets the actual date as :date in the model. I am trying to figure out how to best go about making the video on the homepage display the video that is assigned to today’s date. My homepage view is:

Please wait while the video loads…

<script type='text/javascript'>
var s1 = new SWFObject('/flash/player.swf','player','500','372','9');
s1.addParam('allowfullscreen','true');
s1.addParam('allowscriptaccess','always');
s1.addParam('flashvars','file=<%= current_video.public_filename %>');
s1.write('preview');
</script>

I just included the current_video method, as I was playing around with creating one to return to the view with the right video url.

So I need a way to look at all of the videos in the database, see if any of the actual_date attributes are equal to today’s date and if so tell current_video that it equals that video.

Thank you for any input or suggestions you might have!

  • 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-13T15:11:15+00:00Added an answer on May 13, 2026 at 3:11 pm

    You don’t specify what should happen if more than one video has an actual_date that is equal to today’s date. However, to retrieve one video just do:

    @current_video = Video.first(:conditions => ['actual_date LIKE ?', Date.today])
    

    —or you can do:

    @current_video = Video.last(:conditions => ['actual_date LIKE ?', Date.today])
    

    Whether you use first or last will depend on if you have some secondary sort order set up on your Video model. If it were me I’d create a named scope for this:

    class Video < ActiveRecord::Base
      named_scope :for_today, :conditions => { 'actual_date LIKE ?', Date.today }
    end
    

    —then you can do

    @video = Video.for_today
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a windows application where i want to display orkut user
I have developed one application which has 15 screens. Now I want to display
I'm working on application and I want to connect it to facebook. The user
I have an working application. Now I want to change the table names of
in my web application i am displaying videos of user, I want to display
I am working on Ruby on Rails application, with Prototype. I want to display
I am working on an email client application in C#. I want to display
I am working on small android application,I want to display newly added items on
In my application, I want to display notification to the user according to the
I am working on a C# application and want to display dates so they

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.