I constantly find myself looking these up, saving this link for future reference
https://github.com/rails/jquery-ujs/wiki/ajax
contains all of the rails custom jQuery events for remote forms, such as "ajax:success", "ajax:before"; also includes the method signatures.
The blog has moved to http://jessehouse.com/ ... Many google searches point here so I am leaving it operational, but there will be no new posts.
Wednesday, December 19, 2012
Sunday, December 16, 2012
Sending email with Rails Mailers, The Random bits...
See the rails guides and railscasts for getting started with Rails Mailers;
this article includes some additional information on Rails Mailers not included in those articles.
RailsCasts: http://railscasts.com/episodes/206-action-mailer-in-rails-3
Rails Guides: "Action Mailer Basics" on the rails guides - The guide covers all of the common mailer tasks
Random Bits
Testing mailer headers with rspec
Use a different layout for some Mailer actions
this article includes some additional information on Rails Mailers not included in those articles.
RailsCasts: http://railscasts.com/episodes/206-action-mailer-in-rails-3
Rails Guides: "Action Mailer Basics" on the rails guides - The guide covers all of the common mailer tasks
- setup and configuration
- attachments
- layouts
Random Bits
These examples were created using rails 3.2
Add importance headers
NOTE: many email clients will ignore these headers
Add receipt header
NOTE: many email clients will ignore these headers
Testing mailer headers with rspec
If you have rspec-rails gem installed with your rails application then running the generator will stub out most of your mailer tests, including a fixture file for the mailer view, which you may or may not want to remove.
NOTE: test against mail.header, not mail.headers
Use a different layout for some Mailer actions
our default layout is the customer facing one but we want to override it in some cases
Labels:
rails
Saturday, November 3, 2012
Setting up a C.I. build (Continuous Integration) for a Ruby on Rails application
It has never been easier than with Semaphore - Hosted Continuous Integration
How easy is it
- add semaphore ssh key to your github repo
- then semaphore automatically determines your ruby version, database, etc...
- you can tweak the build steps later, the defaults are pretty good
It will automatically detect new branches!!! That means zero setup when the new branch is added
It is not cheap, for personal side projects it might not make sense?
But well worth the money if you are doing paid development
Git Log Formatting
The git log command is great and has tons of good information, but the output doesn't give you that nice 'overview' of the commit history, too much detail on too many lines
I've been using the following in my .gitconfig file
Last night I watched the Destroy All Software "PRETTY GIT LOGS" screencast which takes 'git l' to the next level
I've been using the following in my .gitconfig file
l = log -20 --format='%h %ad %d %an: %s' --date=shorttyping 'git l' renders the following output:
Last night I watched the Destroy All Software "PRETTY GIT LOGS" screencast which takes 'git l' to the next level
Labels:
git
Wednesday, October 31, 2012
Helper script to delete git tags locally and remote
Might be useful to others, delete a bunch of git tags - remote and locally
Resources
Resources
- http://nathanhoad.net/how-to-delete-a-remote-git-tag
- http://www.linuxquestions.org/questions/programming-9/bash-read-every-line-in-the-files-and-use-the-line-as-parameters-as-another-program-246291/
- http://stackoverflow.com/questions/1605232/use-bash-to-read-a-file-and-then-execute-a-command-from-the-words-extracted
Labels:
git
Wednesday, September 5, 2012
414 Request-URI Too Large
How to configure nginx to accept larger querystring requests
Increase the 'large_client_header_buffers'
This is located in the 'http' section of the configuration
Example:
http {
# override to allow long query string
large_client_header_buffers 8 512k;
...
}
Resources
- http://stackoverflow.com/questions/1067334/how-to-set-the-allowed-url-length-for-a-nginx-request-error-code-414-uri-too
- http://nginx.2469901.n2.nabble.com/Nginx-returning-414-even-when-large-client-header-buffers-is-set-td7451517.html
- http://wiki.nginx.org/NginxHttpCoreModule#large_client_header_buffers
Saturday, August 25, 2012
Unofficial Twitter Bootstrap Documentation
Unofficial Twitter Bootstrap Documentation
http://unofficial-twitter-bootstrap-documentation.com/
The current project I am working on is running bootstrap 2.0.2 and after the release of 2.1.0 the online documentation for 2.0.x was gone.
I went ahead and compiled the archive docs from the bootstrap github repo into a single site - hopefully others find it useful.
http://unofficial-twitter-bootstrap-documentation.com/
The current project I am working on is running bootstrap 2.0.2 and after the release of 2.1.0 the online documentation for 2.0.x was gone.
I went ahead and compiled the archive docs from the bootstrap github repo into a single site - hopefully others find it useful.
Sunday, July 1, 2012
Rails - ActiveRecord created_by and updated_by gem
Often your application will want to track who created and updated your data.
On a previous rails 2 project I used a plugin called userstamp which worked well, but until recently it did not support rails 3+
I didn't find any other gems out there at the time, so I put together the clerk gem,
you can install it as a gem in your rails 3+ applications by adding gem 'clerk' to your Gemfile, see the README on github for details
NOTE: the current version relies on your database tables having columns named created_by_id and updated_by_id and the gem does not support any custom configuration.
Sunday, April 29, 2012
postgres: random useful things
Run sql statements from the command line, use the -c flag
create a random value
crazy updates using regexp_matches
create a random value
crazy updates using regexp_matches
Labels:
postgresql
postgres: terminate all database connections
Using psql from the command line you can terminate all connections to a database
Comes in handy when you want to do things like restore your staging or development database
Labels:
postgresql
Friday, February 3, 2012
Git Workflow
This is the current git workflow we are using at work, your mileage may vary:
Resources
Resources
- http://cheat.errtheblog.com/s/git
- http://yanpritzker.com/gitbook.html#Keeping+a+topic+branch+in+sync+with+its+parent
- http://yanpritzker.com/gitbook.html#One+branch+per+bug
- http://gitready.com/beginner/2009/02/02/push-and-delete-branches.html
- http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html
- http://sleeplessgeek.blogspot.com/2011/03/using-git-cherry-pick.html
Subscribe to:
Posts (Atom)