Commit b49a475
Changed files (20)
app
controllers
helpers
models
config
initializers
db
features
step_definitions
support
spec
controllers
features
models
routing
support
app/controllers/concerns/pageable.rb
@@ -1,6 +1,6 @@
module Pageable
extend ActiveSupport::Concern
- DEFAULT_PER_PAGE=12
+ DEFAULT_PER_PAGE = 12
def page
(params[:page] || 1).to_i
app/controllers/gyms_controller.rb
@@ -4,7 +4,9 @@ class GymsController < ApplicationController
before_action only: [:index] { @remote_search = true }
def index
- @gyms = paginate(Gym.closest_to(current_session.location).search_with(params))
+ @gyms = paginate(
+ Gym.closest_to(current_session.location).search_with(params)
+ )
end
def new
app/controllers/registrations_controller.rb
@@ -6,9 +6,10 @@ class RegistrationsController < PublicController
def create
@user = User.new(secure_params)
if @user.save
- session[:user_id] = User.
- login(secure_params[:username], secure_params[:password]).
- access(request)
+ session[:user_id] = User.login(
+ secure_params[:username],
+ secure_params[:password]
+ ).access(request)
UserMailer.registration_email(@user).deliver_later
flash[:notice] = translate(".success")
redirect_to dashboard_path
app/helpers/application_helper.rb
@@ -1,7 +1,7 @@
module ApplicationHelper
VIDEOS=[
- 'ua8oObEPptQ',
- 'txuWGoZF3ew',
+ "ua8oObEPptQ",
+ "txuWGoZF3ew",
]
def gravatar_for(user, size: 260)
secure_host = "https://secure.gravatar.com/avatar"
@@ -12,7 +12,7 @@ module ApplicationHelper
end
def search_form(
- id: 'search-form',
+ id: "search-form",
path: @search_path || dashboard_path,
remote: @remote_search
)
app/models/gym.rb
@@ -15,10 +15,10 @@ class Gym < ActiveRecord::Base
end
scope :search, ->(query) do
- sql = 'UPPER(gyms.name) LIKE :query' +
- ' OR UPPER(locations.city) LIKE :query' +
- ' OR UPPER(locations.region) LIKE :query' +
- ' OR UPPER(locations.country) LIKE :query'
+ sql = "UPPER(gyms.name) LIKE :query" +
+ " OR UPPER(locations.city) LIKE :query" +
+ " OR UPPER(locations.region) LIKE :query" +
+ " OR UPPER(locations.country) LIKE :query"
joins(:location).where(sql, { query: "%#{query.upcase}%" })
end
@@ -40,7 +40,7 @@ class Gym < ActiveRecord::Base
end
end
- def self.search_yelp(q: 'gym', categories: ['gyms'], city: , page: 1, per_page: 20)
+ def self.search_yelp(q: "gym", categories: ["gyms"], city: , page: 1, per_page: 20)
Search.yelp(q, categories, city, page, per_page) do |result|
Gym.new(
name: result.name,
app/models/search.rb
@@ -2,8 +2,8 @@ class Search
def self.yelp(q, categories = [], city, page, per_page, &block)
key = "#{q}-#{city}-#{page}-#{per_page}"
Rails.cache.fetch(key, expires_in: 1.hour) do
- city = city.present? ? city : 'Calgary'
- categories = categories.present? ? categories.join(',') : 'fitness'
+ city = city.present? ? city : "Calgary"
+ categories = categories.present? ? categories.join(",") : "fitness"
offset = (page * per_page) - per_page
Kaminari.paginate_array(
Yelp.client.search(city, {
app/models/user_session.rb
@@ -2,7 +2,7 @@ class UserSession < ActiveRecord::Base
has_one :location, as: :locatable
belongs_to :user
scope :active, -> do
- where('accessed_at > ?', 2.weeks.ago).where(revoked_at: nil)
+ where("accessed_at > ?", 2.weeks.ago).where(revoked_at: nil)
end
def revoke!
config/initializers/flipper.rb
@@ -1,4 +1,4 @@
-require 'flipper'
-require 'flipper/adapters/redis'
+require "flipper"
+require "flipper/adapters/redis"
$flipper = Flipper.new(Flipper::Adapters::Redis.new(Redis.new))
config/i18n-tasks.yml
@@ -69,6 +69,8 @@ search:
ignore_missing:
- views.pagination.*
+ignore_unused:
+ - activerecord.*
## Consider these keys used
# ignore_unused:
# - 'activerecord.attributes.*'
db/migrate/20160430155822_create_user_sessions.rb
@@ -1,7 +1,11 @@
class CreateUserSessions < ActiveRecord::Migration
def change
create_table :user_sessions, id: :uuid do |t|
- t.belongs_to :user, foreign_key: true, type: :uuid, index: true, null: false
+ t.belongs_to :user,
+ foreign_key: true,
+ type: :uuid,
+ index: true,
+ null: false
t.string :ip
t.text :user_agent
t.datetime :accessed_at
features/step_definitions/authentication_steps.rb
@@ -1,6 +1,6 @@
-Given /^the user is logged in$/ do
- user = FactoryGirl.create(:user, password: 'password')
+Given(/^the user is logged in$/) do
+ user = FactoryGirl.create(:user, password: "password")
login_page = LoginPage.new
login_page.visit_page
- login_page.login_with(user.username, 'password')
+ login_page.login_with(user.username, "password")
end
features/step_definitions/gym_steps.rb
@@ -1,21 +1,21 @@
-When /^the user is on the gyms page$/ do
+When(/^the user is on the gyms page$/) do
@subject = GymsPage.new
@subject.visit_page
end
-And /^There are (.*) gyms$/ do |n|
+And(/^There are (.*) gyms$/) do |n|
@gyms = n.to_i.times.map do
FactoryGirl.create(:gym)
end
end
-Then /^it lists all gyms$/ do
+Then(/^it lists all gyms$/) do
@gyms.each do |gym|
expect(@subject).to have_content(gym.name)
end
end
-When /^they search for a city/ do
+When(/^they search for a city/) do
gym = @gyms.sample
@subject.search(gym.location.city)
@gyms = [gym]
features/step_definitions/registration_steps.rb
@@ -1,9 +1,9 @@
-Given /^the user is on the registration page$/ do
+Given(/^the user is on the registration page$/) do
@subject = NewRegistrationPage.new
@subject.visit_page
end
-When /^they enter a (.*), (.*) and (.*)$/ do |username, email, password|
+When(/^they enter a (.*), (.*) and (.*)$/) do |username, email, password|
@subject.register_with(
username: username,
email: email,
@@ -11,18 +11,18 @@ When /^they enter a (.*), (.*) and (.*)$/ do |username, email, password|
)
end
-When /^the username (.*) is already registered$/ do |username|
+When(/^the username (.*) is already registered$/) do |username|
FactoryGirl.create(:user, username: username)
end
-When /^the email (.*) is already registered$/ do |email|
+When(/^the email (.*) is already registered$/) do |email|
FactoryGirl.create(:user, email: email)
end
-Then /^it redirects them to the dashboard$/ do
+Then(/^it redirects them to the dashboard$/) do
expect(@subject.current_path).to eql(dashboard_path)
end
-Then /^it displays the following (.*)$/ do |text|
- expect(@subject).to have_content(text.gsub(/["'<>]/, ''))
+Then(/^it displays the following (.*)$/) do |text|
+ expect(@subject).to have_content(text.gsub(/["'<>]/, ""))
end
features/support/env.rb
@@ -1,55 +1,9 @@
-# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
-# It is recommended to regenerate this file in the future when you upgrade to a
-# newer version of cucumber-rails. Consider adding your own code to a new file
-# instead of editing this one. Cucumber will automatically load all features/**/*.rb
-# files.
-
-require 'cucumber/rails'
+require "cucumber/rails"
require "capybara/poltergeist"
$flipper.enable(:gym)
-# Capybara defaults to CSS3 selectors rather than XPath.
-# If you'd prefer to use XPath, just uncomment this line and adjust any
-# selectors in your step definitions to use the XPath syntax.
-# Capybara.default_selector = :xpath
-
-# By default, any exception happening in your Rails application will bubble up
-# to Cucumber so that your scenario will fail. This is a different from how
-# your application behaves in the production environment, where an error page will
-# be rendered instead.
-#
-# Sometimes we want to override this default behaviour and allow Rails to rescue
-# exceptions and display an error page (just like when the app is running in production).
-# Typical scenarios where you want to do this is when you test your error pages.
-# There are two ways to allow Rails to rescue exceptions:
-#
-# 1) Tag your scenario (or feature) with @allow-rescue
-#
-# 2) Set the value below to true. Beware that doing this globally is not
-# recommended as it will mask a lot of errors for you!
-#
ActionController::Base.allow_rescue = false
-
DatabaseCleaner.strategy = :transaction
-
-# You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios.
-# See the DatabaseCleaner documentation for details. Example:
-#
-# Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do
-# # { :except => [:widgets] } may not do what you expect here
-# # as Cucumber::Rails::Database.javascript_strategy overrides
-# # this setting.
-# DatabaseCleaner.strategy = :truncation
-# end
-#
-# Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do
-# DatabaseCleaner.strategy = :transaction
-# end
-#
-
Capybara.javascript_driver = :poltergeist
-# Possible values are :truncation and :transaction
-# The :transaction strategy is faster, but might give you threading problems.
-# See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature
Cucumber::Rails::Database.javascript_strategy = :truncation
Dir[Rails.root.join("spec/support/pages/*.rb")].each { |x| require x }
spec/controllers/gyms_controller_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require "rails_helper"
describe GymsController do
let(:user) { create(:user) }
@@ -10,27 +10,27 @@ describe GymsController do
end
describe "#index" do
- let!(:sait) { create(:gym, name: 'sait', location: create(:portland)) }
- let!(:world_health) { create(:gym, name: 'world health', location: create(:portland)) }
+ let!(:sait) { create(:gym, name: "sait", location: create(:portland)) }
+ let!(:world_health) { create(:gym, name: "world health", location: create(:portland)) }
- it 'returns a list of gyms' do
+ it "returns a list of gyms" do
get :index
expect(assigns(:gyms)).to match_array([sait, world_health])
expect(response).to be_ok
end
- it 'returns matching results' do
- get :index, q: 'sait'
+ it "returns matching results" do
+ get :index, q: "sait"
expect(assigns(:gyms)).to match_array([sait])
expect(response).to be_ok
end
- it 'returns matches from yelp' do
+ it "returns matches from yelp" do
gym = build(:gym)
allow(Search).to receive(:yelp).and_return(Kaminari.paginate_array([gym]))
- get :index, q: 'sait', source: 'yelp'
+ get :index, q: "sait", source: "yelp"
expect(assigns(:gyms)).to match_array([gym])
expect(response).to be_ok
@@ -38,17 +38,17 @@ describe GymsController do
end
describe "#new" do
- it 'loads the new page' do
+ it "loads the new page" do
get :new
expect(response).to be_ok
expect(assigns(:gym)).to be_instance_of(Gym)
expect(assigns(:gym).location).to be_present
end
- it 'loads the available countries' do
+ it "loads the available countries" do
get :new
expect(assigns(:countries).count).to eql(248)
- expect(assigns(:countries)).to include(["Canada", "CA"])
+ expect(assigns(:countries)).to include(%w{Canada CA})
end
end
@@ -56,44 +56,44 @@ describe GymsController do
context "valid params" do
before :each do
post :create, gym: {
- name: 'SAIT',
+ name: "SAIT",
location_attributes: {
- address: '1301 16 Ave NW',
- city: 'Calgary',
- region: 'AB',
- country: 'CA',
- postal_code: 'T2M 0L4',
+ address: "1301 16 Ave NW",
+ city: "Calgary",
+ region: "AB",
+ country: "CA",
+ postal_code: "T2M 0L4",
}
}
end
- it 'redirects to the listing page' do
- expect(response).to redirect_to(gyms_path(q: 'SAIT'))
+ it "redirects to the listing page" do
+ expect(response).to redirect_to(gyms_path(q: "SAIT"))
end
- it 'creates a new gym' do
+ it "creates a new gym" do
expect(Gym.count).to eql(1)
gym = Gym.last
- expect(gym.name).to eql('SAIT')
+ expect(gym.name).to eql("SAIT")
expect(gym.location).to be_present
- expect(gym.location.address).to eql('1301 16 Ave NW')
- expect(gym.location.city).to eql('Calgary')
- expect(gym.location.region).to eql('AB')
- expect(gym.location.country).to eql('CA')
- expect(gym.location.postal_code).to eql('T2M 0L4')
+ expect(gym.location.address).to eql("1301 16 Ave NW")
+ expect(gym.location.city).to eql("Calgary")
+ expect(gym.location.region).to eql("AB")
+ expect(gym.location.country).to eql("CA")
+ expect(gym.location.postal_code).to eql("T2M 0L4")
end
end
context "invalid params" do
before :each do
- post :create, gym: { name: '' }
+ post :create, gym: { name: "" }
end
- it 'displays an error' do
+ it "displays an error" do
expect(flash[:error]).to eql(assigns(:gym).errors.full_messages)
end
- it 'renders the form with the original values entered' do
+ it "renders the form with the original values entered" do
expect(response).to render_template(:new)
expect(assigns(:gym)).to be_present
end
spec/features/gyms_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require "rails_helper"
feature "Gyms", type: :feature do
let(:user_session) { create(:active_session, location: create(:calgary)) }
@@ -9,17 +9,17 @@ feature "Gyms", type: :feature do
feature "viewing gyms" do
subject { GymsPage.new }
- let!(:calgary_gym) { create(:gym, name: 'sait', location: create(:calgary)) }
- let!(:edmonton_gym) { create(:gym, name: 'nait', location: create(:edmonton)) }
+ let!(:calgary_gym) { create(:gym, name: "sait", location: create(:calgary)) }
+ let!(:edmonton_gym) { create(:gym, name: "nait", location: create(:edmonton)) }
- it 'loads the gyms closest to you' do
+ it "loads the gyms closest to you" do
subject.visit_page
expect(subject).to be_on_page
expect(subject).to have_content(calgary_gym.name)
expect(subject).not_to have_content(edmonton_gym.name)
end
- it 'loads all the gyms' do
+ it "loads all the gyms" do
user_session.location.update_attributes(latitude: 0.0, longitude: 0.0)
subject.visit_page
expect(subject).to be_on_page
@@ -28,9 +28,9 @@ feature "Gyms", type: :feature do
end
describe "search" do
- let!(:other_calgary_gym) { create(:gym, name: 'world health', location: create(:calgary)) }
+ let!(:other_calgary_gym) { create(:gym, name: "world health", location: create(:calgary)) }
- it 'returns gyms that match the search criteria', js: true do
+ it "returns gyms that match the search criteria", js: true do
subject.visit_page
subject.search("sait")
@@ -41,30 +41,29 @@ feature "Gyms", type: :feature do
end
end
-
feature "adding a gym" do
subject { NewGymPage.new }
- it 'saves a new gym' do
+ it "saves a new gym" do
subject.visit_page
subject.change(
- name: 'SAIT',
- address: '1301 16 Ave NW',
- city: 'Calgary',
- region: 'AB',
- country: 'Canada',
- postal_code: 'T2M 0L4',
+ name: "SAIT",
+ address: "1301 16 Ave NW",
+ city: "Calgary",
+ region: "AB",
+ country: "Canada",
+ postal_code: "T2M 0L4",
)
expect(Gym.count).to eql(1)
gym = Gym.last
- expect(gym.name).to eql('SAIT')
+ expect(gym.name).to eql("SAIT")
expect(gym.location).to be_present
- expect(gym.location.address).to eql('1301 16 Ave NW')
- expect(gym.location.city).to eql('Calgary')
- expect(gym.location.region).to eql('AB')
- expect(gym.location.country).to eql('CA')
- expect(gym.location.postal_code).to eql('T2M 0L4')
+ expect(gym.location.address).to eql("1301 16 Ave NW")
+ expect(gym.location.city).to eql("Calgary")
+ expect(gym.location.region).to eql("AB")
+ expect(gym.location.country).to eql("CA")
+ expect(gym.location.postal_code).to eql("T2M 0L4")
end
end
end
spec/models/gym_spec.rb
@@ -1,10 +1,10 @@
-require 'rails_helper'
+require "rails_helper"
describe Gym do
subject { build(:gym) }
describe "#validations" do
- it 'validates the presence of name' do
+ it "validates the presence of name" do
subject.name = nil
expect(subject).to be_invalid
expect(subject.errors[:name]).to be_present
@@ -12,19 +12,19 @@ describe Gym do
end
describe "#location" do
- it 'updates the location' do
+ it "updates the location" do
subject.location_attributes = {
- address: '123 street sw',
- city: 'edmonton',
- region: 'alberta',
- country: 'canada',
+ address: "123 street sw",
+ city: "edmonton",
+ region: "alberta",
+ country: "canada",
}
subject.save!
- expect(subject.location.address).to eql('123 street sw')
- expect(subject.location.city).to eql('edmonton')
- expect(subject.location.region).to eql('alberta')
- expect(subject.location.country).to eql('canada')
+ expect(subject.location.address).to eql("123 street sw")
+ expect(subject.location.city).to eql("edmonton")
+ expect(subject.location.region).to eql("alberta")
+ expect(subject.location.country).to eql("canada")
end
end
@@ -34,71 +34,71 @@ describe Gym do
let!(:calgary_gym) { create(:gym, location: calgary) }
let!(:edmonton_gym) { create(:gym, location: edmonton) }
- it 'returns gyms near the location' do
+ it "returns gyms near the location" do
results = Gym.closest_to(calgary)
expect(results).to match_array([calgary_gym])
end
- it 'returns all the gyms' do
+ it "returns all the gyms" do
results = Gym.closest_to(nil)
expect(results).to match_array([calgary_gym, edmonton_gym])
end
- it 'returns all the gym when coordinates are empty' do
+ it "returns all the gym when coordinates are empty" do
results = Gym.closest_to(build(:no_where))
expect(results).to match_array([calgary_gym, edmonton_gym])
end
end
- describe '.search_with' do
- let!(:calgary_gym) { create(:gym, name: 'SAIT', location: create(:calgary)) }
- let!(:edmonton_gym) { create(:gym, name: 'NAIT', location: create(:edmonton)) }
- let!(:portland_gym) { create(:gym, name: '24 Hour Fitness', location: create(:portland)) }
+ describe ".search_with" do
+ let!(:calgary_gym) { create(:gym, name: "SAIT", location: create(:calgary)) }
+ let!(:edmonton_gym) { create(:gym, name: "NAIT", location: create(:edmonton)) }
+ let!(:portland_gym) { create(:gym, name: "24 Hour Fitness", location: create(:portland)) }
- it 'returns all gyms' do
+ it "returns all gyms" do
results = Gym.search_with({})
expect(results).to match_array([calgary_gym, edmonton_gym, portland_gym])
end
- it 'returns gyms with a matching name' do
- results = Gym.search_with(q: 'sait')
+ it "returns gyms with a matching name" do
+ results = Gym.search_with(q: "sait")
expect(results).to match_array([calgary_gym])
end
- it 'returns all gyms from a city' do
- results = Gym.search_with(q: 'calgary')
+ it "returns all gyms from a city" do
+ results = Gym.search_with(q: "calgary")
expect(results).to match_array([calgary_gym])
end
- it 'returns all gyms from a region' do
- results = Gym.search_with(q: 'AB')
+ it "returns all gyms from a region" do
+ results = Gym.search_with(q: "AB")
expect(results).to match_array([calgary_gym, edmonton_gym])
end
- it 'returns all gyms from a country' do
- results = Gym.search_with(q: 'US')
+ it "returns all gyms from a country" do
+ results = Gym.search_with(q: "US")
expect(results).to match_array([portland_gym])
end
end
- describe ".search_yelp", skip: !ENV['YELP_CONSUMER_KEY'].present? do
- it 'returns results' do
+ describe ".search_yelp", skip: !ENV["YELP_CONSUMER_KEY"].present? do
+ it "returns results" do
results = Gym.search_yelp(city: "Calgary")
expect(results).to be_present
expect(results.count).to be > 0
expect(results.first).to be_instance_of(Gym)
end
- it 'returns the next page of results' do
+ it "returns the next page of results" do
results = Gym.search_yelp(city: "Calgary", page: 2)
expect(results).to be_present
expect(results.count).to be > 0
expect(results.first).to be_instance_of(Gym)
end
- it 'finds a college gym' do
+ it "finds a college gym" do
expect(Gym.search_yelp(
- q: 'SAIT',
+ q: "SAIT",
city: "Calgary",
categories: ["gyms", "stadiumsarenas"]
).map(&:name)).to match_array(["Sait Campus Centre"])
@@ -108,7 +108,7 @@ describe Gym do
describe "#full_address" do
let(:location) { build(:location) }
- it 'returns the full address' do
+ it "returns the full address" do
subject.location = location
expected = "#{location.address}, " +
"#{location.city}, " +
@@ -119,7 +119,7 @@ describe Gym do
end
describe "#duplicate?" do
- it 'returns true when a dup is found' do
+ it "returns true when a dup is found" do
subject.location = create(:portland)
subject.save!
other = create(:gym, location: create(:portland))
@@ -127,7 +127,7 @@ describe Gym do
expect(subject.duplicate?).to be_truthy
end
- it 'returns false when no dups are found' do
+ it "returns false when no dups are found" do
subject.location = create(:portland)
subject.save!
expect(subject.duplicate?).to be_falsey
spec/models/location_spec.rb
@@ -1,10 +1,10 @@
-require 'rails_helper'
+require "rails_helper"
describe Location do
- describe '.from' do
- it 'returns the correct lat/long' do
+ describe ".from" do
+ it "returns the correct lat/long" do
latitude, longitude = Location.
- from('1301 16 Ave NW', 'Calgary', 'AB', 'Canada')
+ from("1301 16 Ave NW", "Calgary", "AB", "Canada")
expect(latitude).to be_within(0.1).of(51.0647815)
expect(longitude).to be_within(0.1).of(-114.0927691)
@@ -15,14 +15,14 @@ describe Location do
let(:latitude) { rand(90.0) }
let(:longitude) { rand(180.0) }
- it 'assigns a lat/long' do
+ it "assigns a lat/long" do
allow(Location).to receive(:from).and_return([latitude, longitude])
location = Location.new(
- address: '123 street sw',
- city: 'edmonton',
- region: 'alberta',
- country: 'canada',
+ address: "123 street sw",
+ city: "edmonton",
+ region: "alberta",
+ country: "canada",
)
location.save!
@@ -32,7 +32,7 @@ describe Location do
end
describe ".build_from_ip" do
- it 'returns a location from the ip address' do
+ it "returns a location from the ip address" do
result = Location.build_from_ip("70.173.137.232")
expect(result).to be_instance_of(Location)
expect(result.address).to include("Las Vegas")
@@ -44,14 +44,14 @@ describe Location do
expect(result.longitude).to be_within(0.2).of(-115.1)
end
- it 'returns a location from the ip address' do
+ it "returns a location from the ip address" do
result = Location.build_from_ip("127.0.0.1")
expect(result).to be_instance_of(Location)
end
end
describe "#coordinates" do
- it 'returns the lat/long' do
+ it "returns the lat/long" do
subject.latitude, subject.longitude = rand(90.0), rand(180.0)
expect(subject.coordinates).to eql([
subject.latitude,
@@ -59,7 +59,7 @@ describe Location do
])
end
- it 'returns an empty array' do
+ it "returns an empty array" do
subject = Location.build_from_ip("172.18.0.1")
expect(subject.coordinates).to be_empty
end
spec/routing/gyms_routing_spec.rb
@@ -1,7 +1,7 @@
-require 'rails_helper'
+require "rails_helper"
describe "/gyms" do
- it 'routes to gyms#index' do
- expect(get: "/gyms").to route_to(controller: 'gyms', action: 'index')
+ it "routes to gyms#index" do
+ expect(get: "/gyms").to route_to(controller: "gyms", action: "index")
end
end
spec/support/http_authentication.rb
@@ -1,5 +1,6 @@
module HttpAuthentication
- def http_login(user, user_session = build(:user_session, id: SecureRandom.uuid, user: user))
+ def http_login(user, user_session =
+ build(:user_session, id: SecureRandom.uuid, user: user))
allow(controller).to receive(:current_user).and_return(user)
allow(controller).to receive(:current_session).and_return(user_session)
session[:user_id] = user_session.id