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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:12:36+00:00 2026-05-31T11:12:36+00:00

My app has several project/task scheduling features. I created a simple demo with the

  • 0

My app has several project/task scheduling features. I created a simple demo with the Ice_cube gem first and it works great for scheduling recurring events…but I’m concerned about doing individual day-of-week scopes/actions; so, I created a schedule form with 7 boolean checkboxes.

See this post for an example > weekday events. I couldn’t get the solution recommended to work, but my requirements are slightly different.

Instead, I wrote some code that works — but its very clunky/ugly. And I’m looking for ideas on how to writing a method that allows me: assign calendar dates for each weekday for the user selected date range.

Index view:

<h1>Weekly Project Schedule</h1>
<br />

<h2>Monday: <%= Date.today.monday %></h2>
<% @tasks.each do |task| %>
    <% if task.monday? %>
        <h3><%= link_to task.name, task %></h3>
        <p>Starts: <%= task.starts_on %></p>
        <p>Ends: <%= task.ends_on %></p>
        <p><%= link_to 'Edit', edit_task_path(task) %></p>      
    <% end %>

<% end %>

<h2>Tuesday:  <%= Date.today.monday+1 %></h2>
<% @tasks.each do |task| %>
    <% if task.tuesday? %>
        <h3><%= link_to task.name, task %></h3>
        <p>Starts: <%= task.starts_on %></p>
        <p>Ends: <%= task.ends_on %></p>
        <p><%= link_to 'Edit', edit_task_path(task) %></p>      
    <% end %>

<% end %>

<h2>Wednesday:  <%= Date.today.monday+2 %></h2>
<% @tasks.each do |task| %>
    <% if task.wednesday? %>
        <h3><%= link_to task.name, task %></h3>
        <p>Starts: <%= task.starts_on %></p>
        <p>Ends: <%= task.ends_on %></p>
        <p><%= link_to 'Edit', edit_task_path(task) %></p>      
    <% end %>

<% end %>

<h2>Thursday:  <%= Date.today.monday+3 %></h2>
<% @tasks.each do |task| %>
    <% if task.thursday? %>
        <h3><%= link_to task.name, task %></h3>
        <p>Starts: <%= task.starts_on %></p>
        <p>Ends: <%= task.ends_on %></p>
        <p><%= link_to 'Edit', edit_task_path(task) %></p>      
    <% end %>

<% end %>


Schema:
    ActiveRecord::Schema.define(:version => 20120315004635) do
      create_table "tasks", :force => true do |t|
    t.string   "name"
    t.date     "starts_on"
    t.date     "ends_on"
    t.boolean  "monday"
    t.boolean  "tuesday"
    t.boolean  "wednesday"
    t.boolean  "thursday"
    t.boolean  "friday"
    t.boolean  "saturday"
    t.boolean  "sunday"
    t.boolean  "completed"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

Model – no added code.

Any help greatly appreciated!

  • 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-31T11:12:38+00:00Added an answer on May 31, 2026 at 11:12 am

    You need metaprogramming

    For example in view

    <%- %w(sunday monday tuesday wednesday thursday friday saturday).each |day| %>
      <h2><%= day.titleize %>: <%= Date.today.send(day) %></h2>
      <% @tasks.each do |task| %>
        <% if task.send("#{day}?") %>
            <h3><%= link_to task.name, task %></h3>
            <p>Starts: <%= task.starts_on %></p>
            <p>Ends: <%= task.ends_on %></p>
            <p><%= link_to 'Edit', edit_task_path(task) %></p>      
        <% end %>
    
      <% end %>
    <% end %>
    

    And so on

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

Sidebar

Related Questions

I've created a new Google App Engine project within Eclipse. I copied several JARs
I have created my first project (after several tutorials and reading the Android Developers
My app has several buttons which trigger different events. The user should NOT be
Ive got a jquery app that has several grids (jqgrid) in defferent tabs. Below
I'm working on a PHP app that has several objects that can be commented
I have a folder in my WPF app Images that has several .png files
I have a winforms app and the main (and only) form has several buttons.
I have a document-based Core Data app. My main Core Data entity has several
My app has 6 menu items, so the OS shows the first 4, then
I'm a newb iPhone developer writing an app that has several large JPGs and

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.