Skip to content

Commit

Permalink
conflict solved
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitbhardwaj78 committed Oct 10, 2017
2 parents 77ab9ee + 09e3769 commit b7c784b
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 3 deletions.
28 changes: 26 additions & 2 deletions .byebug_history
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
c
<<<<<<< HEAD
@longitude
@latitude
c
@latitude
c
@latitude
c
@latitude
c
Userdetail.where(user_id: current_user.id)[0].save
Userdetail.where(user_id: current_user.id)[0].address = "adarsh nagar"
Userdetail.where(user_id: current_user.id)[0]
Userdetail.where(user_id: current_user.id)[0].address = "adarsh nagar"
Userdetail.where(user_id: current_user.id)[0].address = adarsh nagar
Userdetail.where(user_id: current_user.id)[0]
current_user
@latitude
latitude
@user.latitude
c
@user.latitude
@user
c
=======
current_user
params
>>>>>>> 3fc7728df5e94d7bcf331a95fdb30e66460ecd1b
@user[0].name
@user[0]
user[1]
Expand All @@ -17,8 +43,6 @@ Userdetail.all
@user.name
@user.profile_picture
@user.coverpic
@user

@user
@user.coverpic
@user
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ gem 'rails', '4.2.8'
gem 'devise'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
gem 'geocoder'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ GEM
erubis (2.7.0)
execjs (2.7.0)
ffi (1.9.18)
geocoder (1.4.4)
globalid (0.4.0)
activesupport (>= 4.2.0)
i18n (0.8.6)
Expand Down Expand Up @@ -176,6 +177,7 @@ DEPENDENCIES
byebug
coffee-rails (~> 4.1.0)
devise
geocoder
jbuilder (~> 2.0)
jquery-rails
jquery-ui-rails
Expand Down
5 changes: 5 additions & 0 deletions app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ def homepage

def profile
@user = Userdetail.where(user_id: current_user.id)[0]

# @latitude = Geocoder.coordinates(Userdetail.where(user_id: current_user.id)[0].address)
@latitude = Geocoder.coordinates( :"bvp,paschim vihar,delhi")[0]
@longitude = Geocoder.coordinates(:"bvp,paschim vihar,delhi")[1]
byebug
end

def upload_image
Expand Down
18 changes: 18 additions & 0 deletions app/models/userdetail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,22 @@ class Userdetail < ActiveRecord::Base
validates :numslots, presence: true
validates :numvacant, presence: true
validates :mobilenum, presence: true

# geocoded_by :address, :latitude => :lat, :longitude => :lon
# geocoded_by :address
# after_validation :geocode
#
# # def address userid
# # Userdetail.where(user_id: userid)[0].address
# # end
#
# def getlatitude userid
# Userdetail.where(user_id: userid)[0].latitude
# end
#
# def getlongitude userid
# Userdetail.where(user_id: userid)[0].longitude
# end


end
6 changes: 6 additions & 0 deletions app/views/home/profile.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@
<h5>User Name: <%= @user.name %></h5><br>
<h5>Email: <%= current_user.email %></h5><br>
</div>


</div>
<div class="col-md-12 contact-left">
<h4><%= %></h4>
</div>

</div>

1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Rails.application.routes.draw do

resources :prices
resources :userdetails
devise_for :users
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class AddLatitudeAndLongitudeToUserdetail < ActiveRecord::Migration
def change
add_column :userdetails, :latitude, :float
add_column :userdetails, :longitude, :float
end
end
4 changes: 3 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20171010122825) do
ActiveRecord::Schema.define(version: 20171010165657) do

create_table "orgcategories", force: :cascade do |t|
t.string "name"
Expand Down Expand Up @@ -43,6 +43,8 @@
t.string "mobilenum"
t.string "profile_picture"
t.string "coverpic"
t.float "latitude"
t.float "longitude"
end

add_index "userdetails", ["user_id"], name: "index_userdetails_on_user_id"
Expand Down

0 comments on commit b7c784b

Please sign in to comment.