Displaying 20 results from an estimated 21 matches for "columns_hash".
2008 Aug 27
11
find_by_sql and xml_serializer problems
Hi,
I''m doing a find_by_sql and am getting an odd error when trying to
render the result to xml.
The find is:
children_list = find_by_sql("SELECT components.componentid,
components.logicalname, versions.level, versions.branch,
versions.sequence FROM components, versions where
components.componentid = ''" + component_id + "''" + " AND
2006 May 31
2
ActiveRecord and database metadata. How much can I get?
All,
I have need of getting at some underlying database metadata for
ActiveRecord descendants.
Does anyone know if I can get access to the following attributes of the
underlying column for a given ActiveRecord object:
Is it a currency object?
Is it nullable?
Is it a signed int?
Is it searchable?
Column length
Column name
Column precision
Column scale
Column data type - how specific can I get
2005 Dec 30
3
Too many columns for list.rhtml to display on one page
I''ve gone once through the Agile book and am now attempting my own rails
app. I''ve created a table named ''volunteers'' with over 15 columns. The
problem is the default list.rhtml that is created with the scaffold,
shows all the columns. I only want to show 4 of them with the list
view.
Where would I start to only return a handfull of columns to the
2008 Mar 03
2
how can i know type of attribute with active record
Hello,
In my database, I have a table "products" with attributes :
- id
- title ->string
- desc -> text
I use active record, but I don''t know why recover the type of this
attribute with active record?
I try attributes_before_type_cast but I don''t see the type
Can you help me?
Excuse for my english (I''am a young student french)
--
Posted via
2007 Mar 01
1
ActiveRecord::StatementInvalid error
...ems/1.8/gems/activerecord-1.15.1/lib/active_record/
connection_adapters/sqlite_adapter.rb:210:in `columns''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/
base.rb:760:in `columns''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/
base.rb:768:in `columns_hash''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
session/active_record_store.rb:105:in `setup_sessid_compatibility!
''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
session/active_record_store.rb:79:in `find_by_session_id''
/usr/l...
2005 Apr 26
2
SQLite error
...tion''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.10.1/lib/active_record/base.rb:235:in
`connection''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.10.1/lib/active_record/base.rb:614:in
`columns''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.10.1/lib/active_record/base.rb:619:in
`columns_hash''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.10.1/lib/active_record/base.rb:636:in
`column_methods_hash''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.10.1/lib/active_record/base.rb:788:in
`method_missing''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.10.1/lib/active_record/base...
2006 Mar 23
11
ActiveRecord: Oracle metadata loading slow on large database
All,
While attempting to use ActiveRecord against a large database, approx.
1700 tables and 4 million rows, I discovered an inefficiency in
oci_adapter.rb. The problem seems to be the SQL being generated to
lazy-load the columns metadata. "def columns(table_name, name = nil)"
method generates the following SQL:
select column_name, data_type, data_default, nullable,
2012 Jul 18
5
Any comment on adding #cast and #cast! to ActiveRecord::Relation?
Not getting any love (tender or otherwise) on my pull
request<https://github.com/rails/rails/pull/7035>so I thought you
folks might like to chip in. What do you think?
#cast and #cast! allow you to declare a mapping from generated column names
to simplified
database column types (i.e. those used in migrations). This way scopes with
columns generated in their select lists can also include
2006 Jan 30
1
how to get column_for_attribute?
Hi all,
In the code below I don''t understand:
1. Why I have to prepend overriden method content_columns with "self."
to get it working?
2. Why column_for_attribute method is not working (no such method?) even
if SomeTable is subclass of ActiveRecord::Base which have public
column_for_attribute method?
> class SomeTable < ActiveRecord::Base
>
> def
2009 Jan 03
1
Finding a nested resource's 'parent' object?
Say I have this setup:
class Ticket < ActiveRecord::Base
belongs_to :project
end
map.resources :projects do |p|
p.resources :tickets
end
How would I go about programatically figuring out that Ticket is
nested under Project?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
2006 Mar 29
2
AR 1.14 oracle_adater.rb does not work
the error is :
wrong number of arguments (1 for 0)
where :
active_record/connection_adapters/oracle_adapter.rb:53:in
`attributes_with_quotes_pre_oracle''
this method is new, it was an alias in the previous version :
alias :attributes_with_quotes_pre_oci :attributes_with_quotes
#:nodoc:
I replaced the method by the alias of the previous version, and it is
working fine.
This is
2005 Mar 07
3
exclude an attribute from save
Hi,
I''ve used .save to save the attributes, but on my table there is an
autoincrementing id (not the primary key) that doesn''t need to be
inserted... but save try to INSERT it anyway... is there a way to
avoid save from acting this way or to whisper him to be more polite
this time? ;)
Thanks,
Enrico
--
"The only thing necessary for the triumph of evil
is for good men to do
2006 Jul 08
1
Need Help Understanding Situation with Table Columns
...es_inclusion_of(:type,
:in => 0..4,
:message => "should be a valid abcRealty Map type")
def self.allMapPoints
# Gmap.find(:all,
# :order => "description asc")
results = find_by_sql("select id, description from gmaps WHERE 1")
pp results[0]
pp(Gmap.columns_hash[''type''])
results
end
Note that I cannot get the ''find :all'' statement to work. It yields a failure:
SyntaxError in City mapController#index
(eval):1:in `compute_type'': compile error
(eval):1: parse error, unexpected tINTEGER
Object::0...
2006 Nov 04
0
Problems with ActiveRecord, Oracle adapter, find_by_sql, multi-table join - ORA-04043 error
...lib/active_record/con
nection_adapters/oracle_adapter.rb:
361:in `columns''
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/bas
e.rb:696:in `columns''
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/bas
e.rb:704:in `columns_hash''
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/bas
e.rb:1562:in `column_for_attribute''
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/bas
e.rb:1801:in `read_attribute''
from
c:/ruby/lib/ruby/ge...
2006 Nov 20
4
Production RAILS_ENV / DB Selection
...act/connection_specification.rb:78:in
`connection''
/var/www/gorchie/releases/20061120100506/config/../vendor/rails/activerecord/lib/active_record/base.rb:760:in
`columns''
/var/www/gorchie/releases/20061120100506/config/../vendor/rails/activerecord/lib/active_record/base.rb:768:in
`columns_hash''
/var/www/gorchie/releases/20061120100506/config/../vendor/rails/activerecord/lib/active_record/base.rb:1020:in
`find_one''
/var/www/gorchie/releases/20061120100506/config/../vendor/rails/activerecord/lib/active_record/base.rb:1011:in
`find_from_ids''
/var/www/gorchie/relea...
2006 Sep 08
1
(Probably Easy) ActiveRecord help needed!
...lumns'': undefined method `each'' for #<Mysql:0x2cf2270>
(NoMethodError)
from
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/base.rb:696:in
`columns''
from
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/base.rb:704:in
`columns_hash''
from
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/base.rb:1562:in
`column_for_attribute''
from
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/base.rb:1362:in
`id''
[the stack continues downward to my own *.rb file]
Even...
2006 Aug 04
0
How to make prefix_sessions recognizable?
...s/activerecord-1.14.3/lib/active_record/connection_adapters/mysql_adapter.rb:292:in
`columns''
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/base.rb:696:in
`columns''
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/base.rb:704:in
`columns_hash''
/opt/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/session/active_record_store.rb:103:in
`setup_sessid_compatibility!''
/opt/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/session/active_record_store.rb:77:in
`find_by_session_id'&...
2006 Jul 05
2
Serialized object behaves weird
Hi!
I got a class named EinsatzFilter which I serialized to session. Before
saving to session it works afterwards I keep getting the message:
"undefined method `to_s'' for #<Person:0x38c6ab8>". "Person" is a from
ActiveRecord::Base inherited class.
Code:
class EinsatzFilter
include ApplicationHelper
attr_reader :personen, :monat, :projekte, :kunde
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 Apr 26
5
accessing created_on causes type error
I assume that this is some newbie stupidity, but I haven''t found my
way around this problem. I have an ActiveRecord object fetched
from the database, and I need to evaluate the contents of the
updated_on field. However, *any* attempt to access that data in the
program results in a TypeError with the message ''no implicit conversion
from nil to integer''.
cust =