Created
May 28, 2012 14:59
-
-
Save pnegri/2819607 to your computer and use it in GitHub Desktop.
Visão de uma App de Notas com IUGU SDK
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
gem 'iugusdk' |
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
# app/views/my-app/index.html.haml | |
### PSEUDO | |
# Links para 'User Profile', 'Logout' | |
### | |
FORMULARIO DE ENVIO | |
### | |
### foreach @note of @notes | |
## print @note |
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
# config/initializers/iugusdk.rb | |
Iugusdk.setup do |config| | |
# Home page will have just a button, with no forms, no asking for info. Just click "Start Using It" | |
config.auto_create_guest_user = true | |
config.app_main_url = '/my-app' | |
config.default_subscription_name = '1-note' | |
config.multi_account_users = false | |
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
# app/controllers/my-app.rb | |
class MyApp < IuguController::Base | |
def index | |
@notes = @current_account.notes.all | |
end | |
def save | |
@total_notes = @current_account.notes.all.count() | |
if (@total_notes >= @current_account.limits('qtd-notes')) | |
flash[:error] = "You have reach your plan limit" | |
flash[:show_upgrade_options = true | |
redirect_to :action => "index" | |
end | |
@note = Note.create( :params[:note] ) | |
@note.save | |
redirect_to :action => "index" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment