This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
group :development do | |
gem 'quiet_assets' # Remove useless logs | |
# Debugging in the browser | |
gem 'better_errors' | |
gem 'binding_of_caller' | |
gem 'meta_request' | |
gem 'guard-livereload' | |
gem 'seed_dump' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif *.svg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rails 4.0 just went out and right now to make ActiveAdmin works, you need | |
# to add this in your Gemfile | |
gem 'devise', github: 'plataformatec/devise' | |
gem 'responders', github: 'plataformatec/responders' | |
gem 'inherited_resources', github: 'josevalim/inherited_resources' | |
gem 'ransack', github: 'ernie/ransack', branch: 'rails-4' | |
gem 'activeadmin', github: 'gregbell/active_admin', branch: 'rails4' | |
gem 'formtastic', github: 'justinfrench/formtastic' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rebuild database from schema.rb | |
rake db:reset | |
# But this rebuild database from all migrations | |
rake db:drop db:create db:migrate db:seed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActiveAdmin.register Project do | |
# Don't forget to add the image attribute (here thumbnails) to permitted_params | |
controller do | |
def permitted_params | |
params.permit project: [:title, :summary, :description, :thumbnail, :date, :url, :client_list, :technology_list, :type_list] | |
end | |
end | |
form do |f| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActiveAdmin.register Project do | |
controller do | |
def permitted_params | |
params.permit project: [:title, :summary, :description, :thumbnail, :date, :url, :client_list, :technology_list, :type_list, :images_attributes => [:picture, :id, :_destroy]] | |
# to add unlimited :image, you need to permit :images_attributes => [:picture, :id, :_destroy] | |
# - picture for the image | |
# - id to avoid duplicates | |
# - _destroy if you want to allow image delete | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RSpec::Matchers.define :match_exactly do |expected_match_count, selector| | |
match do |context| | |
matching = context.all(selector) | |
@matched = matching.size | |
@matched == expected_match_count | |
end | |
failure_message_for_should do | |
"expected '#{selector}' to match exactly #{expected_match_count} elements, but matched #{@matched}" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# It extends activeadmin to show pretty boolean values | |
# | |
# config/initializers/active_admin.rb | |
module ActiveAdmin | |
module Views | |
class TableFor | |
def bool_column(attribute) | |
column(attribute){ |model| model[attribute] ? '✔'.html_safe : '✗'.html_safe } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#app/models/event.rb | |
class Event < ActiveRecord::Base | |
translates :title, :description, :summary | |
has_many :event_translations | |
accepts_nested_attributes_for :event_translations, :allow_destroy => true | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is copied to spec/ when you run 'rails generate rspec:install' | |
ENV["RAILS_ENV"] ||= 'test' | |
require File.expand_path("../../config/environment", __FILE__) | |
require 'rspec/rails' | |
require 'rspec/autorun' | |
require 'capybara/rspec' | |
require 'capybara/poltergeist' | |
require 'database_cleaner' | |
# Requires supporting ruby files with custom matchers and macros, etc, |
OlderNewer