Skip to content

Instantly share code, notes, and snippets.

View ch1ago's full-sized avatar
🏠
Working mostly from home since 2006

Thiago Almeida ch1ago

🏠
Working mostly from home since 2006
  • Mexico City
  • 07:57 (UTC -06:00)
View GitHub Profile
# VALIDAÇÕES
Started GET "/s/check_username?user%5Busername%5D=ma" for 189.10.124.90 at 2010-12-30 10:52:58 -0800
Processing by SiteController#check_username as JSON
Parameters: {"user"=>{"username"=>"ma"}}
Completed 200 OK in 2ms (Views: 0.1ms | ActiveRecord: 1.4ms)
this is my code
Post.select(:id, :user_id, :title).limit(30).includes(:user)
resuls in this sql
Post Load (9.0ms) SELECT "posts".id, "posts".user_id, "posts".title FROM "posts" LIMIT 30
User Load (720.6ms) SELECT "users".* FROM "users" WHERE ("users"."id" IN (5,6,4,1,8,56,83,24,68,2,45,21))
but querying for "users".* is taking too long
is there a way I can select less fields in the includes too?
Started POST "/h/posts" for 127.0.0.1 at 2011-01-02 19:21:03 -0200
Processing by HomeController#posts as */*
Parameters: {"tab"=>"#tab-home", "placement"=>"before", "comparison_post_id"=>"71"}
User Load (395.2ms) SELECT "users".* FROM "users" WHERE ("users"."id" = 3) LIMIT 1
Relationship Load (1.6ms) SELECT "relationships".* FROM "relationships" WHERE ("relationships".user1_id = 3 AND ("relationships"."is_follower" = 't'))
Post Load (105.8ms) SELECT "posts".* FROM "posts" WHERE (id < '71') AND (user_id IN (3,1,4,6,10,8,7,5,29,23,22,31,33,32)) ORDER BY id DESC LIMIT 30
User Load (440.7ms) SELECT "users".* FROM "users" WHERE ("users"."id" IN (1,5,6,10,8,4))
using paperclip, s3, heroku
the file has been saved with another name,
I want to serve the file with the original file
is there a way to?
def display
x = Xlink.where(:micro=>params[:micro]).first || Xlink.new
redirect_to x.file.url(:original, false)
end
<% @players.each do |player| %>
<div
<%= "id='player#{player.id}_box'" %>
<%= "style='display:none'" if player.new_record? %>
>
<%= player.email %>
</div>
<% end %>
Started GET "/1704/ajax_tab_data/1" for 201.14.42.220 at 2011-01-11 16:05:11 -0800
Processing by UsersController#ajax_show_tab_data as */*
Parameters: {"id"=>"1704", "tab_id"=>"1"}
Rendered users/ajax_show_tab_data.html.erb (5.8ms)
Completed 200 OK in 9ms (Views: 4.0ms | ActiveRecord: 3.6ms)
Started GET "/1713/ajax_relation" for 186.215.92.3 at 2011-01-11 16:05:11 -0800
Processing by UsersController#ajax_show_relation as JS
Parameters: {"id"=>"1713"}
the problem is that yield(instance) is yielding the currenct action (index) and it should add methods to the helper method scope
index.html
<%= tabs 1000 do |t| %>
<% t.tab "Tab1" do %>
aaa
#index.html view file
"now it works, I'm passing an string "
<%= tabs 1000 do |t| %>
<% content = capture do %>
aaa
<% end %>
r3@r3:~/apps/nc$
r3@r3:~/apps/nc$ ruby -I"lib:test" "/home/r3/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/unit/user_session_test.rb" "test/unit/helpers/home_helper_test.rb" "test/unit/helpers/site_helper_test.rb" "test/unit/helpers/user_sessions_helper_test.rb" "test/unit/helpers/users_helper_test.rb" "test/unit/helpers/payment_notifications_helper_test.rb" "test/unit/helpers/finance/accounts_helper_test.rb" "test/unit/helpers/finance/balances_helper_test.rb" "test/unit/helpers/finance/transfers_helper_test.rb" "test/unit/helpers/categories_helper_test.rb" "test/unit/helpers/payment_redirection_helper_test.rb" "test/unit/helpers/artists_helper_test.rb" "test/unit/finance/transfer_test.rb" "test/unit/finance/account_test.rb" "test/unit/finance/balance_test.rb" "test/unit/user_test.rb" "test/unit/payment_notification_test.rb" "test/unit/category_test.rb"
Loaded suite /home/r3/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
.F......
Finished in 0.51
Finance::Account Load (0.2ms) SELECT "finance_accounts".* FROM "finance_accounts" LIMIT 2
Finance::Balance Load (0.3ms) SELECT "finance_balances".* FROM "finance_balances" WHERE ("finance_balances".account_id = 298486374) AND ("finance_balances"."money_type" = 'BRL') LIMIT 1
Finance::Account Load (0.2ms) SELECT "finance_accounts".* FROM "finance_accounts" WHERE ("finance_accounts"."id" = 298486374) LIMIT 1
Finance::Balance Load (0.2ms) SELECT "finance_balances"."id" FROM "finance_balances" WHERE ("finance_balances"."money_type" = 'BRL') AND ("finance_balances"."account_id" = 298486374) LIMIT 1
Finance::Balance Load (0.3ms) SELECT "finance_balances".* FROM "finance_balances" WHERE ("finance_balances".account_id = 298486374) AND ("finance_balances"."money_type" = 'BRL') LIMIT 1
Finance::Balance Load (0.2ms) SELECT "finance_balances".* FROM "finance_balances" WHERE ("finance_balances".account_id = 980190962) AND ("finance_balances"."money_type" = 'BRL') LIMIT 1
Finance::Account Load (0.1ms)