Displaying 20 results from an estimated 5000 matches similar to: "Aliasing a table in ActiveRecord."
2006 Aug 14
2
finders et sous-classes
Bonjour, c''est ma premi?re question ici car d''habitude il me suffit de
parcourir de tels forum pour trouver r?ponse ? mes questions.
Donc cette fois, c''est du s?rieux, je n''ai pas r?ussi ? trouver la
moindre ?vocation ? mon probl?me.
Je vous explique.
J''ai une famille de mod?les :
class Attachement < ActiveRecord::Base
...
end
class Illustration
2006 Apr 11
7
Undefined Method
Where can I define the method ''tbluser'' in this error?
NoMethodError in Tblregisteredphone#list
Showing app/views/tblregisteredphone/list.rhtml where line #23 raised:
undefined method `tbluser'' for #<Tblregisteredphone:0x375c778>
Extracted source (around line #23):
20: </font>
21: </td>
22: <td>
23: <%= link_to
2006 Mar 04
6
Can''t get Fast CGI working.
Well, after many hours of tinkering and internet browsing I just can''t
get Fast CGI to work with Rails and Apache 1.3 on FreeBSD 5.4 Normal CGI
works fine, but as soon as I enable FastCGI in .htaccess I get the
message:
Application error
Rails application failed to start properly
Here''s what I''ve done so far:
- I''ve installed all the necessary software for
2006 Mar 27
5
Fake ActiveRecord model?
Hi all,
I have a legacy table which I cannot get to work with ActiveRecord (no
ids etc). All I want is to create a class which opens a connection
manually and allows me to execute some plain SQL statements.
What I can''t figure out is how to either build up a connection and
execute queries from a non-AR inherited class, or how to create a
AR-inherited class minus all the AR magic and
2006 May 16
0
Possible bug: ActiveRecord::Base::has_many fails for String arguments.
Hi
I''ve noticed ActiveRecord::Base::has_many fails for String arguments.
The following code works when all arguments to the
ActiveRecord::Base::has_many calls are Symbols:
class Country < ActiveRecord::Base
has_many :country_products, :dependent => true
has_many :products, :through => :country_products
end
ruby script/console
>> Country.find_all.first.products
2005 Mar 08
4
change the model''s table name
I need to change the name of the table a model is connected to... like
the example in the API... the table is called mice and I want a class
called Mouse.
class Mouse < ActiveRecord::Base
table_name "mice"
end
I''m doing this cause I want tables in my language (italian) and avoid
the nameS thing.
just adding it in that way doesn''t work
ArgumentError in
2006 Jan 21
2
Specifying which Oracle schema to use with ActiveRecord
We use Oracle in my company.
I have access to 2 schemas (or tablespaces?) :
1.SAL
2.SALDATA
I use tables from both schemas. How do i tell active record which
schema to look in for the table i
want???
I''ve just managed to convince the boss to switch from Java to Rails so
this would be a arse if i couldnt use both schemas.
Any help would be GREATELY appreciated!
Thanks,
Chris
--
2005 Dec 07
3
ActiveRecord::Observer problem
Hi all,
I have a problem with an observer. I have a simple observer...
class ActivityObserver < ActiveRecord::Observer
observe Customer
def after_create(model)
bind_params(model)
@al.action = "create"
@al.save
logger "#{model.id} : created"
end
private
def bind_params(model)
@al = ActivityLog.new
@al.user_id = User.current.id
2006 Jan 24
4
How to filter an activerecord find_all...
I have a nice hierarchical table structure like this:
divisions
has_many groups
groups
belongs_to division
has_many subgroups
subgroups
belongs_to group
has_many units
units
belongs_to subgroup
I have a report which is based on units, but i want to be able to filter
the units by which subgroup, or which group, or which division. I also
want to sort them by division.name,then group.name,
2010 Jan 26
6
Subclassing ActiveRecord::Base
First of all, sorry for the crossposting, but I put this into the Ruby
Forum first of all, but was pointed to this as a more appropriate
location.
I''m using ActiveRecord and ActiveSupport in a non-rails environment
to connect to multiple databases, and I''ve found the following (single
database) to cause me an error. Note that params is my database settings
and omitted for
2006 Jan 20
4
Prepending table names on a per user or sub domain basis
Here is a sample of the database structure I want to have:
someclientname-websites
someclientname-canned_responses
someclientname-canned_responses_websites
anotherclientname-websites
anotherclientname-canned_responses
anotherclientname-canned_responses_websites
As you can see I want to prepend the name of my future clients to the
table name so that they use completely different sets of data.
I
2006 May 05
1
Help with ActiveRecord
Model:
class AdminQueue < ActiveRecord::Base
set_table_name ''adminqueue''
end
Interacting with it in script/console
>> AdminQueue.new
=> #<AdminQueue:0x240a910 @attributes={"topic_id"=>nil,
"resolved"=>nil, "updated_on"=>nil, "action"=>nil, "type"=>nil,
"post_id"=>nil,
2009 Jan 09
2
Confused about to_xml() in ActiveRecord::Base subclass
Since all my efforts to control how to_xml() is formatting dates has
failed, I''m now considering writing my own to_xml(). However, from
the limited examples I''ve found, I just don''t understand how to
actually reference the columns for the records in my record set.
Here''s a simplified view of my ActiveRecord object:
class Errors < ActiveRecord::Base
2006 Apr 04
16
No Method Error
This is the error that keeps appearing. I don''t understand why
"@tblusers" is not correct. Can anyone help?
NoMethodError in Tblregisteredphone#new
Showing app/views/tblregisteredphone/new.rhtml where line #20 raised:
You have a nil object when you didn''t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.each
Extracted
2011 May 07
4
Activerecord::JDBCError: Invalid column number
Hi,
I''m rather new to Ruby and RoR, so I do not really know whether this ist
the right forum to place my question.
For my first ''project'' I planned to create a simple online-viewer, which
grabs data from an existing database and make them visible in a
structured form via browsers. So I thought that could be the right
beginner-project, because I have only read datasets
2007 Jan 23
7
ActiveRecord requires sequence numbers in Oracle join table
I am mapping ActiveRecord classes to an existing Oracle database. This
means I cannot change the database schema to fit ActiveRecord
conventions.
Predictably, I have gotten into trouble: I have several join tables
that do not have a primary key column, and therefore no number sequence
defined. ActiveRecord insists on requiring a sequence, and gets unhappy
when there is none to find.
Is there a
2006 Apr 18
7
Connecting to multiple databases
Hi Everyone,
I am trying to connect to multiple databases and followed along the
Recipe in Chad Fowlers ''Rails Recipes'' book (which basically is about
establishing the connection in a subclass of ActiveRecord::Base, and
inheriting all classes in need of this connection from this class)
Chad Fowler says:
"You won''t be able to instantiate an External, of course,
2011 Feb 14
1
Curiosity in my production.log: */*
In my production.log, I usually see lines like this:
Processing by HomeController#index as HTML
But sometimes I see the line like this:
Processing by HomeController#index as */*
At first I thought perhaps those calls were made by a bot, but after
looking at it closer it looks as those they are generated by normal
users. I have no idea, first, how that line could have been generated,
and
2006 Jul 22
3
Extend dynamically a model
Hello,
I''ve a model defined as
class Account < ActiveRecord::Base
end
This maps a mysql table Accounts. I want to be a able to dynamically
change this model. During the life of my app, the table Accounts may
change name, how do I do a set_table_name not within account.rb?
--
Posted via http://www.ruby-forum.com/.
2006 Feb 21
2
ActiveRecord before_ callbacks question
Hi!
I need to set the primary key in a model and postgres table to something
different than id. View Edit and such works in the scaffolded
controller. However if I click in the controller below the list of data
onto New then I get an error message like this:
Showing app/views/admin/_form.rhtml where line #5 raised:
undefined method `nr_before_type_cast'' for