Search posterous

Search all posts and users. Type a name, type a favorite song title, whatever! See what comes up.
  

More posterous blogs











More recommended blogs »

Here are posterous posts filed under rails...

glennrob says...

Here's great rails template snippet to set up .gitignore files throughout your whole Rails project.

It ignores unnecessary files in the root .gitignore, plus it ensures no vendor/ directories are checked into git.

 
run "touch tmp/.gitignore log/.gitignore vendor/.gitignore" 
 
run %{find . -type d -empty | grep -v "vendor" | grep -v ".git" | grep -v "tmp" | xargs -I xxx touch xxx/.gitignore} 
 
file '.gitignore', <<-EOS.gsub(/^ /, '') 
.DS_Store 
log/*.log 
tmp/**/* 
config/database.yml 
config/initializers/site_keys.rb 
db/*.sqlite3 
EOS 
 

Filed under: rails

teeparham says...

As the gem currently stands, Active Merchant's Authorize.net CIM gateway supports 3 transaction types:

      CIM_TRANSACTION_TYPES = {
        :auth_capture => 'profileTransAuthCapture',
        :auth_only => 'profileTransAuthOnly',
        :capture_only => 'profileTransCaptureOnly'
      }

If you make an auth_only call and later make a capture_only call with the same approval code, the second capture_only call will capture unassociated with the initial auth_only. What you want is a prior_auth_capture against the transaction ID from the initial auth_only.

You need this patch from Ben Wiseley:
http://github.com/wiseleyb/active_merchant/commit/608a17bfb4f4f1abc0da8a153f2842e26240d1cc

It adds these new transaction types:        

        :prior_auth_capture => 'profileTransPriorAuthCapture',
        :refund => 'profileTransRefund',
        :void => 'profileTransVoid'

The test code there is excellent. See test_should_create_customer_profile_transaction_auth_only_and_then_prior_auth_capture_request for a simple example of an auth_only followed by a prior_auth_capture.

Note that the fix includes a fix to the parse_direct_response method that is in Shopfiy's head, but not in the gem yet:
http://github.com/Shopify/active_merchant/commit/d05c089cdb383e5dc899da90af79afec5994f89d

I monkey-patched these changes manually by putting the overridden methods in a separate file in my lib directory and requiring that file in my app. There may be a better way but that worked for now.

I'm not sure why this patch has not been merged into the base yet. Here's the ticket:
https://jadedpixel.lighthouseapp.com/projects/11599/tickets/111-void-refund-and-auth_capture-for-authorizenets-cim-gateway

Filed under: rails

glennrob says...

Ok, unless you already have a nice Capistrano deploy script lying around and a tasty Linode/Slicehost VPS, then Heroku http://heroku.com/ may just be the fastest way to get a Rails app deployed on a production system.

Its as easy as;

 
 sudo gem install heroku 
 heroku create 
 git push heroku master 
 heroku rake db:migrate 
 heroku open 

Sit back and watch your app open automagically in your browser.

Also note, Siyelo Fuselage http://github.com/siyelo/fuselage has been updated to be compatible with a Heroku deployment.

Filed under: rails

timmyc says...

So today's chores had me encounter outputting content from our CMS (String) to pdf using PrinceXML.  We are using the fantastic princely plugin to make this task dead simple, but upon initial testing I noticed a tragic absence of images and clickable hyperlinks.  OH NOES!  I whipped up a quick extension to String to take care of the issue:

Once dropped into your lib file of choice, your strings will be equipped to convert relative url's in image source and href tags with ease.

Nothing ground breaking here, just thought someone else might find it useful someday.

Filed under: Rails

pellegrino says...

Neste último sábado, tive a oportunidade de participar da II Ultramaratona How-to de Software Livre apresentando o tutorial de Otimização de aplicações Rails. Mesmo com alguns contratempos, o pessoal da organização está de parabéns pela pronta resposta e pela preocupação e dedicação em fazer da ultramaratona o sucesso que foi.

Seguem os slides da minha apresentação:

Um grande abraço e até a próxima!

Filed under: rails

Bascht says...

This is all pretty understandable: it’s easy to define community in terms of what we’re not. A common enemy focuses and drives us. Competition can take a positive form: when it’s friendly and constructive both communities benefit.

Lately, though, I’ve noticed the tone of the arguments in the Django community getting nastier — especially when it comes to Rails. Again, I’m far from innocent in this regard: I’ve certainly done my fair share of Rails-bashing, and I regret it.

Neat article - seeing Rails from a Django persons view.

Filed under: rails

pellegrino says...

No próximo final de semana dos dias 7 e 8 de novembro de 2009, será realizada a II Ultra maratona how to de Software Livre, dois dias inteiros dedicados a workshops bem práticos sobre os mais diversos assuntos; desde administração de sistemas até RIAs utilizando JQuery.

  • LDAP – Conceitos e Aplicações
  • Welcome to the Django
  • Instalando CACIC – Servidor e Agente
  • Interfaces Gráficas do Shell (Aprofundamento do Zenity)
  • Teste de Invasão em Redes Sem Fio
  • Rails: Otimizando Client-side e Server-side
  • Paravirtualização com XEN no Debian Lenny
  • Nagios: Gerenciando redes de alta disponibilidade
  • Cluster Zimbra de alta disponibilidade com HeartBeat e DRBD
  • RIA com JQuery
  • Conforme o Sylvestre Mergulhão disse em seu post, terei a difícil e honrosa tarefa de substitui-lo na apresentação do how-to Rails Otimizando client e server side. Também estará presente meu amigo Henrique Bastos que apresentará o tutorial sobre Django.

    A maratona ocorre na Rua Martins Ferreira, 71, no bairro de Botafogo, na zona sul do Rio de Janeiro.

    Será uma oportunidade bem legal para se aprender um pouco mais sobre uma gama bem variada de tecnologias. As inscrições devem ser feitas no site do evento . Quem tiver interesse, ainda dá tempo, mas é melhor correr pois as vagas são limitadas e já estão se esgotando!

    O evento é uma grande iniciativa do pessoal da Clavis Segurança da Informação, Tecnohall Soluções em Tecnologia e pela Green Hat Segurança da Informação, com o apoio de diversas instituições como PRODERJ, SEPRORJ, RIOSOFT e ALTEX

    Nos vemos lá! 

    Grande abraço! 

    Filed under: rails

    glennrob says...

    Fuselage takes all the hassle out of installing several popular gems/plugins manually, as well as tidying up the default setup that the "rails" command gives you.

    What's different about Fuselage? A lot of the Rails templates out there at the moment are quite primitive - a bunch of commands & files shoved in to a single file. Fuselage has a separate template for each gem/plugin, allowing you to specify all the relevant installs/commands/files/etc in one place. The goal here is to capture a lot of the setup logic that most Rails gems have in a single, reusable template.

    Fuselage avoids asking a lot of questions, so if you want to customize your install, edit "template.rb" manually.


    Usage is very simple. You can invoke it directly from your "rails -m" command with;

    rails app_name -m http://github.com/siyelo/fuselage/raw/master/template.rb

    (note this does a git clone of Fuselage for you automatically)

    Or if you prefer, grab your own clone from http://github.com/siyelo/fuselage and set the FUSELAGE_DIR environment variable.

    Full feature list

    Currently Fuselage includes the following;

    Rails
    basic template for a clean a rails install
    SCS
    git
    DB + Models
    MySQL
    authlogic
    recaptcha
    paperclip
    Design/Layout
    jQuery
    haml
    sass
    compass + blueprint
    formtastic
    cufon
    friendly_id
    Controllers
    make_resourceful
    will_paginate
    Testing
    machinist
    faker
    cucumber
    rspec
    webrat
    watchr - alternative to autotest
    Search
    thinking-sphinx
    Security
    tarantula
    Metrics
    metric_Fu
    Production
    passenger
    capistrano
    exception_notification


    Extra templates included

    These templates are included, but not installed by default. Manually edit template.rb to include them.

    compass with 960 grid system
    restful_authentication
    forgery
    asset_packager
    whenever

    Filed under: rails

    dchua says...

    I'm thinking of implementing something like how ActionMailer does their dynamic deliver_* methods for this opensource rails messaging plugin I'm currently working on, but I'm not sure how should I go around working it.

    I'm thinking of doing an easy-to-configure HTML templating system that would allow users to customize the output of commonly sent out messages.

    But what do you think? Is it even necessary? Or am I adding code bloat.

    Filed under: rails

    jayfallon says...

    Last friday Eloy and I participated in the Ruby en Rails Rails Rumble 2009, we had 8 hours to write an application which helped developers find out more information about the dependencies in their Rails application.

    Our submission is called Apprise. Apprise is a tool to check gem dependencies and external repositories for newer versions of the currently installed ones in your Rails application.

    To be more specific, it looks for three sources of dependencies. Git and Subversion externals in vendor/plugins and bundled Gems in the Gemfile. Checking for Gem dependencies is delegated to Bundler. If you don’t use Bundler to manage Gem dependencies you will still see outdated externals and submodules.

    Outdated dependencies are listed and you can decide to update the externals, submodules or gems.

    $ apprise                 
    Outdated dependencies
     * forestwatcher (Subversion external)
     * risosu-san (Git submodule)
     * miso (Gem)

    If you want to try it out you can easily install the gem and run the command in the root of your Rails application.

    $ gem install apprise --source http://gemcutter.org

    Unfortunately we did not win, but our patch for Bundler to list outdated gems was pulled by Yehuda Katz right after the competition.

    Apprise is a tool to check gem dependencies and external repositories of the currently installed gems in your Rails application.

    Filed under: Rails