In this controller i've to put the condition for attandance. I'm doing
attandance application. In this when the user login with username and
password in my attandance table their attandance will marked. now i want
to put the condition that in one day only once their data should go in
to attandance table. If they logged in second time in same day the data
should not go into my table. The should check with date and name. How
can i do this. Please help me to get the answer.
Thanks,
Manjula
Attachments:
http://www.ruby-forum.com/attachment/1049/admin_controller.rb
--
Posted via http://www.ruby-forum.com/.
> In this controller i've to put the condition for attandance. I'm doing
> attandance application. In this when the user login with username and
> password in my attandance table their attandance will marked. now i
> want
> to put the condition that in one day only once their data should go in
> to attandance table. If they logged in second time in same day the
> data
> should not go into my table. The should check with date and name. How
> can i do this. Please help me to get the answer.
What's happening now? Does it never find the previous login?
Is date a Date or a Time? If the database has it as a datetime then
Date.today isn't going to match it.
Yes it is not finding the previous login. How may times i'm logging in
the data going into my attandance table. I don't want this. Only once it
should go in a day.
> Yes it is not finding the previous login. How may times i'm logging in
> the data going into my attandance table. I don't want this. Only
> once it
> should go in a day.
Is your date column a date or a datetime?
>
>
> My date column is simple date
Now I see it. You are mixing attandance and @attandance, which are not
the same variable.
(By the way, not that it matters here, but it's attendance, with an e.)
> what is the condition do i have to write there?
You just have to be consistent.
If you do attendance = Find...
then you have to do
if attendance, not if @attendance.
Attachments:
http://www.ruby-forum.com/attachment/1051/admin_controller.rb