Hello All,
Several of my Rails apps on a server broke all at once. Specifically,
any forms that POST no longer work; NULL values are being submitted
instead of the form parameters. I've checked with Firebug that the
forms themselves are sending the values but the "create" action in all
my controllers does not seem to be picking up the form values. I was
hoping somebody could help me troubleshoot. These apps were all
working at some point but just broke all of a sudden. I've asked my
hosting provider if they changed anything but they claim no. Below
are my environment details as well as model, view, controller and
relevant development.log entries.
I appreciate any help!
#--guest_book.html.erb (view)
<% form_for(Comment.new) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :name, 'Name:' %><br />
<%= f.text_field :name, :class => 'required' %>
</p>
<p>
<%= f.label :body, 'Message:' %><br />
<%= f.text_area :body, :class => 'required' %>
</p>
<p>
<%= f.submit "Submit" %>
</p>
<% end %>
#--comments_controller.rb (controller)
# GET /comments/new
# GET /comments/new.xml
def new
@comment = Comment.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @comment }
end
end
# POST /comments
# POST /comments.xml
def create
@comment = Comment.new(params[:comment])
@comment.approved = '1'
@comment.ip_address = request.remote_ip
geo = GeoIP.new("#{RAILS_ROOT}/app/geoip/GeoLiteCity.dat")
g = geo.city(request.remote_ip)
@comment.city = g[7]
@comment.state = g[6]
@comment.country = g[4]
logger.debug "New comment: #{@comment.attributes.inspect}"
logger.debug "Comment should be valid: #{@comment.valid?}"
logger.debug "NEW FORM SUBMISSION: #{params.inspect}"
logger.debug "RAW POST: #{request.raw_post}"
respond_to do |format|
if @comment.save
flash[:notice] = "Thank you #{@comment.name} for signing our
Guest Book!"
#EmailNotifications.deliver_new_comment_added(@comment)
format.html { redirect_to(:back) }
format.xml { render :xml => @comment, :status
=> :created, :location => @comment }
else
format.html { render :action => "new" }
format.xml { render :xml => @comment.errors, :status
=> :unprocessable_entity }
end
end
end
#--comment.rb (Model)
class Comment < ActiveRecord::Base
end
#--development.log
Processing CommentsController#create (for 76.14.68.221 at 2009-10-28
14:42:53) [POST]
Parameters: {"comment"=>nil, "commit"=>"Submit",
"authenticity_token"=>"CazFmdyMNnd3i+z0xH2GPgS7yumT0E/rZar0ofLSvSE="}
e[4;36;1mComment Columns (6.6ms)e[0m e[0;1mSHOW FIELDS FROM
`comments`e[0m
Comment crap
New comment: {"name"=>nil, "city"=>nil, "created_at"=>nil,
"country"=>nil, "body"=>nil, "updated_at"=>nil, "approved"=>nil,
"state"=>nil, "ip_address"=>nil}
Comment should be valid: true
NEW FORM SUBMISSION: {"comment"=>nil, "commit"=>"Submit",
"authenticity_token"=>"CazFmdyMNnd3i+z0xH2GPgS7yumT0E/rZar0ofLSvSE=",
"action"=>"create", "controller"=>"comments"}
RAW POST: authenticity_token=CazFmdyMNnd3i%2Bz0xH2GPgS7yumT0E
%2FrZar0ofLSvSE%3D&comment%5Bname%5D=Hey+Now+Name&comment%5Bbody%5D=Hey
+Now+Message&commit=Submit
e[4;35;1mSQL (0.8ms)e[0m e[0mBEGINe[0m
e[4;36;1mComment Create (1.1ms)e[0m e[0;1mINSERT INTO `comments`
(`name`, `city`, `created_at`, `body`, `country`, `updated_at`,
`approved`, `ip_address`, `state`) VALUES(NULL, 'San Francisco',
'2009-10-28 21:42:53', NULL, 'United States', '2009-10-28 21:42:53',
1, '76.14.68.221', 'CA')e[0m
e[4;35;1mSQL (50.4ms)e[0m e[0mCOMMITe[0m
Redirected to back
Redirected to http://www.example.com/guest-book
Completed in 71ms (DB: 62) | 302 Found [http://www.example.com/
comments]
e[4;36;1mSQL (0.9ms)e[0m e[0;1mSET NAMES 'utf8'e[0m
e[4;35;1mSQL (2.5ms)e[0m e[0mSET SQL_AUTO_IS_NULL=0e[0m
#--Environment
Phusion Passenger: 2.2.5
rails -v
Rails 2.3.0
ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
gem -v
1.3.5
gem list
actionmailer (2.3.0, 2.2.2, 2.1.2, 2.1.1, 2.1.0, 2.0.5, 2.0.2)
actionpack (2.3.0, 2.2.2, 2.1.2, 2.1.1, 2.1.0, 2.0.5, 2.0.2)
actionwebservice (1.2.6, 1.2.3)
activerecord (2.3.0, 2.2.2, 2.1.2, 2.1.1, 2.1.0, 2.0.5, 2.0.2)
activeresource (2.3.0, 2.2.2, 2.1.2, 2.1.1, 2.1.0, 2.0.5, 2.0.2)
activesupport (2.3.2, 2.3.0, 2.2.2, 2.1.2, 2.1.1, 2.1.0, 2.0.5, 2.0.2)
acts_as_taggable (2.0.2, 1.0.4)
ajax_scaffold_generator (3.1.11, 2.2.1)
archive-tar-minitar (0.5.2, 0.5.1)
auth_generator (2.0.1, 1.5.3)
Bloglines4R (0.1.0)
BlueCloth (1.0.0)
builder (2.1.2, 2.0.0)
camping (1.5)
capistrano (2.5.1, 2.1.0, 1.4.1)
classifier (1.3.1)
cmdparse (2.0.2, 2.0.0)
curb (0.1.4)
daemons (1.0.9)
facets (2.2.1, 1.8.54)
fastthread (1.0.1)
feedtools (0.2.29, 0.2.28)
ferret (0.11.6, 0.11.4)
flickr (1.0.2)
gd2 (1.1.1, 1.1)
gen (0.41.0)
geoip (0.8.1, 0.6.1)
geokit (1.4.1)
gettext (1.90.0)
glue (0.41.0)
gnuplot (2.2)
gravtastic (2.0.0)
gruff (0.3.1)
haml (2.0.3)
hoe (1.5.1)
hpricot (0.6)
htmltools (1.10)
localization_generator (1.0.8)
login_generator (1.2.2)
madeleine (0.7.3)
mechanize (0.7.6)
mini_magick (1.2.3)
mysql (2.7)
needle (1.3.0)
net-sftp (1.1.1)
net-ssh (1.1.2)
nitro (0.41.0)
og (0.41.0)
packet (0.1.14)
PageTemplate (2.2.0)
ParseTree (2.1.1)
payment (1.0.1)
pdf-writer (1.1.8)
podcast (0.0.4)
rack (1.0.0, 0.9.1)
radiant (0.6.9)
rails (2.3.0, 2.2.2, 2.1.2, 2.1.1, 2.1.0, 2.0.5, 2.0.2)
rake (0.8.4, 0.8.3, 0.8.2)
RedCloth (3.0.4)
rfacebook (0.9.8)
rmagick (1.15.14)
rspec (1.1.3)
ruby-breakpoint (0.5.1)
ruby-debug (0.10.0)
ruby-yadis (0.3.4)
ruby_odeum (0.4.1)
rubyforge (0.4.5)
RubyInline (3.6.7)
rubyist-aasm (2.0.5)
rubypants (0.2.0)
rubyzip (0.9.1)
ruport (1.6.0)
ruport-util (0.14.0)
ruwiki (0.9.3)
salted_login_generator (2.0.2)
shipping (1.5.1)
SimpleSearch (0.5.0)
sqlite3-ruby (1.2.4, 1.2.1)
stemmer (1.0.1)
switchtower (1.0.1)
syntax (1.0.0)
tagtools (0.0.3)
tidy (1.1.2)
tzinfo (0.3.8)
unicode (0.1)
uuidtools (1.0.3)
webgen (0.4.7)
wee (0.10.0)
xhtmldiff (1.0.0)
xml-simple (1.0.11)
ym4r (0.6.1)
youtube-g (0.4.9.9)