Welcome To Snipplr


Everyone's Recent Snippets Tagged rails



« Prev 1 2 3 4 5 ... 8
  1. FAV

    Nested Attributes - Minus records from record set

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

    Fish alias for restarting Rails server

    Aliases command "go!" to starting AND restarting rails server for a project from anywhere in the filesystem. Replace PROJECT_HOME with the path to your project. Place in config.fish
    Bash 2 views posted 5 years ago by Epigene
  3. 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 4 views posted 5 years ago by uberdragon
  4. FAV

    Seeding database from .XLS file

    I had a spreadsheet with a ton of data on it that I wanted in my seeds file. Using example columns in your database titled db_column1, db_column2, db_column3. Place your .xls file into your public folder and run 'gem install roo'
    Ruby 4 views posted 6 years ago by asalgan
  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 1 views posted 6 years ago by dreamstarter
  6. FAV

    Get string between two strings

    If you're using Rails and want to make this a global function, drop this into your application_controller and call it as a function. Example: # get_string_between("hellomyfriendmoto", 'o', 'm') # > myfriend
    Ruby 5 views posted 6 years ago by joshmn
  7. 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 4 views posted 6 years ago by Fivell
  8. 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 3 views posted 6 years ago by mightybs
  9. FAV

    Rake Task for Rails

    = Rake Task for Rails * name: name of the task * desc: description of the task
    Ruby 9 views posted 7 years ago by cliffbraton
  10. 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 2 views posted 8 years ago by skozz
  11. FAV

    Fetch remote JSON in Ruby

    An example method for fetching remote JSON data in Ruby.
    Ruby saved by 8 people 10 views posted 8 years ago by vestimir
  12. FAV

    Uninitialized constant Rake::DSL

    Rails 1 views posted 8 years ago by guhelouis
  13. FAV

    Adding custom MimeTypes into rails format

    Rails 1 views posted 8 years ago by guhelouis
  14. FAV

    Rails request parameters!

    Rails 2 views posted 8 years ago by abstraktor
  15. FAV

    lazyload ruby and rails extensions

    Rails 3 views posted 9 years ago by avioli
  16. FAV

    Data Types for DB, MySQL, SQLite, PHP, Ruby, Rails, JS, etc. because I forget them sometimes

    Data Types for DB, MySQL, SQLite, PHP, Ruby, Rails, JS, etc. because I forget them sometimes from Ruby on Rails Guides: Migrations http://bit.ly/hFWjT0 from Rails Migrations http://bit.ly/hI5zpz
    Other 3 views posted 9 years ago by brandonjp
  17. FAV

    Ruby / Rails - A refresher reference for me because I forget... create project generate scaffold scaffolding migrate db

    Ruby / Rails - A refresher reference for me because I forget how to do this... create project generate scaffold scaffolding migrate db start server
    Ruby 1 views posted 9 years ago by brandonjp
  18. FAV

    Ruby / Rails - links ( full element ) to Show Edit Destroy Delete records in view *.erb

    links (full <a href="#"> element) to Show Edit Destroy Delete records in view *.erb must be in the record loop:
    Ruby 0 views posted 9 years ago by brandonjp
  19. FAV

    Ruby / Rails - general function syntax example

    Ruby 3 views posted 9 years ago by brandonjp
  20. FAV

    Ruby / Rails - example of if then statement... in a view file *.html.erb:

    if then statement... in a view file *.html.erb:
    Ruby 3 views posted 9 years ago by brandonjp
  21. FAV

    fix Library not loaded: libmysqlclient.16.dylib (LoadError)

    Bash 0 views posted 9 years ago by timvdeijnden
  22. 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 4 views posted 9 years ago by gmericksen
  23. FAV

    SQL log in Rails console

    Rails 1 views posted 9 years ago by batamire
  24. 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 1 views posted 9 years ago by gmericksen
  25. FAV

    Start a Rails project using datamapper

    Rails 1 views posted 9 years ago by donaldcook
  26. FAV

    Find ActiveRecord Object Older than One Week Old

    Rails 0 views posted 9 years ago by zackfern
  27. FAV

    Ruby: Importing CSV data into DB with ActiveRecord Validation

    This script is a nice balance between validating data and speed.
    Ruby saved by 3 people 2 views posted 9 years ago by chrisaiv
  28. FAV

    uninstall all ruby gems

    Bash 0 views posted 9 years ago by stayce
  29. FAV

    Rails - Custom Form Builder

    Rails 3 views posted 9 years ago by alx_g
  30. FAV

    Rails - Send emails with Gmail's SMTP

    Ruby saved by 1 person 0 views posted 9 years ago by nhocki
« Prev 1 2 3 4 5 ... 8