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
#!/usr/bin/env python | |
# | |
# Copyright 2012 by Jeff Laughlin Consulting LLC | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: |
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
Processing by Admin::UsersController#create as HTML | |
Parameters: {"utf8"=>"✓", "authenticity_token"=>"PIMHQq8QxfL+JFQoOhYwl9GNzGg9rHnyIud2/ws/SJE=", "user"=>{"company_id"=>"2", "username"=>"SOPAOS", "password"=>"[FILTERED]"}, "commit"=>"Create User"} | |
Company Load (0.7ms) SELECT "companies".* FROM "companies" WHERE "companies"."id" = 2 ORDER BY "companies"."id" ASC LIMIT 1 | |
Unpermitted parameters: utf8, authenticity_token, commit | |
(0.2ms) BEGIN | |
User Exists (0.6ms) SELECT 1 AS one FROM "users" WHERE "users"."username" = 'SOPAOS' LIMIT 1 | |
(0.3ms) SELECT COUNT(*) FROM "users" WHERE "users"."company_id" = 2 | |
Company Load (0.3ms) SELECT "companies".* FROM "companies" WHERE "companies"."id" = $1 ORDER BY "companies"."id" ASC LIMIT 1 [["id", 2]] | |
(0.1ms) ROLLBACK | |
Redirected to |
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 _provided_valid_password? | |
params[:user][:password] && UserAuthenticationService.authenticate_with_password!(@user, params[:user][:password]) | |
end | |
class ApiController < ApplicationController | |
before_filter :api_session_token_authenticate! | |
private |
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
NoMethodError at /api/sessions | |
============================== | |
> undefined method `api_session_token_url' for #<Api::SessionsController:0x007fe6bd6db568> | |
app/controllers/api/sessions_controller.rb, line 16 | |
--------------------------------------------------- | |
``` ruby | |
11 if params[:user][:username] |
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
felippe$ curl -v -H 'Authorization' -d 'user="fraposo",password=teste' -X POST http://localhost:3000/api/sessions | |
* Adding handle: conn: 0x7f81a2803a00 | |
* Adding handle: send: 0 | |
* Adding handle: recv: 0 | |
* Curl_addHandleToPipeline: length: 1 | |
* - Conn 0 (0x7f81a2803a00) send_pipe: 1, recv_pipe: 0 | |
* About to connect() to localhost port 3000 (#0) | |
* Trying ::1... | |
* Trying 127.0.0.1... |
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
JQuery -> | |
$('form').on 'click' , '.remove_fields', (event) -> | |
$(this).prev('input[type=hidden]').val(1) | |
$(this).closest('fieldset').hide() | |
event.preventDefault() | |
Depois de gerado ele fica assim: | |
(function() { | |
JQuery(function() { |
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
<script data-turbolinks-track="true" src="/assets/jquery.js?body=1"></script> | |
<script data-turbolinks-track="true" src="/assets/jquery_ujs.js?body=1"></script> | |
<script data-turbolinks-track="true" src="/assets/turbolinks.js?body=1"></script> | |
<script data-turbolinks-track="true" src="/assets/bootstrap.js?body=1"></script> | |
<script data-turbolinks-track="true" src="/assets/projects.js?body=1"></script> | |
<script data-turbolinks-track="true" src="/assets/application.js?body=1"></script> |
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
before_filter :update_sanitized_params, if: :devise_controller? | |
def update_sanitized_params | |
devise_parameter_sanitizer.for(:sign_up) {|u| u.permit(:name,:email, :password, :password_confirmation)} | |
end |
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
gem install rails --debug -V | |
Exception `Errno::ENOENT' at /Users/felippe/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/fileutils.rb:245 - No such file or directory - /Users/felippe/.gem/specs/rubygems.org%443 | |
Exception `Errno::ENOENT' at /Users/felippe/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/fileutils.rb:245 - No such file or directory - | |
Exception `Errno::EEXIST' at /Users/felippe/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/fileutils.rb:245 - File exists - /Users | |
Exception `Errno::EEXIST' at /Users/felippe/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/fileutils.rb:245 - File exists - /Users/felippe | |
Exception `Errno::EEXIST' at /Users/felippe/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/fileutils.rb:245 - File exists - /Users/felippe/.gem | |
Exception `Errno::ENOENT' at /Users/felippe/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/remote_fetcher.rb:287 - No such file or directory - /Users/felippe/.gem/specs/rubygems.org%443/latest_specs.4.8 | |
GET https://rubygems.org/latest_specs.4.8.gz | |
Exception `OpenSSL: |
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
ERROR: Could not find a valid gem 'rails' (>= 0), here is why: | |
Unable to download data from https://rubygems.org/ - SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A (https://rubygems.org/latest_specs.4.8.gz) | |
ERROR: Possible alternatives: rails |
NewerOlder