Minor fixes to seeds and others

pull/303/head
Rick Carlino 2016-12-08 14:05:05 -06:00
commit 8be72fbde8
6 changed files with 23 additions and 12 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,3 +1,3 @@
class ToolBaySerializer < ActiveModel::Serializer
attributes :id, :name
attributes :id, :name, :device_id
end

View File

@ -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