Posts

Showing posts with the label Ruby on Rails
Star rating System in Ruby on Rails (AJAX based) After looking at couple of websites, I realized that AJAX based rating system are a must for any socieal networking website :). So here is how I implemented it (I used mostly instructions from Dave Naffi's website to implement this. Steps 1)Download Acts as rateable plugin from Juxie.com Command> cd Command> ruby script\install http://juixe.com/svn/acts_as_rateable 2) Creating ratings table where you will be storing your ratings: mysql> desc ratings; +---------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------------+-------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | rating | int(11) | YES | | 0 | | | created_at | datetime | NO | | | | | rateable_type | varchar(15) | NO | | ...
How to ask for confirmation when submitting a delete request in Rails with submit_tag? After some minor research, I found that this works for me! I tried ":confirm" attribute in the tag, but it didn't work "return confirm('Are you sure?')" ) %>
Things I like about Ruby ? - Easy to use - Perl like feeling (I have been developing systems in perl for 6 years now) - Domain Specific Language - Code Generation - Extensibility - Everything just works :) - Abstraction Things I don't like about Ruby? - Abstraction (a necessary evil?) - Slow
Apache VirtualHost , Mongrel Cluster for rimu's hosting services Here is the file that worked for me (for Apache 2.0) NameVirtualHost *:80 ServerName myapp.com ServerAlias www.myapp.com DocumentRoot /var/www/yycctw/public Options FollowSymLinks AllowOverride None Order allow,deny Allow from all ProxyPass / http://127.0.0.1:8000/ ProxyPassReverse / http://127.0.0.1:8000 ProxyPreserveHost on ProxyPass /images ! ProxyPass /stylesheets ! ProxyPass /excerpt ! ProxyPass /javascripts ! ErrorLog /var/log/apache2/error.log CustomLog /var/log/apache2/access.log combined I found the one for apache 2.2 at lots of places but nothing for Apache 2.0 so I decided to write one on my own. Note that the last few lines with ! at the end are for allowing apache instead of mongrel to server images/stylesheets/excerpt/javascript because of it efficiency. Also here are my mongr...
Installing Gems on Shared Hosting service (like Dreamhost) First, you need to setup your .bash_profile. If you haven't already done it and make a directory for your gems. mkdir .gems echo 'export GEM_HOME="$HOME/.gems"' >> .bash_profile echo 'export GEM_PATH="$GEM_HOME:/usr/lib/ruby/gems/1.8"' >> .bash_profile echo 'export PATH="$HOME/.gems/bin:$PATH"' >> .bash_profile Of course, you could edit your .bash_profile using pico, nano or vi if you prefer. Then be sure to load all that: source .bash_profile If all goes well, you should be able to then install your own gems, update ones that are already there, and generally be a happier person. For example, you could update your rails gem with gem update rails --include-dependencies All of your personally-installed gems will end up in ~/.gems for you to use. (from dreamhost wiki)