CirclingMinds

October 5, 2008

Getting will_paginate to work with lightbox gone wild

Filed under: ruby-on-rails — Tags: , — shovan @ 5:53 pm

In order to get will_paginate to work with lightbox gone wild, I had to make the following modifications:

Step 1
Modify lightbox.js
Add next, prev, start functions similiar to the example shown to the lightbox.js file

1
2
3
4
5
next: function(e){
link = Event.element(e);
Element.remove($('lbContent'));
var myAjax = new Ajax.Request( link.href, {method: 'post', parameters: "", onComplete: this.processInfo.bindAsEventListener(this)} );
},

Step 2
Create a new method inside application_helper.rb.

1
2
3
4
5
6
7
8
9
10
  def will_paginate_modified object, params
    begin
      doc = Hpricot(will_paginate object, :params => {:id => params[:id]})
  		(doc/"a").set("class", "lbAction")
  		(doc/"a").set("rel", "next")
  		doc.html
    rescue Exception => e
      will_paginate object, :params => {:id => params[:id]}
    end
  end

Step 3
Call will_paginate_modified from your lightbox gone wild pop up view file.

1
<%= will_paginate_modified @my_collection, params %>

June 20, 2008

How to delete rails log files

Filed under: ruby-on-rails — shovan @ 9:55 pm

The following command will recursively delete any development.log file within your home directory:

find ~/ -name development.log  -exec /bin/rm -f {} \;

June 20, 2007

Rake Commands List

Filed under: ruby-on-rails — shovan @ 9:56 pm
rake db:fixtures:load          # Load fixtures into the current environment's database.  Load specific fixtures using FIXTURES=x,y
rake db:migrate                # Migrate the database through scripts in db/migrate. Target specific version with VERSION=x
rake db:schema:dump            # Create a db/schema.rb file that can be portably used against any DB supported by AR
rake db:schema:load            # Load a schema.rb file into the database
rake db:sessions:clear         # Clear the sessions table
rake db:sessions:create        # Creates a sessions table for use with CGI::Session::ActiveRecordStore
rake db:test:clone             # Recreate the test database from the current environment's database schema
rake db:test:clone_structure   # Recreate the test databases from the development structure
rake db:test:prepare           # Prepare the test database and load the schema
rake db:test:purge             # Empty the test database
rake log:clear                 # Truncates all *.log files in log/ to zero bytes
rake rails:freeze:edge         # Lock to latest Edge Rails or a specific revision with REVISION=X (ex: REVISION=4021) or a tag with TAG=Y (ex: TAG=rel_1-1-0)
rake rails:freeze:gems         # Lock this application to the current gems (by unpacking them into vendor/rails)
rake rails:unfreeze            # Unlock this application from freeze of gems or edge and return to a fluid use of system gems
rake rails:update              # Update both configs, scripts and public/javascripts from Rails
rake rails:update:configs      # Update config/boot.rb from your current rails install
rake rails:update:javascripts  # Update your javascripts from your current rails install
rake rails:update:scripts      # Add new scripts to the application script/ directory
rake stats                     # Report code statistics (KLOCs, etc) from the application
rake test                      # Test all units and functionals
rake test:functionals          # Run the functional tests in test/functional
rake test:integration          # Run the integration tests in test/integration
rake test:plugins              # Run the plugin tests in vendor/plugins/**/test (or specify with PLUGIN=name)
rake test:recent               # Test recent changes
rake test:uncommitted          # Test changes since last checkin (only Subversion)
rake test:units                # Run the unit tests in test/unit
rake tmp:cache:clear           # Clears all files and directories in tmp/cache
rake tmp:clear                 # Clear session, cache, and socket files from tmp/
rake tmp:create                # Creates tmp directories for sessions, cache, and sockets
rake tmp:pids:clear            # Clears all files in tmp/pids
rake tmp:sessions:clear        # Clears all files in tmp/sessions
rake tmp:sockets:clear         # Clears all files in tmp/sockets

Powered by WordPress