This file contains 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
# in the partial/view | |
<%= will_paginate(page_results, :previous_label => "<< Précedent", :next_label => "Suivant >>", :params => {:controller => "manifestations", :action => "index"}) %> |
This file contains 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
<% form_for @repository do |f| %> | |
<%= f.error_messages %> | |
<p><%= t(:name) %> : <%= f.text_field :name %></p> | |
<p><%= f.submit t(:submit) %></p> | |
<% end %> |
This file contains 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
<li><a href="/aq_repositories/10">erge</a> <a href="/aq_repositories/10" data-confirm="Are you sure ?" data-method="delete" rel="nofollow">Delete</a></li> |
This file contains 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
# login routes | |
match "/logout" => 'user_sessions#destroy', :as => "logout" | |
match "/login" => 'user_sessions#new', :as => "login" |
This file contains 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 gen_number | |
chars = 'ABCDEFGHJKLMNOPQRSTUVWXYZ123456789' | |
code_temp = '' | |
10.times { |i| code_temp << chars[rand(chars.length)] } | |
code_found = false | |
self.number = code_temp | |
begin | |
if Cart.find_by_number(number) | |
self.gen_number | |
end |
This file contains 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
repo = AqRepository.find(params[:id]) | |
if repo.as_right?(current_user) | |
@repo = repo | |
else | |
flash[:warning] = "You don't have sufficient rights" | |
redirect_to current_user | |
end |
This file contains 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
perishable tokens ? | |
I want to publish invoices after a product checkout. I don't want to send the invoice by email but rather give a link to the user in the email. The file itself is stored on aws s3. | |
By default AWS S3 generates perishable urls when the url method is used (http://amazon.rubyforge.org/) | |
The customers don't have accounts in the shop, they fill up a form every time they buy something on the shop. So they will not have access to a list of their past orders. | |
I'm thinking to use a Token model with something like id, and token attributes, with an attached controller. When the "invoice ready" email is prepared a token is generated (let's say a unique 8 digits string), associated with the invoice object, and a link to the app using that token (http://app/tokens/<token>) is inserted in the email. | |
Then when the customer follow that link the controller redirects to the a fresh S3 url that would perish few minutes later. |
This file contains 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
ree-1.8.7-2010.01 > a.paid(true) | |
=> #<Token id: 4, value: "NF8wM18wNl8yMDEwX01WOHdNMTh3Tmw4eU1ERXc=", expiration_date: nil, cart_id: 23, created_at: "2010-06-03 15:02:15", updated_at: "2010-06-03 15:02:15"> | |
ree-1.8.7-2010.01 > Token.first | |
=> #<Token id: 4, value: nil, expiration_date: nil, cart_id: 23, created_at: "2010-06-03 15:02:15", updated_at: "2010-06-03 15:02:15"> | |
ree-1.8.7-2010.01 > a.token | |
=> #<Token id: 4, value: "NF8wM18wNl8yMDEwX01WOHdNMTh3Tmw4eU1ERXc=", expiration_date: nil, cart_id: 23, created_at: "2010-06-03 15:02:15", updated_at: "2010-06-03 15:02:15"> | |
ree-1.8.7-2010.01 > | |
This file contains 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
Host some.host.ls | |
IdentityFile ~/.ssh/id_some_key | |
User <someuser> |
This file contains 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
upstream thin1 { | |
server 127.0.0.1:3000; | |
} | |
server { | |
listen 80; | |
server_name host1.some.wh; | |
access_log /var/log/nginx/host1.access.log; |
OlderNewer