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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:46:26+00:00 2026-05-26T22:46:26+00:00

1) i have a leave request form in my HRM application, i want that

  • 0

1)
i have a leave request form in my HRM application, i want that when a user enter the “from_date”, the “to_date” should be greater than “from_that”?

2)
In my app i have a leave model in which user can defined leave type and day’s allowed.In my second model leave_request user can request for leave according to leave type.Everything is working well.Now i want to display leave balance available to user on basis of allowed day’s in leave_request form?

Migration leave.rb:

  class CreateLeaves < ActiveRecord::Migration
      def self.up
        create_table :leaves do |t|
          t.integer :user_id
          t.integer :company_id
          t.string  :leave_type
          t.integer :allowed_leaves
          t.text :description, :limit => 500

          t.timestamps
        end
      end

      def self.down
        drop_table :leaves
      end
    end

And leave_request.rb:

 class CreateLeaveRequests < ActiveRecord::Migration
      def self.up
        create_table :leave_requests do |t|
          t.integer :employee_id
          t.integer :leave_type
          t.date :from_date
          t.date :to_date
          t.text :reason_for_leave
          t.string :contact_during_leave, :limit => 10

          t.integer :user_id
          t.integer :company_id

          t.timestamps
        end
      end

      def self.down
        drop_table :leave_requests
      end
    end

And can i validate number of leaves available like if user do not have enough leave balance than their should be a message like”You do not have enough leave to request ” etc.

  • 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-26T22:46:27+00:00Added an answer on May 26, 2026 at 10:46 pm

    Hi friends here i came with a new answer of my second question

    i used following line of code to fix my problem:

    <label><a href="/leave_types">Leave Type</a></label>
      <label>Balance</label>
    
     <% for leave in @leave_types %> 
       <%= leave.leave_type %>
       <%= leave.allowed_leaves%>
     <% end %>
    

    This displayed all my leave_types in my new leave_request form.

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

Sidebar

Related Questions

I have simple php validation form that is halfway working. If you leave the
I have a form that pop ups for users to leave comments on videos.
I have a small ajax application thats sends a form and returns data that
I have an issue that when I leave the android device idle for a
I have a asp.net/c# web app. When do user leave a certain page, I
I have a local scientific application that uses threads to process independent pieces of
The plone guy is on leave, I have a request to add breadcrumbs to
I have that code: jQuery(document).ready(function () { // binds form submission and fields to
I have a JSF 2.0 page that I want to allow a GET parameter
I have a REST service which takes a JSON request. I want to validate

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.