Skip to content

Instantly share code, notes, and snippets.

@mdmartinez
Last active November 5, 2015 14:15
Show Gist options
  • Select an option

  • Save mdmartinez/0335873446d75519803a to your computer and use it in GitHub Desktop.

Select an option

Save mdmartinez/0335873446d75519803a to your computer and use it in GitHub Desktop.
## Fresh App Stuff
rails new myapp --database=postgresql -T
## Gemfile add: rspec, factory_girl, capybara, bcrypt
gem 'rspec-rails', '~> 3.0'
## Delete all references to turbolinks
Bundle
rails g rspec:install
# Testing
rspec
rails generate rspec:model widget
# Make a resource
## generate resource
rails g resource User email:string:index password_digest:string
set null: false
## model user
class User < AR::BASE
has_secure_password #bcrpyt helper
end
# json in controller
def index
@tasks = Task.all
respond_to do |format|
format.html
format.json
end
end
# basic api call
function basicApiCall() {
$.ajax({
url: '',
type: 'GET',
data: {}
}).done(function(data){
$('.message').html("<h2>GitHub save success!</h2>");
}).error(function(error) {
$('.message').html("<h2>"+ error +"</h2>");
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment