Displaying 20 results from an estimated 400 matches similar to: "AR class names"
2006 Oct 12
2
Too Many Mysql connections
In my app, for three models: foo,bar and baz, the database connection
is made to a different database and hence in model code:
class Foo < ActiveRecord::Base
establish_connection :diff_database
end
class Bar < ActiveRecord::Base
establish_connection :diff_database
end
class Baz < ActiveRecord::Base
establish_connection :diff_database
end
Now, the problem is, if is use the above
2007 Jan 23
11
dynamic tablenames
Hi List!
May I tap into your combined common sense ?
I have a legacy logging app that needs to be modernized. At the moment,
Data is going to be stored in 5 tables, one table is going to contain
more than 200 million and 2 others about 60 million rows. Mysql will be
used, unless someone sees a major advantage in using something else (at
the moment data is stored in a raw positioned file format,
2011 May 29
4
Model load time
Hi, I''m getting a little confused how Rails handles loading models.
I''m on development mode, using Rails 3.1.0.rc1 on ruby 1.8.7
My application models are:
Curso
Legislacao
Usuario
And I have another model that is loaded from a gem Im trying to build:
Cidade
My gem is actually a simple engine:
require ''active_record''
require
2007 Sep 05
8
Hi..Guys new plugin again
Hi..
Guys new plugin again
Foreign Key Associations is a plugin that automatically creates
associations based on foreign-keys. The associations are created at
runtime-ie. as your ActiveRecord models are loaded-so they will always
be up-to-date.
For example, given a foreign-key from a customer_id column in an
orders table to an id column in a customers table, the plugin
creates:
2008 Jul 05
4
one db - many rails projects -> many schema_migrations table
Hi all!
How can I change the name of the schema_migrations table? I have to do
this because I can only use one database but want to have several rails
projects.
I hope this is possible at all.
greets
flo schaf
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on
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 May 08
4
Tables names with model classes in seperate modules
I have a module that deals with content pages and categories in my
application so create following tables:
content_pages
content_categories
Obviously I need a Page and Category module to map to these tables, but
in order to avoid conflicts with other Category classes, i declare my
model classes like this:
Content::Page
Content::Category
Now, that''s all fine - except that my models
2006 Mar 29
38
Poll: Which distro do you use for Rails/Ruby development?
Good afternoon,
I''ve two quick questions for the Ruby/Rails community.
1) Do you use Linux for Ruby or Rails development?
2) If you use Linux, which distro do you normally use to develop?
Thank you for your input. :-)
--
Posted via http://www.ruby-forum.com/.
2007 Jun 19
2
sequence name prefix
In Postgres, I use different database schemas for each application, by
declaring, e.g.:
class ApplicationController < ActionController::Base
ActiveRecord::Base.table_name_prefix = "keywords."
end
I assumed that the sequence names were also prefixed with the database
schema names, e.g.
keywords.things_id_seq
But Rails 1.2.3 assumes the sequence is *NOT* in the same schema as the
2007 Feb 13
5
default database schema and relationships
hi everyone..
i''m a high school teacher who wrote a webapp in PHP and MySQL for my
curriculum.. i use it to keep attendance, take notes per student or
class and keep track of activities. i would like to soup it up and
have read both the pickax and version 2 of agile web dev...
now i''m starting to work and i''d like to rename columns and
relationships in the database so
2007 Aug 07
4
Execute additional commands after creating database?
I''m writing some code that accesses some lagacy database on
PostgreSQL. Since the old database had some really ughly and weird
naming conventions (like CamelCase). To work around this I created a
second schema (named rails) in the same database and gave the tables
and fields some rails-friendly names. The database user that Rails
uses has its search_path set to the rails schema. That way
2010 Mar 20
1
[PATCH] AR migration generator includes model's modules in table name. [#4230]
Hello! Could someone review the patch attached to [1] and provide
feedback?
Briefly, it targets rails 3, and fixes "rails g model admin/post".
The generated migration creates a "admin_posts" table while the model
expects a table simply named "posts". With the patch, the migration
creates "posts".
Thank you!
--phil--
[1]
2005 Mar 01
4
PostgreSQL Schema and Rails
Hey all,
I am curious about how Rails interacts with SCHEMAs in PostgreSQL. From
the generate command, is it possible to setup a scaffold for a table not
in the public. schema in PostgreSQL?
As a test, I tried,
./script/generate scaffold Manage.Form Manage.Form
No dice.
Any suggestions?
-Robby
--
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON
2006 Sep 25
2
Splitting a character variable into a numeric one and a character one?
Hi All,
I have a data with a variable like this:
Column 1
"123abc"
"12cd34"
"1e23"
...
Now I want to do an operation that can split it into two variables:
Column 1 Column 2 Column 3
"123abc" 123 "abc"
"12cd34" 12 "cd34"
"1e23" 1
2006 Jan 26
0
Bug with table_name_prefix?
Hi all,
I think I have found a bug in ActiveRecord''s handling of eager loading when
using table_name_prefix. Here is a reduction of the problem :
class Cheese < ActiveRecord::Base
##
## id SERIAL
## name VARCHAR(32)
## county_id INTEGER
##
belongs_to :county
def self.table_name_prefix
"stuff_"
end
end
class County
2010 Jun 01
1
regexpr help (match.length=0)
R-help,
Sorry if this is more of a regex question than an R question. However,
help would be appreciated on my use of the regexpr function.
In the first example below, I ask for all characters (a-z) in 'abc123';
regexpr returns a 3-character match beginning at the first character.
> regexpr("[[:alpha:]]*", "abc123")
[1] 1
attr(,"match.length")
[1] 3
2007 Apr 04
4
joining across databases in a find statement with include (legacy db)
Hi,
I have a legacy database ''old'' and a new database ''new'' which rails
uses. I set up models using old with establish_connection(old), and
this works well, except for include:
class OldModel < ActiveRecord::Base
establish_connection(old)
end
class NewModel < ActiveRecord::Base
has_one :old_model
end
a = OldModel.find :first
NewModel.find(:all,
2013 Mar 07
0
custom table_name for table users with devise
Hi
for my app, I have several tables for users (franceusers, belgiumusers,
...) and I would like to use one or another depending on domain
I tried with table_name_prefix and table_name but it seems to not work
class User < ActiveRecord::Base
rolify
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and
2006 Dec 01
4
uninitialized constant error in app but not when using console
I''ve got a wierd issue here and maybe someone can assist
i created a module in my apps lib directory which i use for
authenticating against an external source (among other things).
lib/myapp.rb
-----------------
require ''rubygems''
require_gem ''activerecord''
# uses activerecord odbc adapter by openlink
module MyApp
module ExternalSource
class
2003 Aug 24
2
wxRuby 0.1.0 Alpha has been released!
http://rubyforge.org/project/showfiles.php?group_id=35&release_id=46
The code itself has been quite stable for several weeks. This release
includes Gour''s excellent MinGW README notes, along with various updates
to the README, and clarification of the LICENSE.
Thanks to everyone for your help in putting this together. It was
definitely a team project. I look forward to getting lots