Note that there are some explanatory texts on larger screens.

plurals
  1. POconsole shows OK but browser showes error?
    primarykey
    data
    text
    <p>Hi friends i came with a new problem. In my rails app i have a task controller and model.When i try to create a new task i got the error message "due_date" should not be blank, but when i check my console there is a success message.Here is my code:</p> <p>My Controller:</p> <pre><code>class TasksController &lt; ApplicationController layout "payroll" , :except =&gt; [:closed,:today,:this_week, :this_month] # GET /tasks # GET /tasks.xml def index @menu = "Timesheet" @page_name = "Manage Task" company_id = Company.find_by_subdomain(request.subdomain) @users = User.find_all_by_company_id(company_id) @tasks = Task.find_all_by_assigned_to(session[:current_user_id].to_i)#.page(params[:page]) @task = Task.new respond_to do |format| format.html # index.html.erb format.html # new.html.erb format.xml { render :xml =&gt; @tasks } end end # POST /tasks # POST /tasks.xml def create @task = Task.new(params[:task]) #@task.assigned_to = session[:user_id] @task.task_status = "0" respond_to do |format| if @task.save Email.task_created(@task).deliver @tasks = Task.all @task = Task.new format.html { redirect_to tasks_path } format.xml { render :xml =&gt; @task, :status =&gt; :created, :location =&gt; @task } else format.html { render :action =&gt; "new" } format.xml { render :xml =&gt; @task.errors, :status =&gt; :unprocessable_entity } end end end </code></pre> <p>My Model:</p> <pre><code>class Task &lt; ActiveRecord::Base #validation start validates :description, :due_date, :assigned_to, :priority, :presence =&gt; true validates_length_of :description, :maximum =&gt;500 end </code></pre> <p>and View:</p> <pre><code>&lt;%= form_for(@task) do |f| %&gt; &lt;%= render 'shared/form_error', :object =&gt; @task %&gt; &lt;div class="field"&gt; &lt;%= f.label :description %&gt;&lt;br /&gt; &lt;%= f.text_area :description ,:rows =&gt; "2", :cols =&gt; "20" %&gt; &lt;/div&gt; &lt;div class="field"&gt; &lt;%= f.label :due_date %&gt;&lt;br /&gt; &lt;%= f.text_field :due_date %&gt; &lt;/div&gt; &lt;div class="field"&gt; &lt;%= f.label :assigned_to %&gt;&lt;br /&gt; &lt;%= collection_select(:task, :assigned_to, User.all, :id, :first_name, :prompt =&gt;true ) %&gt; &lt;/div&gt; &lt;div class="field"&gt; &lt;%= f.label :priority %&gt;&lt;br /&gt; &lt;%= f.select (:priority, [['High'],['Medium'],['Low']]) %&gt; &lt;/div&gt; &lt;div class="actions"&gt; &lt;button type="submit" class="btn"&gt;&lt;img src="/images/add.png" /&gt;&amp;nbsp; Add This Task&lt;/button&gt; &lt;/div&gt; &lt;% end % </code></pre> <p>My console message:</p> <pre><code>Started GET "/tasks" for 127.0.0.1 at Sat Nov 19 12:27:10 +0530 2011 Processing by TasksController#index as HTML ←[1m←[36mCompany Load (0.0ms)←[0m ←[1mSELECT "companies".* FROM "companies" WHERE "companies"."subdomain" = 'rsgroup' LIMIT 1←[0m ←[1m←[35mUser Load (0.0ms)←[0m SELECT "users".* FROM "users" WHERE "users"."company_id" = 1 ←[1m←[36mTask Load (0.0ms)←[0m ←[1mSELECT "tasks".* FROM "tasks" WHERE "tasks"."assigned_to" = 1←[0m Rendered shared/_page_title.html.erb (0.0ms) Rendered shared/_no_record.html.erb (0.0ms) Rendered tasks/_task_table.html.erb (5.0ms) Rendered shared/_form_error.html.erb (1.0ms) ←[1m←[35mUser Load (0.0ms)←[0m SELECT "users".* FROM "users" Rendered tasks/_form.html.erb (130.0ms) Rendered shared/_sidebar.html.erb (0.0ms) Rendered shared/_payroll_footer.html.erb (1.0ms) Rendered tasks/index.html.erb within layouts/payroll (173.0ms) Completed 200 OK in 253ms (Views: 183.0ms | ActiveRecord: 0.0ms) </code></pre> <p>Here i use j query date picker for calender display.But cause of concern is why my task not saved? please guide me. Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload