similar to: New MySQL behaiour for :null => false

Displaying 20 results from an estimated 100000 matches similar to: "New MySQL behaiour for :null => false"

2006 Sep 13
3
How to avoid AR confusing way of handling default values for attributes w/ :null => false
How can I avoid AR confusing way of handling default values for attributes w/ :null => false? This issue came up before, but I could not find an answer that resolves the issue, which I outline below: First, I add a test table using migrations: class AddTestTable < ActiveRecord::Migration def self.up create_table "users", :force => true do |t| t.column
2005 Dec 15
4
rake migrate ignores '':null => false'' on mysql
I wanted to add a login string column to an existing table => I created a migration : ... def self.up add_column "members", "login" , :string, :null => false end ... remark: it shouldn''t work, as the table is not empty (=> ''login'' would be null in the existing rows.) problem: rake migrate didn''t complain
2007 Oct 22
1
self-referential habtm: why are my keys null?
I''m trying to set up a directional self-referential HABTM to represent an arbitrary semi-hierarchical structure; it works for any data prepopulated into the db, but when I try to create a new relationship, I just get NULLs in both key columns (or 0''s if I turn on the no-null constraint). Here are the migrations: class CreateNodes < ActiveRecord::Migration def self.up
2008 Oct 23
2
cPanel RoR with mySQL database
Hi, I have just started using Ruby on Rails with cPanel. I can set up my application ok but I am having problems with linking the application with a mysql database. I have run ruby sctipt/generate model and created the table through the migration. The table appears in the database correctly. The original settings were for sqlite3 but I want to use mysql so that may be the issue. I have changed
2006 Aug 22
5
Creating mysql triggers with migrations blows up
def self.up execute("delimiter ^ ") sql = <<-_SQL CREATE TRIGGER customer_bi BEFORE INSERT ON customers FOR EACH ROW BEGIN SET NEW.sndx = SOUNDEX(NEW.lname) ; END ^ _SQL sql.split(''^'').each do |stmt| execute(stmt) if (stmt.strip! && stmt.length > 0) end execute("delimiter ;
2006 Oct 15
3
Migrations - add_column :default=>true, :null=>false
This seems pretty brain dead: add_column :types, :notify_on_create, :boolean, {:default=>true, :null=>false} $ rake migrate Error: ERROR: column "notify_on_create" contains null values : ALTER TABLE types ALTER notify_on_create SET NOT NULL Why doesn''t Rails set the new column to true, as it''s supposed to default to? I tried :default=>1 as well (same
2006 Oct 13
5
Insert NULL into MySQL "time" not 00:00:00
Ok I''m not sure what I''m doing wrong, but I have a table that holds a bunch of times, however when I don''t fill in the text box that passes it''s input on to the variables, rails defaults to 00:00:00, which is bad, because that''s midnight. I''m pretty sure I''m doing somethign wrong, and I''m even thinking of using the
2007 May 06
0
MySQL adapter bug? Date col being set to NULL when default is 0000-00-00
Ok, simple case. MySQL table with date column. The date column default is 0000-00-00. When I view these rows in say SQLyog, all rows in this table have value of 0000-00-00. by default. ..... Now, onto my Rails app. I don''t even care about the date column described above. I am attempting to update an entirely different column in the same table. However, when I use an active record to
2006 Dec 22
0
Problems with MySQL Replication and Migrations
Does anyone have MySQL replication set up for a Rails App that uses migrations? I''m having an issue where every time I run a migration Rails is trying to create the schema_info table. Mysql::Error: Table ''schema_info'' already exists: CREATE TABLE schema_info (version int(11)) This causes a problem on the slave databases where the replicated create table statement
2008 Nov 25
1
migration error, mysql, change column limit
Hmm, one of my migrations have stopped working on #down. It still works on #up. (It''s also possible that I never tested it for #down before, and it never worked, heh.) I can''t figure out why not. Pretty simple. class WidenRequestParams < ActiveRecord::Migration def self.up change_column :requests, :params, :string, :limit => 2048 end def self.down
2008 May 11
8
From "schema.rb" file to MySQL
Hello, I have write a schema.rb database such as this: ActiveRecord::Schema.define do create_table :arts do |t| t.string :name, :null => false, :limit => 45 end end This file is saved into test/db/schema.rb, and test/config/database.yml is correctly configured with "test_development" database created in a MySQL server. Could you help me to install the content of
2009 Jan 12
2
validates_presence_of fails with false boolean
This almost feels like a bug to me, since false is not nil. (i don''t think!) Using v_p_o on a boolean field fails validation if the field is passed with ''false''. It passes validation in the case of true. How can I validate _presence_of a boolean if it is submitted false? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~
2006 Sep 27
0
MySQL and Default values
I got my first taste today of dealing with the default values in MySQL. It seems that Rails loads the default values for fields based on the database (seems reasonable, specify in one place and let if flow through). The problem is that if I say NOT NULL and do not specify a default value, MySQL inserts a default value anyway. See http://dev.mysql.com/doc/refman/5.0/en/data-type-defaults.html
2009 Mar 03
6
Rails 2.2.2 - Mysql::Error: MySQL server has gone away
My app consists of receiving emails with image attachments from its users so I have been employing the MMS2R gem and Fetcher. Every 60 seconds the app goes to the email server to fetch emails. Under Rails 2.1.1 things worked fine - when I received an email, the email was fetched, parsed and saved to the database. However I needed to upgrade to Rails 2.2.2 for unrelated reasons and now I get the
2007 Dec 22
3
Formatting looping display from mySQL table
Hi I''m a noob to RoR. I have everything setup but can''t figure out to get the list display as I would like. I''m sure this is very simple stuff. I just haven''t figured it out yet :( I hope someone can point me in the right direction :) I have a mysql table "websites". In it I have the following columns - Name, Url, Banner, Description I created
2006 Sep 07
1
gem mysql buggy on Win32
Hi, Just running a simple unit test and trying to save an object gives me this error. test_validations(FriendTest): NoMethodError: undefined method `each'' for #<Mysql:0x38f60d0> c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/mysql_a dapter.rb:292:in `columns'' .... .... Rails 1.1.6 mysql 5 mysql gem 2.71 After I
2009 Mar 05
2
Can't connect to local MySQL server through socket...
I just did an unwanted mysql upgrade and am now unable to start the mysql service. After doing some searching the common solution is to just create a symlink ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock The issue for me is I don''t have the file I am trying to symlink to (/var/run/mysqld/mysqld.sock) If I try to start mysql manually (mysql start) I get the error: # mysql start
2009 Jan 14
1
MissingSourceFile (no such file to load -- mysql)
I''m having problem trying to get the app running properly due to it not finding MySQL.It seems that the app can''t find mysql. This error shows up on my production log: MissingSourceFile (no such file to load -- mysql) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the
2008 Sep 03
0
saving to mysql while displaying a partial that calls for the list of mysql items lags
Hi, Originally this was part of my highlighting question but now after debugging and slicing up the problem i found that the problem was not rjs but that saving to database does not sync with the ajax partial Controller code: ____________________________________________ def add_to_cart @sguser = Sguser.find(params[:ad]) @lineprice = SglineItem.find(:all, :conditions => "sguser_id =
2007 Nov 06
1
Difference with :null
Which is the difference between *:null => true* and *:default => nil*? If a field is going to be optional, which option of those would be the best? *t.string :optional, :null => true* or *t.string :optional, default => nil* --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk"