Minor fixes to seeds and others
commit
8be72fbde8
|
@ -2,7 +2,10 @@ class UserMailer < ApplicationMailer
|
|||
def welcome_email(user)
|
||||
@user = user
|
||||
@user_name = user.name
|
||||
@the_url = "http:" + $API_URL + "/verify/" + user.verification_token
|
||||
@the_url = "http:" +
|
||||
$API_URL +
|
||||
"/verify.html?token=" +
|
||||
(user.verification_token || "ERROR")
|
||||
mail(to: @user.email, subject: 'Welcome to The FarmBot Web App!')
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
class Log < ActiveRecord::Base
|
||||
TYPES = ["success", "busy", "warn", "error", "info", "fun"]
|
||||
PAGE_SIZE = 25
|
||||
TYPES = ["success", "busy", "warn", "error", "info", "fun"]
|
||||
|
||||
serialize :meta
|
||||
serialize :channels
|
||||
|
|
|
@ -23,7 +23,8 @@ module Sync
|
|||
plants: plants,
|
||||
tool_bays: tool_bays,
|
||||
tool_slots: tool_slots,
|
||||
tools: tools }.as_json
|
||||
tools: tools,
|
||||
logs: logs }.as_json
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -61,7 +62,11 @@ module Sync
|
|||
end
|
||||
|
||||
def users
|
||||
@users = device.users
|
||||
@users ||= device.users
|
||||
end
|
||||
|
||||
def logs
|
||||
@logs ||= device.logs.last(Log::PAGE_SIZE)
|
||||
end
|
||||
|
||||
# The UI does not yet support creation of tool bays
|
||||
|
|
|
@ -10,7 +10,7 @@ module Users
|
|||
# Prevent token reuse:
|
||||
user.verification_token = ""
|
||||
user.save!
|
||||
SessionToken.as_json(user)
|
||||
SessionToken.as_json(user.reload)
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
class ToolBaySerializer < ActiveModel::Serializer
|
||||
attributes :id, :name
|
||||
attributes :id, :name, :device_id
|
||||
end
|
||||
|
|
14
db/seeds.rb
14
db/seeds.rb
|
@ -3,10 +3,12 @@ unless Rails.env == "production"
|
|||
ENV['MQTT_HOST'] = "blooper.io"
|
||||
ENV['OS_UPDATE_SERVER'] = "http://blah.com"
|
||||
ENV['FW_UPDATE_SERVER'] = "http://test.com"
|
||||
|
||||
Users::Create.run!(name: "Administrator",
|
||||
email: "admin@admin.com",
|
||||
password: "password123",
|
||||
password_confirmation: "password123")
|
||||
|
||||
User.where(email: "admin@admin.com").destroy_all
|
||||
user = Users::Create.run!(name: "Administrator",
|
||||
email: "admin@admin.com",
|
||||
password: "password123",
|
||||
password_confirmation: "password123")
|
||||
Log.transaction do
|
||||
FactoryGirl.create_list(:log, 35, device: User.last.device)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue