Prev PageNext Page
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
Make Rails Lib Module Methods Available to Views
If you create a module in the lib/ directory of your Rails application you won't have access to those methods in your views. If you don't want to put those methods in a helper file, you need to add a method to your module that makes them available for you...
Written by Sean Behan on 06/17/2012
Use a Cron Job to Automate Sphinx Index Refresh from Rails Rake Task
If using Sphinx, you need to refresh indexes when you add new content to your database. This is fairly easy to do by hand rake thinking_sphinx:index RAILS_ENV=production But if you want to automate this and use a cron, remember to set the PATH, SHELL an...
Written by Sean Behan on 06/17/2012
How to Get Your User's SHELL and PATH Information
How to find your user SHELL and PATH on Linux echo $PATH echo $SHELL Which will print the paths to the screen /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games /bin/bash
Written by Sean Behan on 06/17/2012
Installing Feedzirra RSS Parser on Ubuntu 8
I recently watched a RailsCasts episode (http://railscasts.com/episodes/168-feed-parsing) on parsing and persisting RSS feeds using Feedzirra. It took a little setting up on Ubuntu because it relies on some libraries that aren't included with Ubuntu > 8. ...
Written by Sean Behan on 06/17/2012
Email Obfuscation and Extraction from Text with Rails
There is a helper method for handling the obfuscation of email addresses in Rails. mail_to "me@domain.com", "My email", :encode => "hex" # => My email If you want to then extract an email address(or all email addresses) from a block of text here is the...
Written by Sean Behan on 06/17/2012
Fixing MySQL for Rails 2.2 Development on Mac OS X
Oh what trouble Rails 2.2 and MySQL (on Mac OS X) can be. Rails, as of version >= 2.2, no longer comes bundled with the MySQL adapter. This means you'll need to install it yourself, but it appears that the gem for installing it is also broken. This will ...
Written by Sean Behan on 06/17/2012
Installing Sphinx Search Engine on Mac OS X... or ld: library not found for -lmysqlclient
If you are trying to install Sphinx on Mac OS X, it will most likely fail. The current version of MySQL bundled with Mac OS X is not supported and therefore, it will spit out the error message because it can't find the correct libraries. ld: library no...
Written by Sean Behan on 06/17/2012
Recursively Zip a Directory and Files on Linux
It's Short and sweet! Just remember that the finished zip filename is the first argument and the directory you wish to recursively zip comes after. zip -r name_of_your_directory.zip name_of_your_directory That's all. You might be intere...
Written by Sean Behan on 03/05/2017
Add User Directories to Apache2 Web Server
You can either link up the modules yourself like this: ln -s /etc/apache2/mods-available/userdir.conf /etc/apache2/mods-enabled/userdir.conf ln -s /etc/apache2/mods-available/userdir.load /etc/apache2/mods-enabled/userdir.load Or you can use the Apach...
Written by Sean Behan on 06/17/2012
Prev PageNext Page