I am building a Task Management System and have implemented
fullcalendar.js in it. I need to get the pending tasks and change the
color of those pending tasks. I am getting the instance variable of
pending tasks details in the rails controller. But in the ajax request I
am not able to loop it.
Please find my code below.
$('.task_name').live('click', function () {
alert(this.id);
$.ajax({
url: 'pending_task_details',
data: {
task_id: this.id
},
success: function (data, response, event, date) { <%
for date_cell in
@pending_tasks.start_date..@pending_tasks.end_date %>
getCellFromDate(date_cell, calInstance); <% end %>
}
});
});
The above is the logic I need to implement. But I am not getting
@pending_tasks.start_date in the view.
In the console I am getting the tasks details
#<Task id: 4, project_id: 4, task_name: \"Task4\", task_type: nil,
user_id: 2, description: \"Description4\", pm_id: nil, created_at:
\"2012-11-01 09:42:37\", updated_at: \"2012-11-01 09:42:37\",
percent_completed: \"12\", status: \"completed\", due_date: nil,
start_date: \"2012-11-01\", end_date: \"2012-11-08\", priority: \"low\",
days_left: nil>
In the tasks controller I am getting the pending tasks as.
def pending_task_details
@pending_tasks = Task.find_by_id(params[:task_id])
p "The pending tasks are......",@pending_tasks.inspect
#(Date.parse(@pending_tasks.start_date.to_s)..Date.parse(@pending_tasks.end_date.to_s)).each
{ |date| render :json=>[date.strftime('%a %d %b %Y')] and return}
render :json=>@pending_tasks
end
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment