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
require 'geocoder' | |
require 'csv' | |
require 'pry' | |
ROOT_LOCATION = "New York, New York" | |
FILELOAD = 'location.csv' | |
CSV_FILE_PATH = File.join(File.dirname(__FILE__), FILELOAD) | |
class InRadiusCSV |
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 username=(username) | |
#=> username == 1Boom | |
username.downcase | |
#=> 1boom | |
end | |
@user = User.new(params[:user]) | |
#=> username is blank |
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
id | post_id | user_id| created_at | updated_at | | |
+----+----------+--------+---------------------------+---------------------------+ | |
| 8 | 7 | 1 | 2013-09-07 16:03:50 -0400 | 2013-09-07 16:03:50 -0400 | | |
| 9 | 7 | 2 | 2013-09-07 16:03:50 -0400 | 2013-09-07 16:03:50 -0400 | | |
| 10 | 7 | 3 | 2013-09-07 16:03:50 -0400 | 2013-09-07 16:03:50 -0400 | | |
| 12 | 11 | 1 | 2013-09-07 22:17:49 -0400 | 2013-09-07 22:17:49 -0400 | | |
| 13 | 11 | 6 | 2013-09-07 22:17:49 -0400 | 2013-09-07 22:17:49 -0400 | | |
| 14 | 12 | 1 | 2013-09-14 12:49:56 -0400 | 2013-09-14 12:49:56 -0400 | | |
| 15 | 12 | 3 | 2013-09-14 12:49:56 -0400 | 2013-09-14 12:49:56 -0400 | |
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
get 'posts(/*title)' => 'posts#index', :as => :posts | |
render params.inspect | |
# =>{"controller"=>"posts", "action"=>"index", "title"=>"ok/cool/neat"} | |
# I would like it to render | |
# =>{"controller"=>"posts", "action"=>"index", "title"=>"["ok","cool","neat"]} |
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
id | post_id | user_id | created_at | updated_at | | |
+---+---------+--------+---------------------------+---------------------------+ | |
| 1 | 7 | 1 | 2013-09-07 16:03:50 -0400 | 2013-09-07 16:03:50 -0400 | | |
| 2 | 7 | 2 | 2013-09-07 16:03:50 -0400 | 2013-09-07 16:03:50 -0400 | | |
| 3 | 7 | 3 | 2013-09-07 16:03:50 -0400 | 2013-09-07 16:03:50 -0400 | | |
| 4 | 8 | 2 | 2013-09-07 22:17:49 -0400 | 2013-09-07 22:17:49 -0400 | | |
| 5 | 8 | 3 | 2013-09-07 22:17:49 -0400 | 2013-09-07 22:17:49 -0400 | | |
| 6 | 8 | 6 | 2013-09-07 22:17:49 -0400 | 2013-09-07 22:17:49 -0400 | | |
| 7 | 12 | 3 | 2013-09-14 12:49:56 -0400 | 2013-09-14 12:49:56 -0400 | |
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
[1] pry(#<#<Class:0x007fde0db9ae90>>)> params | |
=> {"posts"=>"", "controller"=>"news", "action"=>"index"} | |
[2] pry(#<#<Class:0x007fde0db9ae90>>)> request.params | |
=> {"posts"=>"", "controller"=>"news", "action"=>"index"} | |
[3] pry(#<#<Class:0x007fde0db9ae90>>)> request.url | |
=> "http://localhost:3000/news?posts=%23titlehere" |
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
#encoding: utf-8 | |
VALID_REGEX = /\A[a-zA-Z\s\d,-\?!&:0-9+\(\)]+\z\p{Hangul}\p{Han}/i |
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
get ':user_id/posts/:post_id/' => "users#show", :controller => "users", :action => "show, :as => "user_home" | |
#now | |
user_home_path(current_user.id, @post.id) | |
#would like | |
user_home_path(current_user.id) | |
and have the current_user.posts.last.id to be the post that is returned |
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
require 'spec_helper' | |
describe "Show page" do | |
subject { page } | |
describe "show page" do | |
let(:user) { create(:user) } | |
before { visit user_home_path} | |
binding.pry | |
it { should have_content(user.username.capitalize) } |
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
1.9.3p194 :001 > a,b,c = [1,2,3] | |
=> [1, 2, 3] | |
1.9.3p194 :002 > a | |
=> 1 | |
1.9.3p194 :003 > b | |
=> 2 | |
1.9.3p194 :004 > c | |
=> 3 |