Displaying 20 results from an estimated 100 matches similar to: "has_many syntax"
2005 Mar 16
1
Is there an opposite of Inflector.Camelize
Or to put it another way, is there a function f, such that
Inflector.f(Inflector.Camelize(x)) = x
?
Enquiring minds need to know.
Adelle.
2006 Mar 13
1
adding custom cache field
Hello,
I needed to add custom cache field for one of my application. I thought I
will share the code showing how to do this.
This code below creates and maintain a custom cache field, for keeping track
of totals. Say, you have accounts, and for each account there are transactions
(either deposit/withdrawal), and one will like to keep track of the total
balance for an account.
So, let there be a
2012 Jul 04
1
[LLVMdev] Non-tail calls
Hi all.
I am using LLVM to develop a procedural language. Can anybody point me to an example that uses CreateCall for a non-tail call? I am having trouble doing anything with the return value from the call besides returning it immediately.
i.e. Passing the CallInst created by CreateCall to CreateRet is working fine, but I am having trouble storing the returned value in a local variable or
2012 Jul 04
1
[LLVMdev] Non-tail calls
On Wed, Jul 04, 2012 at 11:31:57AM +0100, Joey wrote:
> Sounds like you are using the C++ API.
>
> You can store the value like:
> Value *val = Builder.CreateCall(...);
>
> Then, for example, you can do:
> Builder.CreateAdd(val, val);
That looks a lot like what I am trying to do. I will assume that my problem is either caused by my environment (VC7.1) or by the fact
2005 Mar 10
1
Running unit tests on SQL Server
Hi everyone,
It''s been more than a month since I last fired up Ruby or ActiveRecord, so
imagine my surprise when, after getting the latest source and running the
unit tests for MySql, I was greeted with a screen full of errors.
I''ll come back to the MySql errors later. What follows is the output I get
when I run the tests for SQL server.
I installed ruby with the one-click
2006 Jan 10
5
problems overriding module with plugin
Hi I am trying to create a plug-in to fix the error in the rails core
produced by the multiple delete on a HABTM relationship. I have
confirmed that my plug-in is being included into the base during
runtime however the code does not seem to be overridding the base
class.
module ActiveRecord
module Associations
module ClassMethods
def has_and_belongs_to_many(association_id, options =
2012 Feb 23
1
Bug in nested_attributes_for: question about best way to patch
I''ve discovered what I''m pretty confident is unexpected behavior in
accepts_nested_attributes_for, and am developing a patch, but I''ve
encountered a question about how the core team would prefer the
implementation to look.
Here''s the bug: when assigning to a belongs_to relationship (and I
believe one-to-one, but I haven''t verified yet) if you mark the
2009 Sep 28
5
Multi-databases support
Hi,
While I was hacking ovirt-server, I have found that it's currently
restricted to Postgres DB. Even if I like postgres for serious work on a
server, I really prefer to hack/dev locally on a Sqlite or MySQL DB.
I have googled on rails in order to find a good answer for the "foreign
key problem" which forces OVirt to stay on pg. I have found a plugin on
this particular
2006 Feb 28
1
Cache Magic field for totaling
Hello,
Rails provide counter cache field for associations, I want a similar cache
for totaling up values
(say account_balance = sum_of_deposits - sum_of_withdrawals).
I was wondering if rails, already has another surprise in store for me, or is
there any plug-in or how-to for doing these kind of things.
Thanks.
--
Surendra Singhi
http://ssinghi.kreeti.com, http://www.kreeti.com
Read the
2006 Jan 17
15
legacy database and finder_sql nightmare!
This is my first rails app with a legacy database and I''m having a
terrible time getting the models set up correctly. I have an order
table that has a primary field named order_number. I have a name table
with a primary of item_number. These two tables are liked by the
item_number and the order_number, but not as you might think. If the
order_number is 2500, then each entry in
2006 Apr 10
1
How to set foreignkey in such a situation?
Table articles has column: author,body,etc
Table users has column: login_name,email,etc
articles belongs_to user
users has many articles
foreign_key author references users(login_name)
Therefore in Article.rb:
belongs_to:article_user,
:class_name=>"User",
:foreign_key=>"author"
and what''s going on? how the rails find the reference
2005 Apr 18
11
Create a pseudo-model from SQL query?
I''m having a hard time figuring out how to build my application using Rails. As i go
along, simple questions occur to me like: are you supposed to have a separate model
class (each in its own file, in the app/models directory) for each table in your
database? You''d think that something as basic as this would be laid out in the
introductory documentation but, alas, the
2006 Aug 16
0
acts_as_paranoid and alias_method_chain
when i require acts_as_paranoid I''m getting: undefined method
`alias_method_chain'' for #<Class:ActiveRecord::Base> (NoMethodError)
It happens in acts_as_paranoid''s init.rb. here''s the whole file. the
alias_method_chain is near the bottom. please advise.
class << ActiveRecord::Base
def belongs_to_with_deleted(association_id, options = {})
2007 Jan 28
0
problems with acts_as_paranoid (noticed while using acts_as_versioned)
hello,
I''m using the trunk versions of both plugins.
I''m running into this error when I run a migration to try and create
the versioned table for the model ''Note''
stack level too deep
/Users/Adam/dev/sweetspot/app/trunk/config/../vendor/plugins/
acts_as_paranoid/init.rb:5:in `belongs_to_without_deleted''
2006 Jul 16
0
Why does belongs_to handle "conflicts" this way?
When you define belongs_to in a model, you can either access
association or association_id. I was wondering how Rails would handle
things if you set each one to be different.
I made two simple models:
class Foo < ActiveRecord::Base; end
class Bar < ActiveRecord::Base
belongs_to :foo
end
Now here''s a script/console session.
>> f = Foo.create
=> #<Foo:0x270ec10
2006 Nov 09
2
redefining the method belongs_to in ActiveRecord::Base
Hi. I''ve tried to redefine the method belongs_to in ActiveRecord::Base,
so every time a model is defined as belonging to :attachment, it should
have some additional methods. I tried to do an alias of belongs_to, but
this was not successful. The error message in Webrick was
> Booting WEBrick...
./script/../config/../lib/ActiveRecordExtensions.rb:67: undefined
method
2005 Mar 09
15
SQL "editor"
Hello all,
I am curious about what tools you guys use to make your databases. I
know David uses CocoaMySQL. Are there other tools for other platforms
and for other databases? I''m not very good with the SQL language, so
I would like being able to do all my database setup with an
easy-to-use tool (defining tables, fields, primary keys, foreign keys,
indexes, etc.)
Big kisses,
Vincent.
2010 Oct 13
2
acts_as_list issue in single table inheritence
Hello Rails experts,
Need your help in following issue with the acts_as_list and single
table inheritence
Code details :
http://pastie.org/1214846
Hello Rails experts,
Need your help in following issue with the acts_as_list and single
table inheritence
Code details :
http://pastie.org/1214846
But here I need create those entries with the scope on Relater only and
not on RelaterFeed or
2006 Jun 19
3
can''t dump anonymous class Class
I''m trying to create a document upload system, where most of the code is
the super class Document and just the path to file on the system is
controlled by the sub classes. When I attempt to use my code, I get the
following when I try to save the document.
can''t dump anonymous class Class
Any ideas?
** Migration **
class CreateDocuments < ActiveRecord::Migration
def
2005 Mar 08
43
e=MCv
Dears,
What is this software runned as "e" showed on most Rails Videos and
providing a tree browser (explorer) and editor ?
Avail for Linux ?
Gretz
--
Mathieu