search for: sql_type

Displaying 20 results from an estimated 20 matches for "sql_type".

2006 Feb 05
0
Enum patch for Rails
...================================================================ --- activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb (revision 3486) +++ activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb (working copy) @@ -18,7 +18,7 @@ @sql_type = sql_type # have to do this one separately because type_cast depends on #type @default = type_cast(default) - @limit = extract_limit(sql_type) unless sql_type.nil? + @limit = extract_limit_or_enum_values(sql_type) unless sql_type.nil? @primary = nil...
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
2007 Aug 24
0
ArgumentError: interning empty string and enum-column plugin
...abel''). This causes the mysql_adapter.rb section of the plugin to throw a "ArgumentError: interning empty string" error in this section of code: [code] class MysqlColumnWithEnum < MysqlColumn include ActiveRecordEnumerations::Column def initialize(name, default, sql_type = nil, null = true) if sql_type =~ /^enum/i values = sql_type.sub(/^enum\(''([^)]+)''\)/i, ''\1'').split("'',''").map { |v| v.intern} default = default.intern if default and !default.empty? end s...
2006 Aug 02
3
Active Record
I want to build a one page finance calculator in Rails. The form has several fields on it. When I press the calculate button it will return to the same page with the answer. If there is an error it will also return to the same page with the appropriate error messages. I want it to be able to 1. Carry over all the values on the form fields 2. Use the rails validation methods How can I acheive
2006 Jul 21
2
Tableless ActiveRecord attribute and my aching head
...got me up and running http://rails.techno-weenie.net/tip/2005/11/19/validate_your_forms_with_a_table_less_model This was the class definition I ended up with: ------------------------------------- class Setup < ActiveRecord::Base def self.columns() @columns ||= []; end def self.column(name, sql_type = nil, default = nil, null = true) columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, sql_type.to_s, null) end ... column :turn, :integer ... def change_turn if turn==0 turn = 1 else turn = 0 end end end --------------------------------...
2006 Aug 16
3
Validate your forms with a table-less model
...#39; else flash[:notice] = ''Query was not successfully created.'' redirect_to :action => ''contactus'' end end This my contacts model class: class Contact < ActiveRecord::Base def self.columns() @columns ||= []; end def self.column(name, sql_type = nil, default = nil, null = true) columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, sql_type.to_s, null) end column :name, :string column :contact_details, :string column :subject, :string column :query, :string validates_presence_of :name, :contact_details...
2008 Dec 05
1
ActiveRecord Oracle and nvarchar2 or nclob datatype
Hi, I ve got oracle database which exists prior to my rails app... :-( I ve got trouble when I am updating/inserting records of a table which includes nvarchar2 attributes. These have a specific maximum length. I often get an error Value too long for column when doing my inserts/ updates, but in fact that is not the case. I ve taken a look at the generated sql statements.... As far as I know
2006 Sep 09
1
Getting Valid ENUM Values in ActiveRecord
...eRecord::Base level. I have the following function, which works if placed in the individual class level (if there is a more efficient way to do it let me know): ===================== def get_enum_values(column_name) self.connection.columns(MyClass.table_name).each { |column| return column.sql_type.gsub("enum(''", "").gsub("'')", "").split("'',''") if column.name == column_name and column.sql_type[0...4] == "enum" } return [] end ===================== The problem is that I have to explicitly cal...
2006 Apr 26
4
Re: Rails AR/Oracle Unit Test: [4280] failed
The revised patch submitted on #4748 broke the build, I''m looking to sort out why. Also note that this auto-test email didn''t make it to rails-core because it was too big (every test failed, so the resulting email was huge). I''ll patch my auto-testing script to truncate the email to no larger than a few kb. Michael Schoen wrote: > "marcel" made
2006 Jun 27
4
Not Active Record Model Validation
I have a problem with ruby on rails validation total_book_toy.rhtml ================ <%= text_field ''book1'', ''title1'' %> <%= text_field ''book2'', ''title2'' %> I want to validate these text_field so user can''t insert same title. However, I was stuck how to do it. Or maybe you have another way how to do it.
2007 Mar 17
4
Created_on and updated_on in a non-ActiveRecord model
...de below). So… is there any way to do it automatically? Thanks. ******* [1] http://wiki.rubyonrails.org/rails/pages/HowToUseValidationsWithoutExtendingActiveRecord , Alternative 2. CODE: class PageMetadata < ActiveRecord::Base def self.columns() @columns ||= []; end def self.column(name, sql_type = nil, default = nil, null = true) columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, sql_type.to_s, null) end column :abstract, :string column :title, :string column :created_on, :datetime column :updated_on, :datetime validates_presence_of :abstract validates_le...
2006 Mar 01
5
validations without AR - going crazy trying to find link
Hi, in the past few months someone posted an entry on their blog about how to do validations in non-AR classes and I cant find it any more. Anyone have a link? Thanks, Trevor -- Trevor Squires http://somethinglearned.com
2006 Jun 06
1
How to find the column type?
Journal.column_names returns the names of the columns in a table. How would I determine the type of a column? I tried: Journal.sql_types. ( didn''t work). hints, please. -- Best Regards, -Larry "Work, work, work...there is no satisfactory alternative." --- E.Taft Benson -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/att...
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 School'',''Some College'',''Associates Degree'',''Bachelors Degree'',''Some Grad School'',''Masters Degree'',''PhD Candid...
2008 Feb 20
0
Unicode Support for MS SQL Server
...%S")}''" when Date then "''#{value.strftime("%Y%m %d")}''" when String, ActiveSupport::Multibyte::Chars qvalue = super qvalue = "N#{qvalue}" if !column.nil? && column.sql_type =~ /\Anvarchar/ qvalue else super end end This passed the several tests I wrote for it and otherwise seemed to pass the couple of AR tests I ran against it. (There''s another nice bug in the SQL Server adapter that puts the value ''N...
2006 Jul 08
1
Need Help Understanding Situation with Table Columns
...r options #<Gmap:0x38b31a8 @attributes={"id"=>"1", "description"=>"City: Palo Alto, CA"}> #<ActiveRecord::ConnectionAdapters::MysqlColumn:0x38bee60 @default=0, @limit=4, @name="type", @null=false, @number=true, @primary=false, @sql_type="tinyint(4)", @text=false, @type=:integer> At first I thought I had corrupted something when I added the ''type'' column to the gmaps table using phpMyAdmin. (I also reran the scaffold generator to update that; recall my app is like the Depot app in AWDwR.) The...
2006 Jul 07
5
link_to: link is missing id
I''m using a legacy table, where the unique id is not ''id'' I have a Model class like the following: class Article < ActiveRecord::Base set_primary_key "ARTICLE_ID" end however, using a link_to like the following (modified scaffolding), the link has no id value: <% for article in @articles %> <tr> <% for column in
2006 Jan 31
11
ez_where plugin updated features.
Friends- I wanted to let people know that there is a new experimental release of this plugin. I would love feedback on syntax and features. There is now a full test suite with fixtures that covers all the available syntax. Look at the test suite for more syntax possibilities. There have been many additions since my last release. Fabien Atelier has been working on this with me and has
2010 Dec 23
36
Weird issue with converting floats to integer
Any idea why this calculates the integer the way it does? irb> ("291.15".to_f * 100.0).to_i => 29114 Thanks, Tom -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to
2008 Jul 09
11
script/generate scaffold user
NameError in UsersController#index uninitialized constant UsersController::User RAILS_ROOT: C:/RailsApps/rgams Application Trace | Framework Trace | Full Trace c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:492:in `const_missing'' app/controllers/users_controller.rb:5:in `index''