Coder Social home page Coder Social logo

capythebeara / acts_as_commentable Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jackdempsey/acts_as_commentable

1.0 2.0 0.0 123 KB

The ActiveRecord acts_as_commentable plugin

Home Page: http://juixe.com/svn/acts_as_commentable/

License: MIT License

Ruby 100.00%

acts_as_commentable's Introduction

Acts As Commentable

Allows for comments to be added to multiple and different models.

Resources

Install

 Rails

  * To install as a plugin

  ** Rails 3:
   script/plugin install http://github.com/jackdempsey/acts_as_commentable.git

  ** Rails 2:
   script/plugin install http://github.com/jackdempsey/acts_as_commentable.git -r 2.x

  * To install as a gem
  sudo gem install 

 Merb/Rails

  * To install as a gem:
   Run the following if you haven't already:
   gem sources -a http://gems.github.com

   Install the gem(s):
   sudo gem install jackdempsey-acts_as_commentable

   add the folloowing line to your environment.rb
   config.gem 'jackdempsey-acts_as_commentable', :lib => 'acts_as_commentable', :source => "http://gems.github.com"

  * The gem's have also been pushed to gemcutter.org, so if you have that in your sources, you can just 'gem install acts_as_commentable'

Generate your comment model:

script/generate comment

Then migrate your database:

rake db:migrate

Usage

Merb Users:
* add 'dependency "acts_as_commentable"' to your init.rb or dependencies.rb if using merb-stack

* Make your ActiveRecord model act as commentable.

class Model < ActiveRecord::Base
	acts_as_commentable
end

* Add a comment to a model instance

commentable = Model.create
commentable.comments.create(:title => "First comment.", :comment => "This is the first comment.")

* Fetch comments for a commentable model:

commentable = Model.find(1)
comments = commentable.comments.recent.limit(10).all

# Following doesn't work/make sense to me. Leaving for historical sake -- Jack
# * Each comment reference commentable object
#
# model = Model.find(1)
# model.comments.get(0).commentable == model

Credits

Xelipe - This plugin is heavily influenced by Acts As Taggable.

More

www.juixe.com/techknow/index.php/2006/06/18/acts-as-commentable-plugin/ www.juixe.com/projects/acts_as_commentable

acts_as_commentable's People

Contributors

capythebeara avatar chriseppstein avatar jackdempsey avatar jinzhu avatar maddox avatar oleriesenberg avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.