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
ActiveRecord::Base.connection.tables.each do |table| | |
indexes = ActiveRecord::Base.connection.indexes(table) | |
if indexes.length > 0 | |
puts "====> #{table} <====" | |
indexes.each do |ind| | |
puts "----> #{ind.name}" | |
end | |
puts "====> #{table} <====" | |
2.times{ puts ''} | |
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
Here is a simple jQuery plugin to make a table header fixed on top when window is scrolled. | |
Using the code from twitter bootstrap documentation page, this code is customized for table header. | |
Create the table with following layout - | |
<table class="table-fixed-header"> | |
<thead class="header"> | |
<tr> | |
<th>Column 1</th> | |
<th>Column 2</th> | |
<th>Column 3</th> |
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
development: &defaults | |
# Configure available database sessions. (required) | |
sessions: | |
# Defines the default session. (required) | |
default: &default_session | |
# Defines the name of the default database that Mongoid can connect to. | |
# (required). | |
database: delight_development | |
# Provides the hosts the default session can connect to. Must be an array | |
# of host:port pairs. (required) |
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
# disse filene ligger alle under home. eks: /users/oma | |
--- | |
:backtrace: false | |
:benchmark: false | |
:bulk_threshold: 1000 | |
:sources: | |
- http://rubygems.org/ | |
- http://gems.github.com | |
:update_sources: true | |
:verbose: true |
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
<!-- Simple form EXAMPLE using twitter bootstrap | |
Referenced at https://github.com/rubykurs/bootstrap | |
With related gists https://gist.github.com/1698584 and https://gist.github.com/1695634 | |
app/views/reports/_form.html.erb | |
rails generate scaffold report title:string description:text email:string | |
--> |
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/views/common/_flashes.html.erb --> | |
<% unless flash[:notice].blank? %> | |
<div class="alert-message success"> | |
<%= content_tag :div, flash[:notice] %> | |
</div> | |
<% end %> | |
<% unless flash[:error].blank? %> | |
<div class="alert-message error"> |
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
SimpleForm.setup do |config| | |
# Wrappers are used by the form builder to generate a complete input. | |
# You can remove any component from the wrapper, change the order or even | |
# add your own to the stack. The options given to the wrappers method | |
# are used to wrap the whole input (if any exists). | |
config.wrappers :bootstrap, :tag => 'fieldset', :class => 'control-group', :error_class => 'error' do |b| | |
b.use :placeholder | |
b.use :label, :class => 'control-label' | |
b.use :tag => 'div', :class => 'controls' do |ba| | |
ba.use :input |
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/initializers/mongo.rb | |
# | |
# MonkeyPatch to fix the error going on in mongomapper + rails3 + ruby 1.9.2 | |
# | |
MongoMapper::Plugins.class_eval do | |
def plugins | |
@plugins ||= [] | |
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
ruby -v | |
ruby 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0] | |
rails -v | |
Rails 2.3.2 | |
Mac OS X 10.5 | |
(/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/ is used) | |
mysql --version | |
mysql Ver 14.12 Distrib 5.0.67, for apple-darwin9.0.0b5 (i686) using readline 5.1 |