search for: other_thing

Displaying 8 results from an estimated 8 matches for "other_thing".

2006 Apr 17
2
has_one problem in a form
Hello all, I have a syntax question. How does one refer to a field brought in via a has_one/belongs_to relationship in a form helper? Basically, I have two models: class Resource < ActiveRecord::Base has_one :other_thing end class OtherThing < ActiveRecord::Base belongs_to :resource end It has the normal id-resource_id foreign key relationship. OtherThing has two fields, plus the foreign key, call them field1 and field2. In the ruby console, I can access field1 a couple of ways: resource.other_thing.field...
2007 Dec 18
16
shared behav
hi, i want to make a behavior shared between models, the examples need to create new instances etc. Is there a way to pass the model class to the shared behavior? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20071218/5b400cc5/attachment-0001.html
2009 Apr 10
0
ActiveRecord belongs_to ActiveResource
class Thing < ActiveRecord::Base belongs_to :other_thing end class OtherThing < ActiveResource::Base self.site = ... end The association here works. I can access other_thing from thing with no problems until, as usual, testing. Specifically functionally test the things_controller. The things controller is simple scaffold, however, having the assoc...
2006 Mar 15
4
[NQ] How to set an initial FK for a new item of something?
...oblem here. I''ve a list of things with a "New thing" link beneath it. When you click that link, obviously, a new thing shall be created. Now, that works pretty fine for things that don''t have foreign keys, but for things that do it crashes, since there is not yet a thing.other_thing.name available. I suspect you can somewhere in app/models/thing.rb tell it to always assign, say, the first other_thing to a new thing... ? Grateful for any hints you might have! Best regards, Raphael -- Posted via http://www.ruby-forum.com/.
2006 Aug 15
2
has_many + finder_sql & :include
Hello, In a model I have: has_many :things, :finder_sql => '' select * from other_things '' + '' where id = #{id} '' When I do MyClass.find(:all, :include => :things) I get a weird error: from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract_adapter.rb:120:in `log''...
2006 Jul 10
1
link_to_remote questions
Hello, I tried link_to_remote to see the build in AJAX capabilities with rails for the first time for me, I tried the following code and it worked: <%= link_to_remote( "some link", :update => "some_div", :url =>{ :action => :someaction }) %> OK, it has worked, but I have two questions here: 1- When moving
2006 Apr 19
2
Is it true that you cannot use bind variables with Oracle?
Is it true that you cannot use bind variables with Oracle? An answer would be really appreciated, Thanks, Chris -- Posted via http://www.ruby-forum.com/.
2006 Feb 15
2
Polymorphic joins work one way, but not the other
I''ve been using polymorphic joins from edge rails based on about 5 lines of advice Rick Olson gave me over IRC. There''s some sparse documentation popping up but it seems to cover a somewhat different case. Anyway - I pretty much got it to work - save for one detail. Here''s what I have: class Event < ActiveRecord::Base belongs_to :attachable, :polymorphic =>