Hi all,
Could any one help me how to edit all the timesheets at a time.
If i select the month as december, i should get all the timesheets from
the data base, I’m getting this one correctly, after getting this, i
should be able to edit these automatically all the timesheets.
Thisis my clear explanation::
if i search the list according to date i’ll get in the following way…
Created At Project Hours Worked Remarks
2006-09-18 Ruby 3 working good
2006-09-18 Ruby 5 not working good
and here it self i should be edited in the following way.
Created At Project Hours Worked Remarks
2006-09-18 Rails 3 working good
2006-09-18 Ruby 8 not working good
see project Ruby is changed to Rails and Hours Worked is changed to 8.
like i need to get the list and i should be able to edit there it self.
Please give any suggestions.
Following is my code::
See this is my controller::
def logic1
userId=@session[‘user’][‘id’]
user=User.find(userId)
@timesheets = Timesheet.find(:all,:conditions=>[‘month(created_at) =
?’, params[:timesheet][‘created_at(2i)’].to_i]).map {|t| t.id }
end
VIEW::
<%= link_to “Home”, :action=>“index”%>
<%= start_form_tag :action => ‘update’,:id=>@timesheets %>
Created At | Project | Hours Worked | Remarks |
---|---|---|---|
<%= date_select 'timesheet', 'created_at' %> | <%@projects=Project.find_all%><%= collection_select("timesheet", "project" , @projects, "name", "name") %> | <%= text_field 'timesheet', 'hours_worked', "size" => 31 %> | <%= text_area 'timesheet', 'remarks' ,"cols" => 22, "rows" => 5 %> |
Thanks in Advance,
Harish