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 _form.html.erb | |
<%= error_messages_for @books %> | |
<p>Name of book: <%= text_field :name, :size =>"40" %></p> | |
<p><%= " " * 13 %>Author: <%= select :author_id, :collection => Author.all.map {|u| [u.id, full_name(u.first_name, u.last_name)]} %> | |
<p><%= " " * 5 %>Description: <%= text_area :description, :cols => "40", :rows => "2", :wrap => "SOFT" %></p> | |
<p><%= " " * 17 %>Price: <%= text_field :price, :size => "7" %></p> | |
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
[518] Mercredi 17/12/2008 08:07:04 CET +0100 | |
[RubyLearning/Merb/ruby_bookshop | |
$ merb | |
Loading init file from /PortefeuillePartage/Ruby/RubyLearning/Merb/ruby_bookshop/config/init.rb | |
Loading /PortefeuillePartage/Ruby/RubyLearning/Merb/ruby_bookshop/config/environments/development.rb | |
~ Connecting to database... | |
~ Loaded slice 'MerbAuthSlicePassword' ... | |
~ Parent pid: 4178 | |
~ Compiling routes... | |
~ Activating slice 'MerbAuthSlicePassword' ... |
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
rake db:automigrate | |
(in /PortefeuillePartage/Ruby/RubyLearning/Merb/ruby_bookshop) | |
Loading init file from /PortefeuillePartage/Ruby/RubyLearning/Merb/ruby_bookshop/config/init.rb | |
Loading /PortefeuillePartage/Ruby/RubyLearning/Merb/ruby_bookshop/config/environments/development.rb | |
Loading init file from /PortefeuillePartage/Ruby/RubyLearning/Merb/ruby_bookshop/config/init.rb | |
Loading /PortefeuillePartage/Ruby/RubyLearning/Merb/ruby_bookshop/config/environments/rake.rb | |
rake aborted! | |
default store already setup | |
/PortefeuillePartage/Ruby/RubyLearning/Merb/ruby_bookshop/rakefile:24 | |
(See full trace by running task with --trace) |
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
# Main file string_reverse.rb | |
require 'sinatra' | |
helpers do | |
def concatenate_strings(string1, string2) | |
string1 + string2 | |
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
# Main file string_reverse.rb | |
require 'sinatra' | |
helpers do | |
def concatenate_strings(string1, string2) | |
string1 + string2 | |
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
# input_number.rb | |
def input_response(n) | |
answer = "" | |
if n > 0 | |
answer = "positive" | |
elsif n < 0 | |
answer = "negative" | |
else n == 0 | |
answer = "zero" | |
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
#my_rack_mtd.rb | |
require 'rack' | |
error = false | |
def check_argument | |
if (ARGV.length < 1 || ARGV.length > 1 || ARGV[0].split(" ").size < 2) | |
error = true | |
end | |
return error |
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
#my_rack_mtd1.rb | |
# Revisited version | |
require 'rack' | |
def reverse_word_order(env) | |
if (ARGV.length < 1 || ARGV.length > 1 || ARGV[0].split(" ").size < 2) | |
[400, {}, ["Enter one sentence with at least two words to reverse the sentence"]] | |
else | |
[200, {}, [ARGV[0].split(" ").reverse.join(" ")]] |
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.ru | |
require './my_app_bis.rb' | |
run MyAppBis.new | |
# my_app_bis.rb | |
class MyAppBis | |
def initialize() | |
@str = "Is not rackup fun, is it?" | |
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
# my_app_ter.ru | |
use Rack::MethodOverride | |
map '/' do | |
form = <<-HERE | |
<form action="/reverse_word" method="post"> | |
<input name="_method" type="hidden" value="put" /> | |
<input name="sentence" type="text" value="" /> | |
<input type="submit" value="Reverse the words order"> |
OlderNewer