Destroy Children In Rails 2.3
In the parent class place the following code
has_many :posts, :dependent => :destroy
This used to be accomplished with
has_many :posts, :dependent=>true
Check out the Rails docs for more information http://api.rubyonrails.org/classes/ActiveRecord/As...
Written by Sean Behan on 06/17/2012
Regex for Extracting URLs in Plain Text
Here is a Regex for extracting URLs from text. However, these links will not already be hyperlinked or source attribtues from images or iframes.
This example is in PHP. I was trying to format a Wordpress page to auto hyperlink but preserve embeded ima...
Written by Sean Behan on 04/14/2017
Renaming Routes in Rails 3 with :As and :Controller
Renaming routes in Rails 2.* is straight forward. It goes something like this.
## config/routes.rb
map.resources :users, :as => :members
This will give you users_path and form_for(User.new) helpers, for instance, mapping the url to /members instead of ...
Written by Sean Behan on 06/17/2012
Changing GitHub Issue State in Git Commit Message
Changing issue state in git commit message for Github issues
fixes #xxx
fixed #xxx
fix #xxx
closes #xxx
close #xxx
closed #xxx
Example
git commit -am'complete bug fix closes #123'
Written by Sean Behan on 06/17/2012
The Best Video About How to Make Money Online
This is one of my favorite videos on the internet.
It is what got me interested in Rails and made me work toward the goal of running my own business and hopefully soon, launch my own products.
...
Written by Sean Behan on 06/25/2012