Welcome To Snipplr


Everyone's Recent Rails Snippets



« Prev 1 2 3 4 5
  1. FAV

    Git log deleted line

    Git log to see deleted line
    Rails 5 views posted 5 years ago by yaworsk
  2. FAV

    Rescuing From RecordNotUnique

    Use rescue_from ActiveRecord::RecordNotUnique when DB transaction fail on uniqueness check
    Rails 6 views posted 5 years ago by yaworsk
  3. FAV

    Nested Attributes - Minus records from record set

    Useful for building nested entries checkboxes etc
    Rails 5 views posted 5 years ago by davidb
  4. FAV

    human readable time from seconds (helper)

    A very concise ruby on rails helper method that converts seconds into human readable format. It will not display any time periods that have 0 (ie: 1 hour 13 seconds - skipping minutes as there were none) Due to complexity, months were not factored...
    Rails 8 views posted 5 years ago by uberdragon
  5. FAV

    RVM Workflow for a New Rails App

    You want to start a new Rails app. But you also want to start a new RVM gemset for the app so you can start with the latest Rails and gems. In this code snippet I show how I start off an up-to-date Rails project in a clean gemset.
    Rails saved by 1 person 3 views posted 6 years ago by dreamstarter
  6. FAV

    Validate credit card

    Supported brands name | key ----------------------- American Express | :amex China UnionPay | :unionpay Diners Club | :diners Dinner Club US | :diners_us Discover | :discover...
    Rails 3 views posted 6 years ago by Fivell
  7. FAV

    Rails fix for cookie munging AT&T Proxies

    Working on the problem described here: http://forums.att.com/t5/Data-Messaging-Features-Internet/3G-proxy-wnsnet-attws-com-strips-HTTP-response-headers/m-p/3294533/highlight/false#M59737 After some testing we found the below code to fix our troubl...
    Rails 6 views posted 7 years ago by mightybs
  8. FAV

    Render layout false

    render :layout => false not work
    Rails 3 views posted 7 years ago by CrescentMoon
  9. FAV

    Solución: Rails no encuentra la librería MySQL aunque esté instalada (OS X)

    Esto suele ocurrer muy amenudo cuando instalamos Ruby on Rails antes que MySQL. Es un error "Library not loaded: libmysqlclient.18.dylib (LoadError)" donde lista los directorios donde busca y no lo encuentra. La solución es guiarle para que lo encue...
    Rails 3 views posted 8 years ago by skozz
  10. FAV

    Uninitialized constant Rake::DSL

    Rails 5 views posted 8 years ago by guhelouis
  11. FAV

    Adding custom MimeTypes into rails format

    Rails 3 views posted 8 years ago by guhelouis
  12. FAV

    Rails request parameters!

    Rails 4 views posted 8 years ago by abstraktor
  13. FAV

    Shoulda with TestUnit: Conditional Validation using Shoulda/Subject

    Rails 5 views posted 8 years ago by widescape
  14. FAV

    lazyload ruby and rails extensions

    Rails 7 views posted 9 years ago by avioli
  15. FAV

    Previous and Next Links

    If each title is unique and you need alphabetical, try this in your Post model. You can change title to any unique attribute (created_at, id, etc.) if you need a different sort order.
    Rails 6 views posted 9 years ago by gmericksen
  16. FAV

    SQL log in Rails console

    Rails 2 views posted 9 years ago by batamire
  17. FAV

    Authlogic Timeout

    This will require a user to log back in if they are inactive for more than 10 minutes. In order for this feature to be used you must have a last_request_at datetime column in your table for whatever model you are authenticating with.
    Rails 3 views posted 9 years ago by gmericksen
  18. FAV

    Start a Rails project using datamapper

    Rails 3 views posted 9 years ago by donaldcook
  19. FAV

    Find ActiveRecord Object Older than One Week Old

    Rails 5 views posted 9 years ago by zackfern
  20. FAV

    Rails - Custom Form Builder

    Rails 1 views posted 9 years ago by alx_g
  21. FAV

    ajax pagination links

    tag links with .click function
    Rails 6 views posted 9 years ago by insanedreamer
  22. FAV

    easy flash display with prototype

    Rails 3 views posted 9 years ago by insanedreamer
  23. FAV

    Display 'loading' icon for all ajax requests

    Put this in application layout for global use. Have a hidden div called 'loadicon' with a loading icon (or whatever) in it, which is shown/hidden on ajax calls.
    Rails 3 views posted 9 years ago by insanedreamer
  24. FAV

    sinatra.rb upload image

    Rails 1 views posted 9 years ago by almazom
  25. FAV

    Rails: Freezing an app

    Migrating a Rails app from Development to Production can sometimes be a real pain. One way I help reduce headache is by copying all the necessary Rails files to make it a self-contained unit (Freezing). If I need to make version changes later, I si...
    Rails 0 views posted 9 years ago by chrisaiv
  26. FAV

    Rails: My Favorite Rails Plug-ins

    Here are a few examples of how to install my favorite rails plug-ins from GIT. The alternative solution is to simply use gem --and have the plugin available throughout all of my rails applications-- but I prefer to have my applications living as sel...
    Rails 5 views posted 9 years ago by chrisaiv
  27. FAV

    Fetch a page from your site from console

    Add this to .irbrc. Allows the following in console: > gethtml('/login') => HTML of whatever page is generated by /login
    Rails 3 views posted 9 years ago by insanedreamer
  28. FAV

    To access url helpers (url_for, etc) from Rails console (Rails 3)

    in Rails 2, use `include ActionController::UrlWriter` instead.
    Rails saved by 1 person 5 views posted 9 years ago by insanedreamer
  29. FAV

    Easy-to-spot debugging output in tests

    Put this in `test_helper.rb` and call with `show(object1, object2, etc.)`
    Rails 2 views posted 9 years ago by insanedreamer
  30. FAV

    easy-to-find logger.info output (rails)

    Rails 5 views posted 9 years ago by insanedreamer
« Prev 1 2 3 4 5