This link has been bookmarked by 157 people . It was first bookmarked on 02 Mar 2006, by Kevin Hoffman.
-
Rajkumar SinghRails Framework Documentation
-
Richard KanavatiRuby on Rails API
-
Michel Bauwensexample of how it's done
-
Alan StebbensDescribes Rails APIs
-
Chu Yeow CheahFinally I can use del.icio.us seriously as my browser bookmarks instead of a place to "digg" stuff! (Get the new del.icio.us Firefox extension to see why!)
-
Ethan GardnerIn Rails, the model is handled by what‘s called an object-relational mapping layer entitled Active Record. This layer allows you to present the data from database rows as objects and embellish these data objects with business logic methods. You can read
-
-
Using polymorphic associations in combination with single table inheritance
(STI) is a little tricky. In order for the associations to work as
expected, ensure that you store the base model for the STI models in the
type column of the polymorphic association. To continue with the asset
example above, suppose there are guest posts and member posts that use the
posts table for STI. In this case, there must be a type column in
the posts table.class Asset < ActiveRecord::Base
belongs_to :attachable, :polymorphic => true
def attachable_type=(sType)
super(sType.to_s.classify.constantize.base_class.to_s)
end
end
class Post < ActiveRecord::Base
# because we store "Post" in attachable_type now :dependent => :destroy will work
has_many :assets, :as => :attachable, :dependent => :destroy
end
class GuestPost < Post
end
class MemberPost < Post
end
-
-
-
Action Controllers are the core of a web request in Rails
-
-
Stéphane MorandAPI Ruby on Rails
-
Jie Tongp
Page Comments
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.