Skip to content

Instantly share code, notes, and snippets.

View bbonamin's full-sized avatar
🕶️

Bruno Bonamin bbonamin

🕶️
View GitHub Profile
@bbonamin
bbonamin / I18n devise es
Created May 18, 2011 15:32 — forked from miclovich/I18n devise es
devise I18n file in spanish
es:
errors:
messages:
not_found: 'no encontrado'
already_confirmed: 'ya ha sido confirmada'
not_locked: 'no está bloqueada'
devise:
failure:
unauthenticated: 'Necesitas acceder a tu cuenta o registrarte antes de continuar.'
@bbonamin
bbonamin / order.rb
Created August 1, 2011 09:08 — forked from pcreux/order.rb
active_admin custom collection action with filtering and sorting
ActiveAdmin.register Order do
# Export the current collection of items with filtering and sorting
# List the current collection ids
collection_action :export_txt do
render :text => collection.map { |order| order.id }.join(', ')
end
# Add a button to index page to export current collection as txt
@bbonamin
bbonamin / Gemfile
Created August 10, 2011 22:19 — forked from emzeq/orders.rb
rails3-jquery-autocomplete in ActiveAdmin
gem 'rails3-jquery-autocomplete', '0.9.0'
@bbonamin
bbonamin / flight.rb
Created August 16, 2011 12:01 — forked from geektoo/flight.rb
flights models
class Flight < ActiveRecord::Base
has_many :people
end
@bbonamin
bbonamin / schema.rb
Created September 3, 2011 00:21
Rails multiple association between two models - schema
create_table "flights", :force => true do |t|
t.date "date"
t.integer "pilot_id"
t.integer "instructor_id"
t.integer "glider_id"
t.string "type_of_flight"
t.integer "towplane_pilot_id"
t.integer "towplane_id"
t.integer "departure_airfield_id"
t.integer "arrival_airfield_id"
@bbonamin
bbonamin / Gemfile
Created October 3, 2011 01:52
rails3-jquery-autocomplete in ActiveAdmin?
source 'http://rubygems.org'
gem 'rails3-jquery-autocomplete'
@bbonamin
bbonamin / ability.rb
Created October 5, 2011 15:02 — forked from watson/ability.rb
Active Admin CanCan integration with shared front/backend User model and multi-level autherization
# app/models/ability.rb
# All front end users are authorized using this class
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new
can :read, :all
@bbonamin
bbonamin / rails_admin_and_globalize3.md
Created November 19, 2011 19:16 — forked from Overbryd/rails_admin_and_globalize3.md
RailsAdmin and Globalize3

RailsAdmin and Globalize3

I have a project where I need translated content. Therefore I use globalize3, wich stores its translated attributes in a seperate table that belongs to the original model. And I use RailsAdmin for painless record management.

It took me some time to figure out how to get those working together, but eventually I found a solution that is non invasive and still ok to work with.

The translated model

In my case there is a Snippet class. It holds content for static pages or text passages on the website. There is a good README for globalize3 for installation instructions and documentation.

@bbonamin
bbonamin / es.yml
Created November 27, 2011 20:12
Spanish locale for Formtastic
es:
formtastic:
:yes: 'Sí'
:no: 'No'
:create: 'Crear %{model}'
:update: 'Actualizar %{model}'
:submit: 'Guardar %{model}'
:required: 'requerido'
@bbonamin
bbonamin / aa_error.rb
Created December 2, 2011 10:44
ActiveAdmin routing error
/home/bcb/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.1/lib/action_dispatch/routing/route_set.rb:343:in `add_route': Invalid route name: 'admin_avións' (ArgumentError)
from /home/bcb/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.1/lib/action_dispatch/routing/mapper.rb:385:in `match'
from /home/bcb/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.1/lib/action_dispatch/routing/mapper.rb:1292:in `match'
from /home/bcb/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.1/lib/action_dispatch/routing/mapper.rb:1479:in `match'
from /home/bcb/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.1/lib/action_dispatch/routing/mapper.rb:515:in `map_method'
from /home/bcb/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.1/lib/action_dispatch/routing/mapper.rb:477:in `get'
from /home/bcb/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.1/lib/action_dispatch/routing/mapper.rb:1133:in `block (2 levels) in resources'
from /home/bcb/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.1/lib/action_dispatch/routing/mapper.rb:1171:in `block (2 le