Forum: Ruby on Rails My database model's connection appears messed up.

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
f church (Guest)
on 2006-04-19 04:54
(Received via mailing list)
I am trying to add data from a form, and the rails doesn't appear to be
making
any effort at all. I've put deliberately erroneous data, but still
nothing.
All the development log shows is this.

This is the code in use - based on the example from Rails book

  def add_customer_admin
  	if request.get?
	  	@login = CustomerAdmin.new
	  else
		  @login = CustomerAdmin.new(params[:customer_admin])
		  STDERR.puts params
		  if
		    @login.save
			else
		   # STDERR.puts "shitty outcome"
        redirect_to(:action => :add_customer_admin)
		  end
	  end
  end

I made some changes by doing a global cut and paste after I changed the
tablename, but it still does not explain why there are no errors. I
appears the
is no instruction attemmpting to insert the data into the table

Processing LoginController#add_customer_admin (for 127.0.0.1 at
2006-04-19
01:45:49) [POST]
  Session ID: 34381c7b5af9cb7293c7bed8eddcf935
  Parameters: {"action"=>"add_customer_admin", "controller"=>"login",
"customer_admin"=>{"firstnames"=>"", "adminlogin"=>"zzzzz",
"surname"=>"",
"password"=>""}}
  SQL (0.010000)    SELECT a.attname,
format_type(a.atttypid,
a.atttypmod), d.adsrc, a.attnotnull
 FROM pg_attribute a LEFT JOIN pg_attrdef d
 ON a.attrelid = d.adrelid AND a.attnum = d.adnum
 WHERE a.attrelid = 'customer_admins'::regclass
 AND a.attnum > 0 AND NOT a.attisdropped
 ORDER BY a.attnum

  SQL (0.000000)   BEGIN
  CustomerAdmin Load (0.000000)   SELECT * FROM
customer_admins
WHERE (customer_admins.adminlogin = 'zzzzz') LIMIT 1
  SQL (0.010000)   COMMIT
Redirected to http://localhost:3000/login/add_customer_admin
Completed in 0.38100 (2 reqs/sec) | DB: 0.02000 (5%) | 302 Found
[http://localhost/login/add_customer_admin]


Processing LoginController#add_customer_admin (for 127.0.0.1 at
2006-04-19
01:45:51) [GET]
  Session ID: 34381c7b5af9cb7293c7bed8eddcf935
  Parameters: {"action"=>"add_customer_admin", "controller"=>"login"}
  SQL (0.030000)    SELECT a.attname,
format_type(a.atttypid,
a.atttypmod), d.adsrc, a.attnotnull
 FROM pg_attribute a LEFT JOIN pg_attrdef d
 ON a.attrelid = d.adrelid AND a.attnum = d.adnum
 WHERE a.attrelid = 'customer_admins'::regclass
 AND a.attnum > 0 AND NOT a.attisdropped
 ORDER BY a.attnum

Rendering login/add_customer_admin
Completed in 0.67100 (1 reqs/sec) | Rendering: 0.41100 (61%) | DB:
0.03000 (4%)
| 200 OK [http://localhost/login/add_customer_admin]
This topic is locked and can not be replied to.