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
devise_for :users | |
Started POST "/users/sign_in" for 127.0.0.1 at 2010-10-02 00:10:31 -0300 | |
Processing by Devise::SessionsController#create as HTML | |
Parameters: {"utf8"=>"✓", "authenticity_token"=>"CRun42vZBTbwx2XxzFWg/dYfItt/UIAyuJ9kIkxEvkQ=", "user"=>{"email"=>"[email protected]", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Sign in"} | |
User Load (0.4ms) SELECT "users".* FROM "users" WHERE ("users"."email" = 'admin') LIMIT 1 | |
Completed in 31ms | |
Processing by Devise::SessionsController#new as HTML |
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
Started GET "/" for 127.0.0.1 at 2010-10-02 02:15:44 -0300 | |
Processing by SiteController#index as HTML | |
User Load (0.5ms) SELECT "users".* FROM "users" WHERE ("users"."email" = 'admin') LIMIT 1 | |
Rendered site/index.html.erb within layouts/application (9.8ms) | |
Completed 200 OK in 64ms (Views: 18.5ms | ActiveRecord: 0.5ms) |
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
Started POST "/users/sign_in" for 127.0.0.1 at 2010-10-05 20:07:17 -0300 | |
Processing by Devise::SessionsController#create as HTML | |
see the email... | |
Parameters: {"utf8"=>"✓", "authenticity_token"=>"elrXWCO9RutTWORYs/Z40EJLPJUZ1SLHCPwjWyva44M=", "user"=>{"email"=>"[email protected]", "password"=>"[FILTERED]", "remember_me"=>"1"}, "commit"=>"Sign in"} | |
see the query... | |
User Load (0.6ms) SELECT "users".* FROM "users" WHERE ("users"."email" = 'thiago') LIMIT 1 | |
Completed in 246ms |
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
# encoding: utf-8 | |
class User < ActiveRecord::Base | |
# Include default devise modules. Others available are: | |
# :token_authenticatable, :confirmable, :lockable and :timeoutable | |
devise :database_authenticatable, :registerable, | |
:recoverable, :rememberable, :trackable, :validatable, | |
:lockable | |
attr_accessible :full_name, :gender, :gender_policy, :birth, :birth_policy, | |
:time_zone, :background, :background_repeat_policy, :flavour, :description, |
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 user | |
GENDERS = {'-'=>'0','user.gender.female'=>'1','user.gender.male'=>'2'} | |
<%= select("user", "gender", User::GENDERS) %> | |
<select id="user_gender" name="user[gender]"> | |
<option value="0" selected="selected">-</option> | |
<option value="1">user.gender.female</option> | |
<option value="2">user.gender.male</option> |
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 self.translate_hash_keys(source) | |
r = {} | |
source.each { |k,v| r[I18n.t k] = v } | |
r | |
end | |
BACKGROUND_REPEAT_POLICIES = {0=>'no-repeat',1=>'repeat'}#repeat-X, repeat-Y | |
GENDERS = {'-'=>'0','model.user.gender.female'=>'1','model.user.gender.male'=>'2'} |
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
"/" | |
Started GET "/" for 127.0.0.1 at 2010-11-04 18:23:31 -0200 | |
Processing by SiteController#index as HTML | |
Exist fragment? views/0.0.0.0:3000/site/index (0.4ms) | |
Exist fragment? views/0.0.0.0:3000/site/index (0.0ms) | |
Read fragment views/0.0.0.0:3000/site/index (0.1ms) | |
Rendered parts/_head.html.erb (0.2ms) | |
ActsAsTaggableOn::Tag Load (0.4ms) SELECT name FROM "tags" | |
Carrinho Load (0.4ms) SELECT "carrinhos".* FROM "carrinhos" WHERE ("carrinhos"."session_id" = '61e97791162a21bef5b573198a829671') LIMIT 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
module I18n | |
def self.translate(skey) | |
return 'aaaa' if skey=='a' | |
return super.translate(skey) #this line is wrong, what do I need to do to use the default function again? | |
end | |
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
r = "lala https://gist.github.com/ lele http://github.com/ lili www.google.com/ lolo" | |
urls = r.split(/\s+/).find_all { |u| u =~ /^https?:/ } | |
urls.each do |url| | |
r = r.gsub(url,"<a href='#{url}' target='_blank'>#{url}</a>") | |
end | |
r | |
------------------------- |
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
config.active_record.observers = :user_observer | |
class UserObserver < ActiveRecord::Observer | |
def before_save(user) | |
self.username = self.username.gsub ' ','_' | |
self.email = self.email.downcase | |
end | |
OlderNewer