similar to: Enum patch for Rails

Displaying 20 results from an estimated 100 matches similar to: "Enum patch for Rails"

2006 Mar 03
0
binary_to_string/string_to_binary confusion
I am attempting to write a FrontBase activerecord adaptor. I''m down to only two unit tests failing, and one of them is binary_test.rb. I can''t figure out the logic of binary to string conversion. Internally, I want the ''data'' attribute to be a String object identical to the contents of BINARY_FIXTURE_PATH = File.dirname(__FILE__) +
2010 May 28
2
Suggestion for improving value_to_boolean column conversion
Hi fantastic rails core developers. Speaking of version 2.3.5: I find it rather error_prone that values such that "some text" is silently converted to false when stored in a boolean DB field. Among other things it means that assign "some text" to boolean fields on a model will not generate any validation messages (it will silently be converted to false). I think it is like
2010 Sep 02
1
ActiveRecord::ConnectionAdapters::Column value_to_boolean(value) does not return a boolean value.
value_to_boolean(value), does not always return a boolean value, only when true. 150: def value_to_boolean(value) 151: if value.is_a?(String) && value.blank? 152: nil 153: else 154: TRUE_VALUES.include?(value) 155: end 156: end If value is contained in TRUE_VALUES then it returns true(TrueClass). But if value is
2007 Oct 07
0
Rails AR/Oracle Unit Test: [7769] failed (getting worse)
"bitsweat" has kicked AR/Oracle while it was down... http://dev.rubyonrails.org/changeset/7769 ------------------------------------------------------------------------ r7769 | bitsweat | 2007-10-06 22:29:37 -0700 (Sat, 06 Oct 2007) | 1 line MySQL: speedup date/time parsing. ------------------------------------------------------------------------ U
2007 Aug 24
0
ArgumentError: interning empty string and enum-column plugin
Hello, I am a developer who has just started working on a large scale website in a team of 5 other developers. One of the developers has introduced some enum columns into the the database. Now, by default, active record doesn''t support enum column types but I have added the enum-column plugin into our project. This has worked very well except for a few instances where he
2010 Jul 16
1
Rails 3 bug: undefined method `<=>' for class `ActiveSupport::Multibyte::Chars'
I''m getting the following bug when I try to run rake db:migrate in Rails 3 beta 4: $ rake db:migrate --trace (in C:/Users/Adam/Documents/Aptana Workspace/QuestionBank) default formats are encoded in ISO-8859-1 ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:migrate == CreateUsers: migrating
2008 Mar 19
2
ActiveRecord bug? ActiveRecord::ConnectionAdapters::Column.type_cast for float columns
Hi all, I just noticed that in ActiveRecord::ConnectionAdapters::Column.type_cast[1] (and type_cast_code[2]) the type casting for float columns simply does value.to_f, whereas all the others have a rescue or call out to a method, the default implementations of which have rescues or enough logic in that I don''t think they''d fail. Imagine the following: create_table :vehicle do
2007 Apr 24
1
strange frozen string problem starting rails
hi, I am experiencing a very strange problem with my Rails installation. I''m using ruby 1.8.6 on Debian Linux, with edge rails. Whenever I try to start mongrel, I get an exception about "can''t modify frozen string". I get a similar exception when I try to do "rake db:migrate". In this case, the exception seems to pop up *after* the migrations do succesfully
2006 Jul 21
2
Tableless ActiveRecord attribute and my aching head
I beat my head against a wall for almost 2 hours with this issue. My first problem was easily solved. I wanted a class that could use ActiveRecord''s validation capabilities but without using a table behind it (I would be persisting setup information in the session, but the initial setup parameters come from a user input form) No problem...found this link which got me up and running
2006 Aug 16
3
Validate your forms with a table-less model
Ive followed this example of how to validate a form with a tableless model: http://rails.techno-weenie.net/tip/2005/11/19/validate_your_forms_with_a_table_less_model Ive got this example working but when validation fails the failed boxes are not highlighted in red. At the moment i have a contact details form and want to validate the information entered by the user but this will just result
2006 Sep 09
1
Getting Valid ENUM Values in ActiveRecord
I know that Rails doesn''t handle database ENUMs. I''d say that 9/10, you can get away with just using varchar instead. However, there ARE instances where you need certain functionality that ENUMs provide (ie: integrity at the datalevel). I have a working function that will show what enum types are available for a certain column in a table (I believe this will only work for
2007 Jun 09
1
Rake test tasks only work with --trace
So this has left me completely confused. I''m trying to get the test suite going on an existing app, but things going a little crazy. In the application directory if I do ''rake'' or ''rake test'' I get: rake aborted! Lost connection to MySQL server during query However if I do ''rake test:units'' or ''rake
2007 Mar 17
4
Created_on and updated_on in a non-ActiveRecord model
Hi you all, I have a model simulating an ActiveRecord model, according to the tips stated in [1]. It is simulated because even though I am gonna save the attributes in a file, not in a DB, I still want the validations made by ActiveRecord::Base (see code below). Well, the thing is that I also want the behaviour of the created_on and updated_on columns, that get modified automatically before
2006 Apr 12
0
Re: Re: Oracle unit test problem in Rails 1.1.2/Ruby-OCI 0.1
> -----Original Message----- > From: rails-bounces@lists.rubyonrails.org > [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Lori Olson > Sent: Tuesday, April 11, 2006 8:04 PM > To: rails@lists.rubyonrails.org > Subject: [Rails] Re: Re: Oracle unit test problem in Rails > 1.1.2/Ruby-OCI 0.1 > > > Wilson Bilkovich wrote: > > On 4/11/06, Lori Olson
2007 Dec 05
0
[CruiseControl] RubyOnRails build 8285 failed
The build failed. CHANGES ------- Revision 8284 committed by marcel on 2007-12-05 14:40:42 Add examples in the documentation for various assertions. Closes #9938 [zapnap] M /trunk/actionpack/CHANGELOG M /trunk/actionpack/lib/action_controller/assertions/response_assertions.rb M /trunk/actionpack/lib/action_controller/assertions/dom_assertions.rb M
2007 Sep 03
0
Change the datatype of an attribute?
Hey everyone I''m building an application that is using a mySQL SET datatype sad The problem is that ActiveRecord thinks this is a date! Here''s the relevant output from Model.columns: #<ActiveRecord::ConnectionAdapters::MysqlColumn:0x351b488 @primary=false, @scale=nil, @sql_type="set(''Any'',''Grade School'',''High
2008 Feb 20
0
Unicode Support for MS SQL Server
In order to coerce Rails 1.2.x into supporting Unicode values for an attribute in a model, I found I had to do the following: 1) Change the underlying column type from varchar to nvarchar. 2) Prepend any quoted values going into nvarchar columns with a capital-letter-N, e. g. ''unicode'' becomes N''unicode'' In order to accomplish this, I modified
2006 Jul 08
1
Need Help Understanding Situation with Table Columns
I am trying to create an application loosely based on the Depot application presented in Agile Web Development with Rails (AWDwR). I am using InstantRails for the server. In my app I have the folowing controllers: admin_controller application_controller city_map_controller (with method: displayGMap) The admin_controller was created with the following command: ruby script/generate scaffold
2006 Jan 19
0
Input date in different format
Hey there, I would like to be able to enter dates in a few different formats. As well as the standard 2006-01-01 format I want to be able to enter it in m/d/yy format (eg 1/1/06 for 2006-01-01), and d mmm yy (eg 1 Jan 06). What''s the simplest way to do this? I had a go at changing ActiveRecord::ConnectionAdapters::Column.string_to_date, and that *seems* to work, but I''m not
2010 Aug 16
2
Form validation and processing w/o model (no Db/ActiveRecord)
All - Trying not to fight rails on this, basically have a form and all the same as would be with an ActiveRecord model except that there is no table. I started out using this article: http://stackoverflow.com/questions/315850/rails-model-without-database ...which is kind of a hack by inheriting ActiveRecord in to non-AR model but am running into some problems and just have the feeling that I am