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
<%= f.text_field :term_start, :type =>"text", :class =>"span2", :placeholder => "Pick the start date", :id =>"dp1" %> | |
<%= f.text_field :term_end, :class =>"span2", :placeholder => "Pick the return date", :id =>"dp2", :value=> "12-02-2013"%> | |
<script> | |
$('#dp1').datepicker({format: 'mm-dd-yyyy'}); | |
$('#dp2').datepicker({format: 'mm-dd-yyyy'}); | |
</script> |
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 create | |
@rental_agreement = RentalAgreement.new(params[:rental_agreement]) | |
# UserMailer.rental_email(current_user, @rental_agreement.tool_id).deliver | |
respond_to do |format| | |
if @rental_agreement.save | |
format.html { redirect_to rental_agreement_path(id: @rental_agreement.id), notice: 'Rental agreement was successfully created.' } | |
format.json { render json: @rental_agreement, status: :created, location: @rental_agreement } | |
else |
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
Started POST "/rental_agreements" for 127.0.0.1 at 2012-12-20 19:16:33 -0500 | |
Processing by RentalAgreementsController#create as HTML | |
Parameters: {"utf8"=>"✓", "authenticity_token"=>"yfiXJUvhXm/8XsmLwNLOYOIVHulcZdQ7dadhvhvAHfo=", "rental_agreement"=>{"term_start"=>"12-10-2012", "term_end"=>"12-02-2013", "agreed_price"=>"2", "owner_id"=>"23", "tool_id"=>"1", "borrower_id"=>"23", "agreed_terms"=>"0"}, "commit"=>"Send Rental Proposal to Owner"} |
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
Started POST "/rental_agreements" for 127.0.0.1 at 2012-12-20 19:19:29 -0500 | |
Processing by RentalAgreementsController#create as HTML | |
Parameters: {"utf8"=>"✓", "authenticity_token"=>"yfiXJUvhXm/8XsmLwNLOYOIVHulcZdQ7dadhvhvAHfo=", "rental_agreement"=>{"term_start"=>"12-15-2012", "term_end"=>"12-19-2013", "agreed_price"=>"", "owner_id"=>"23", "tool_id"=>"1", "borrower_id"=>"23", "agreed_terms"=>"1"}, "commit"=>"Send Rental Proposal to Owner"} | |
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = 23 LIMIT 1 | |
(0.1ms) begin transaction | |
SQL (1.0ms) INSERT INTO "rental_agreements" ("agreed_price", "agreed_terms", "approved", "borrower_id", "created_at", "owner_id", "term_duration_hours", "term_end", "term_start", "tool_id", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [["agreed_price", nil], ["agreed_terms", "1"], ["approved", nil], ["borrower_id", 23], ["created_at", Fri, 21 Dec 2012 00:19:29 UTC +00:00], ["owner_id", 23], ["term_duration_hours", nil], ["term_end", nil], ["term_ |
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 show | |
@user=User.find(params[:id]) | |
@user.set_view_profile(@user.id, false) | |
@rental_agreements = RentalAgreement.where(:owner_id => @user.id) | |
@tools = Tool.where(:user_id => @user.id) | |
respond_to do |format| | |
format.html # show.html.erb | |
format.json { render json: @user } |
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
This is what I get in the terminal: | |
Started GET "/profiles/1" for 127.0.0.1 at 2013-01-06 14:24:07 -0500 | |
Processing by ProfilesController#show as HTML | |
Parameters: {"id"=>"1"} | |
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", "1"]] | |
User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]] | |
RentalAgreement Load (0.3ms) SELECT "rental_agreements".* FROM "rental_agreements" WHERE "rental_agreements"."owner_id" = 1 | |
User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1 | |
(0.2ms) SELECT COUNT(*) FROM "reviews" WHERE "reviews"."user_id" = 1 |
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
## Configuration | |
Geocoder.configure( | |
:timeout => 5, | |
:units => :km | |
) |
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
--- !ruby/hash:Hashie::Mash groups: - !ruby/hash:Hashie::Mash type: places name: Places items: - !ruby/hash:Hashie::Mash id: 4b2afcaaf964a5205bb324e3 name: Starbucks contact: !ruby/hash:Hashie::Mash phone: '6153210262' formattedPhone: (615) 321-0262 twitter: starbucks location: !ruby/hash:Hashie::Mash address: 3005 West End Ave crossStreet: 30th Ave lat: 36.143513 lng: -86.813939 distance: 251 postalCode: '37203' city: Nashville state: TN country: United States cc: US canonicalUrl: https://foursquare.com/v/starbucks/4b2afcaaf964a5205bb324e3 categories: - !ruby/hash:Hashie::Mash id: 4bf58dd8d48988d1e0931735 name: Coffee Shop pluralName: Coffee Shops shortName: Coffee Shop icon: https://foursquare.com/img/categories/food/coffeeshop.png parents: - Food primary: true verified: true restricted: true stats: !ruby/hash:Hashie::Mash checkinsCount: 8828 usersCount: 2370 tipCount: 44 likes: !ruby/hash:Hashie::Mash count: 0 groups: [] menu: !ruby/hash:Hashie::Mash type: foodAndBeverage url: https://foursquare.com/v/star |
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 show | |
@audio_clip = AudioClip.find(params[:id]) | |
@client = Foursquare2::Client.new(:client_id => 'client_id', :client_secret => 'client_secret') | |
@audio_clip.fsvenue = @client.search_venues(:ll => '36.142064,-86.816086') | |
respond_to do |format| | |
format.html # show.html.erb | |
format.json { render json: @audio_clip } | |
end | |
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
#Put Command Sent: | |
curl -i -H "Accept: application/json" -X PUT -d "like_count=5" http://localhost:3000/audio_clips/25.json | |
#Response Received | |
HTTP/1.1 200 OK | |
Content-Type: application/json; charset=utf-8 | |
X-UA-Compatible: IE=Edge | |
ETag: "7ae5757e1b786a3feb1a604a4991df94" |