This project is archived and is in readonly mode.
problem with renderiong
Reported by setsunaruu | August 5th, 2010 @ 07:30 PM
I'm create scaffold for table people, than i remove action show
like this
# POST /people # POST /people.xml def create
@person = Person.new(params[:person])
@person.create_datum(params[:datum])
respond_to do |format|
if @person.save
format.html { redirect_to :action => 'index' }
format.xml { render :xml => @person, :status => :created, :location => @person }
else
format.html { render :action => "new" }
format.xml { render :xml => @person.errors, :status => :unprocessable_entity }
end
end
end
# PUT /people/1 # PUT /people/1.xml def update
@person = Person.find(params[:id])
respond_to do |format|
if @person.datum.update_attributes(params[:datum]) && @person.update_attributes(params[:person])
format.html { redirect_to :action => 'index' }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @person.errors, :status => :unprocessable_entity }
end
end
end
I create a new person on page 'new', then redirect to 'index'
(on development)
When I run it into production (mongrel_rails + lighttpd) I'm going
to go on blank page.
In log file this look like
development:
Processing PeopleController#new (for 127.0.0.1 at 2010-08-05
22:24:50) [GET]
[4;36;1mPerson Columns (1.4ms)[0m [0;1mSHOW FIELDS FROM
people
[0m Rendering template within layouts/people
Rendering people/new
Rendered people/_person_form (61.3ms)
Completed in 70ms (View: 64, DB: 2) | 200 OK [http://localhost/people/new]
[4;35;1mSQL (0.1ms)[0m [0mSET NAMES 'utf8'[0m [4;36;1mSQL
(0.1ms)[0m [0;1mSET SQL_AUTO_IS_NULL=0[0m
Processing PeopleController#create (for 127.0.0.1 at 2010-08-05
22:24:53) [POST]
Parameters: {"person"=>{"permalink"=>"asdfsadf"},
"commit"=>"Создать",
"authenticity_token"=>"YHHhE/vYbwvDa/wN8O6L/KPk71WpcUwxhVdKpU1y4rk=",
"datum"=>{"death(1i)"=>"", "name"=>"", "death(2i)"=>"",
"death(3i)"=>"", "interview"=>"", "birth(1i)"=>"",
"birth(2i)"=>"", "image"=>"", "birth(3i)"=>"",
"work"=>""}} [4;35;1mPerson Columns (2.3ms)[0m [0mSHOW FIELDS
FROM people
[0m [4;36;1mPersonDatum Columns (1.5ms)[0m
[0;1mSHOW FIELDS FROM person_data
[0m [4;35;1mSQL
(0.3ms)[0m [0mBEGIN[0m [4;36;1mPersonDatum Create (0.2ms)[0m
[0;1mINSERT INTO person_data
(name
,
birth
, created_at
,
interview
, updated_at
,
person_id
, image
, death
,
work
) VALUES('', NULL, '2010-08-05 18:24:53', '',
'2010-08-05 18:24:53', NULL, '', NULL, '')[0m [4;35;1mSQL
(0.9ms)[0m [0mCOMMIT[0m [4;36;1mSQL (0.1ms)[0m [0;1mBEGIN[0m
[4;35;1mPerson Load (0.2ms)[0m [0mSELECT people
.id
FROM people
WHERE
(people
.permalink
= BINARY 'asdfsadf')
LIMIT 1[0m [4;36;1mPerson Create (0.2ms)[0m [0;1mINSERT INTO
people
(permalink
,
created_at
, updated_at
)
VALUES('asdfsadf', '2010-08-05 18:24:53', '2010-08-05 18:24:53')[0m
[4;35;1mPersonDatum Update (0.2ms)[0m [0mUPDATE
person_data
SET updated_at
= '2010-08-05
18:24:53', person_id
= 20 WHERE id
=
28[0m [4;36;1mSQL (2.0ms)[0m [0;1mCOMMIT[0m Redirected to http://localhost:3000/people
Completed in 24ms (DB: 8) | 302 Found [http://localhost/people]
[4;35;1mSQL (0.1ms)[0m [0mSET NAMES 'utf8'[0m [4;36;1mSQL
(0.1ms)[0m [0;1mSET SQL_AUTO_IS_NULL=0[0m
Processing PeopleController#index (for 127.0.0.1 at 2010-08-05
22:24:53) [GET]
[4;35;1mPerson Load (0.3ms)[0m [0mSELECT FROM
people
[0m Rendering template within
layouts/people
Rendering people/index
[4;36;1mPerson Columns (1.4ms)[0m [0;1mSHOW FIELDS FROM
people
[0m [4;35;1mPersonDatum Load (0.3ms)[0m
[0mSELECT FROM person_data
WHERE
(person_data
.person_id = 17) LIMIT 1[0m
[4;36;1mPersonDatum Columns (1.2ms)[0m [0;1mSHOW FIELDS FROM
person_data
[0m Rendered people/people_list_item
(11.3ms)
[4;35;1mPersonDatum Load (0.3ms)[0m [0mSELECT * FROM
person_data
WHERE (person_data
.person_id
= 18) LIMIT 1[0m Rendered people/people_list_item (2.9ms)
[4;36;1mPersonDatum Load (0.2ms)[0m [0;1mSELECT FROM
person_data
WHERE (person_data
.person_id
= 19) LIMIT 1[0m Rendered people/_people_list_item (2.8ms)
[4;35;1mPersonDatum Load (0.3ms)[0m [0mSELECT FROM
person_data
WHERE (person_data
.person_id
= 20) LIMIT 1[0m Rendered people/people_list_item (2.7ms)
Rendered people/people_list (20.7ms)
Completed in 28ms (View: 20, DB: 4) | 200 OK [http://localhost/people]
production:
Processing PeopleController#new (for 77.88.4.84 at 2010-08-05
22:26:10) [GET]
Rendering template within layouts/people
Rendering people/new
Completed in 29ms (View: 28, DB: 0) | 200 OK [http://aquadev01.yandex-team.ru/people/new]
Processing PeopleController#create (for 77.88.4.84 at 2010-08-05
22:26:14) [POST]
Parameters:
{"commit"=>"Созда?~B?~L",
"authenticity_token"=>"B4RPnGhWSNH28etbX3/xrsiUmEuBznrbJGSTFg/mvBc=",
"datum"=>{"death(1i)"=>"", "name"=>"", "deatt
h(2i)"=>"", "interview"=>"", "death(3i)"=>"",
"birth(1i)"=>"", "birth(2i)"=>"", "image"=>"",
"birth(3i)"=>"", "work"=>""},
"person"=>{"permalink"=>"asdasdasdfasdfasdfasdf"}}
Redirected to http://aquadev01.yandex-team.ru/people
Completed in 53ms (DB: 47) | 302 Found [http://aquadev01.yandex-team.ru/people]
Why /people not renedred?
Comments and changes to this ticket
-
Harm-Jan Blok August 12th, 2010 @ 11:11 AM
Hi,
I had a similar issue where a HTTP POST (create or update action) didn't render the requested page. Within the log file I also didn't see a render request for
/people
(or whatever) after a create or update action. When I used Firebug I saw the HTTP POST returned a 404 response containing the messageYou are being <a href="http://site/people">redirected</a>
. The client never asked the server to render/people
because of the 404 response. Thats why the render request never showed up in the log file.I my case it turned out to be a proxy problem, somehow changing the 302 response into a 404. So my suggestion would be to check if there's a proxy in between which causes this error.
HJ
-
Aditya Sanghi October 18th, 2010 @ 12:55 PM
- State changed from new to invalid
- Importance changed from to Low
Is the log provided above hand-written cos i can see a parameter "deatt h(2i)" which would lead me to believe that you had a failure in your application, perhaps.
This is a very standard and tested functionality of Rails and the problem is more than likely in your local setup. I suggest you use Harm-Jan Blok's suggestion and use Firebug to detect actual return codes and debug intermediate proxies or such like.
I would also suggest you run the same code in your development machine but with RAILS_ENV set to production to see if you get the same error. Also try to see if you get the problem with production settings with mongrel only or with webrick or thin?
Marking the ticket invalid but if you do come across a scenario where there is indeed a Rails problem, we can re-open this ticket. Please provide a failing test and/or a patch in that case.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>