Displaying 8 results from an estimated 8 matches for "r00bi".
Did you mean:
r00by
2006 Apr 06
5
Using helper method of another model
I have a template that belongs to a certain model (model A). I need to
call a helper method of a different model (model B). Then I need the
helper method of B to call a helper method of model C.
I tried using "include" and "require" and using namespaces, but I got
"undefined method". What is the way to do it?
--
Posted via http://www.ruby-forum.com/.
2005 Dec 23
6
Save using Update
Hi,
I want to update an existing row in table "items" where items.id == 10
I tried this:
item = Item.new
item.f1 = ...
item.f2 = ...
...
item.id = 10
item.save
I got an error
Duplicate entry ... for key 10 : INSERT INTO items ...
How do I make item.save to use UPDATE instead of INSERT?
--
Posted via http://www.ruby-forum.com/.
2006 Jan 22
11
ActiveRecord find
Suppose I have three tables - authors, posts and topics.
Every post have a topic and every topic has an author, so I have
posts.topic_id and topic.author_id. When the author is guest (not
registered), author_id is nil.
I need to find all the posts (in one query) where every post have all
the information of the topic and the auther, so if p is one of those
posts I could get the name of the
2006 Apr 11
4
Two versions of Rails on one PC
I want to have Rails 1.1 + Rails 1.0 on the same PC and be able to load
my script with a different version each time. Is it possible?
--
Posted via http://www.ruby-forum.com/.
2006 Jan 29
1
Accessing attributes
I have a name of an attribute and I need to get its value and set a new
value for it:
x1 = a.foo
a.foo = x2
How do I do that if the name of the attribute ''foo'' is a var?
I thought about doing this:
attribute_name = ''foo''
x1 = a.attributes[attribute_name]
a.attributes[attribute_name] = x2
but this is a bypass and I''m quite sure it would cause
2006 May 10
0
Boolean attributes - not so simple as I thought
Suppose I have a table ''items'' with the attribute ''bool'' which is
boolean.
There''s an array @attribs which holds :bool and some other symbols of
attributes which are not boolean.
class Item < ActiveRecord::Base
{
def attribs
[:bool , :x , :y]
end
}
The trouble is that @item.bool? and @item.bool behave differently.
If I set @item.bool=5
2006 Feb 01
0
Nil in CSV Fixtures
The Guide to Testing the Rails
http://manuals.rubyonrails.com/read/chapter/26#page65
says about CSV fixtures:
nulls can be achived by just placing a comma, for example,
(1,sclaus,,false,) minus the parenthesis of course.
I tried that, but after the fixtures had been created, I checked the
value of the field in the DB and instead of nil the value was zero,
eventhough the default value for the
2006 Jan 04
0
Doesn''t "find" call initialize?
class Item < ActiveRecord::Base
def initialize(*args)
super
@x = 5
end
def print_x
puts @x
end
end
item_new = Item.new
item_new.print_x # output: 5
item_find = Item.find(1) # this record is in the database
item_find.print_x # output: nil
I thought the output would be 5 in both cases, since Item.find returns a
new object of Item and so Item.initialize