-
The -j option of the application generator accepts an arbitrary string. If passed "foo", the gem "foo-rails" is added to the Gemfile, and the application JavaScript manifest requires "foo" and "foo_ujs". As of this writing "prototype-rails" and "jquery-rails" exist and provide those files via the asset pipeline. Default is "jquery". [fxn]
-
jQuery is no longer vendored, it is provided from now on by the jquery-rails gem. [fxn]
-
Prototype and Scriptaculous are no longer vendored, they are provided from now on by the prototype-rails gem. [fxn]
-
The scaffold controller will now produce SCSS file if Sass is available [Prem Sichanugrist]
This file contains hidden or 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
states = <<STATES | |
28,AC,Acre | |
28,AL,Alagoas | |
28,AP,Amapá | |
28,AM,Amazonas | |
28,BA,Bahia | |
28,CE,Ceará | |
28,ES,Espírito Santo | |
28,GO,Goiás | |
28,MA,Maranhão |
This file contains hidden or 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
class SendMail < ActionMailer::Base | |
def contact(nome, fone, email, assunto, corpo) | |
recipients '[email protected]' | |
from "SITE: | |
subject assunto | |
sent_on Time.now | |
content_type "text/html" |
These are some of my (Ryan Bates) favorite gems to use for various tasks:
- JavaScript: jQuery with jquery-rails
- Pagination: Kaminari
- Testing: RSpec and Cucumber
- Factories: Factory Girl
- Authentication: Nifty Generators and Omniauth
- Authorization: CanCan
- File Attachments: Carrierwave
- HTML/XML Parsing: Nokogiri
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Dashboard</title> | |
<%= stylesheet_link_tag :all %> | |
<%= javascript_include_tag :all %> | |
<%= csrf_meta_tag %> | |
</head> | |
<body> |
This file contains hidden or 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
require 'yaml' | |
require 'logger' | |
require 'active_record' | |
namespace :db do | |
def create_database config | |
options = {:charset => 'utf8', :collation => 'utf8_unicode_ci'} | |
create_db = lambda do |config| | |
ActiveRecord::Base.establish_connection config.merge('database' => nil) |
This file contains hidden or 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
var FactoryForm = function() { | |
var form = new Ext.form.FormPanel({ | |
width: 400, height: 150, frame: true | |
, defaults : { | |
margins: {top:15, right:0, bottom:0, left:5} | |
} | |
, defaultType: "textfield" | |
, items: [ |
This file contains hidden or 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
var instrutor = function(json, record) { | |
var nome = ""; | |
record.instrutores.forEach(function(inst){ nome += (inst.nome + ", ") }); | |
return nome; | |
} | |
var CursoFactory = Ext.data.Record.create(["id", "nome", "descricao", | |
{name:"instrutores", convert: instrutor}]); | |
var store = new Ext.data.Store({ |
This file contains hidden or 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
Ext.XTemplate.from = function(el){ | |
el = Ext.getDom(el); | |
var string = el.value || el.innerHTML; | |
string = string.replace(/%7B/g, "{").replace(/%7D/g, "}").replace(/%21/g, "!"); | |
return new Ext.XTemplate(string); | |
}; | |
if(!Array.prototype.add) { | |
Array.prototype.add = function(item) { | |
this[this.length] = item; |
This file contains hidden or 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
def tip(msg); puts; puts msg; puts "-"*100; end | |
# | |
# 30 Ruby 1.9 Tips, Tricks & Features: | |
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/ | |
# | |
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2" | |
tip "Ruby 1.9 supports named captures in regular expressions!" |