Displaying 4 results from an estimated 4 matches for "asset_types".
Did you mean:
asset_type
2006 Feb 13
6
How can I access the value of params[:tags] in my validate function?
I would like to have tags mandatory in my app.
The following keeps giving me error that params is nill.
def validate()
if (@params[:tags])
errors.add(@params[:tags], ":tags must be entered ")
end
end
Why cannot I access params in my model class?
The field for tags is called "tags"
How else can I add an error using errors.add?
I
2007 Nov 08
0
Dynamic relation with eager loading
A model has 2 columns in its table
asset_type_id
asset_id
the asset_type_id links directly to the table asset_types via a
belongs_to
asset_types contains a single column ''name''
method_missing in the model says when you call a method matching
/^asset.*/
call the corresponding method substituting ''asset'' for the contents of
asset_type.name
(ie. the name in asset_types is the...
2006 Feb 06
9
tests fine, but fail under rake
Hi there,
So I have an odd error at the moment that only occurs when I run tests
via rake. It''s happening with two tests now. Under a simple ruby run,
the tests are fine, e.g.:
D:\User\Code\ruby\prometheus>ruby
test\functional\story_comments_controller_test
.rb
Loaded suite test/functional/story_comments_controller_test
Started
.........
Finished in 2.37 seconds.
9 tests, 65
2006 Jul 20
5
How can I make has_many prevent a delete that would lead to orphans?
e.g.
class Asset < ActiveRecord::Base
validates_presence_of :asset_number, :make, :model, :location,
:name, :serial_number
validates_numericality_of :asset_number
validates_uniqueness_of :asset_number
belongs_to :user
belongs_to :location
belongs_to :asset_type, :foreign_key => ''type_id''
end
class Location < ActiveRecord::Base
validates_presence_of :name