nullandvoid (2) [Avatar] Offline
#1
rails version 1.2.5
let's say I have one item in the task list.
when I add a new task it is inserted into the data base. but the xml sent back only contains the previous item.
If i refresh the browser and log back in the new task is in the task datagrid.
my code from the task/create
------------------------------------------------
  • # POST /tasks

  • # POST /tasks.xml

  • def create


    • @task = current_user.tasks.build(params[:task])

    • respond_to do |format|


      • if @task.save


        • format.html do


          • flash[:notice] = 'Task was successfully created.'

          • redirect_to(@task)


        • end

        • format.xml { render smilieml => @task.to_xml, :status => :created, :location => @task }


      • else


        • format.html { render :action => "new" }

        • format.xml { render smilieml => @task.errors, :status => :unprocessable_entity }


      • end


    • end


  • end


-----------------------------------------------
I'm still getting a grip on rails. is the new inserted task supposed to be added onto the @task? or does @task need to be rebuilt?

text from console/server when I insert a new task via flex
-----------------------------------------------
Processing TasksController#create (for 127.0.0.1 at 2007-11-01 10:07:07) [POST]
Session ID: 4075c2d9d9cae373ea6d6986e724e913
Parameters: {"format"=>"xml", "action"=>"create", "task"=>{"name"=>"thity", "project_id"=>"0", "location_id"=>"0", "notes"=>"five"}, "controller"=>"tasks"}
SQL (0.000000) SET SQL_AUTO_IS_NULL=0
User Columns (0.000000) SHOW FIELDS FROM users
User Load (0.000000) SELECT * FROM users WHERE (users.`id` = 1) LIMIT 1
Task Columns (0.000000) SHOW FIELDS FROM tasks
SQL (0.016000) BEGIN
SQL (0.000000) INSERT INTO tasks (`completed`, `name`, `project_id`, `updated_at`, `next_action`, `location_id`, `notes`, `user_id`, `created_at`) VALUES(0, 'thity', NULL, '2007-11-01 10:07:07', 0, NULL, 'five', 1, '2007-11-01 10:07:07')
SQL (0.063000) COMMIT
Completed in 0.17200 (5 reqs/sec) | Rendering: 0.00000 (0%) | DB: 0.07900 (45%) | 201 Created [http://127.0.0.1/tasks.xml]
-----------------------------------------------

text from debug flex debug window when new task is inserted
-----------------------------------------------
[Thu Nov 1 10:07:07 GMT-0500 2007] TaskCreateBox#handleTaskCreateResult:

<task>

<completed type="boolean">false</completed>

<created_at type="datetime">2007-11-01T10:07:07-05:00</created_at>

<id type="integer">32</id>

<location_id type="integer"/>

<name>thity</name>

<next_action type="boolean">false</next_action>

<notes>five</notes>

<project_id type="integer"/>

<updated_at type="datetime">2007-11-01T10:07:07-05:00</updated_at>

<user_id type="integer">1</user_id>

</task>

[Thu Nov 1 10:07:07 GMT-0500 2007] MainBox#handleTasksListResult:

<tasks>

<task>

<completed type="boolean">false</completed>

<created_at type="datetime">2007-10-30T10:23:42-05:00</created_at>

<id type="integer">1</id>

<location_id type="integer">1</location_id>

<name>test</name>

<next_action type="boolean">true</next_action>

<notes>notes for new tasks</notes>

<project_id type="integer">1</project_id>

<updated_at type="datetime">2007-10-30T10:23:42-05:00</updated_at>

<user_id type="integer">1</user_id>

</task>

</tasks>
-----------------------------------------------
peterarmstrong (94) [Avatar] Offline
#2
Re: task grid not updateing. i think it's rails fault. page 157
Please ensure you are using Rails 2. Rails 1.2.5 is a version of Rails 1.2.x, not a Rails 2 release candidate.

As of tonight, you can now do this:
C:peterflexiblerailscurrentpomodo>gem install rails -v 1.99.0 --source http://gems.rubyonrails.org --include-dependencies
nullandvoid (2) [Avatar] Offline
#3
Re: task grid not updateing. i think it's rails fault. page 157
Thanks. I hadn't really looked around on how to get Rails 2 RC.
After I posted that question I really hadn't worked with the flex app. Yesterday I fired the flex app up and the Data grid are updating. I am still on Rails 1.2.5

Thanks again for the rails 2 rc link.

John