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
class Admin::UsersController < AdminController | |
def index | |
@users = User.all # Shows all users except current_users | |
end | |
def show | |
@user = User.find(params[:id]) | |
end |
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 'clockwork' | |
require File.expand_path('../config/boot', File.dirname(__FILE__)) | |
require File.expand_path('../config/environment', File.dirname(__FILE__)) | |
module Clockwork | |
handler do |job| | |
stock_data = Ystock.find([ | |
'MAERSK-B.CO', # A.P. Møller Mærsk | |
'CARL-B.CO', # Carlsberg |
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
#config.action_mailer.default_url_options = { host: '192.168.159.128:3000' } | |
#config.action_mailer.perform_deliveries = true | |
#config.action_mailer.delivery_method = :sendmail | |
#config.action_mailer.sendmail_settings = { | |
#location: '/usr/sbin/sendmail', | |
#arguments: "-i -t -f [email protected]" | |
#} |
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
Started POST "/contact" for 192.168.233.1 at 2012-01-04 13:39:26 +0100 | |
Processing by ContactController#create as HTML | |
Parameters: {"utf8"=>"â", "authenticity_token"=>"5X39Lm8sV9HScP/au35Z3TA3u62ou fBmmYtA1T0GeQI=", "message"=>{"name"=>"dsadsa", "email"=>"[email protected]", "message"=> "<p>dsadas</p>"}, "commit"=>"Send"} | |
Sent mail to [email protected] (12ms) | |
Date: Wed, 04 Jan 2012 13:39:26 +0100 | |
From: [email protected] | |
To: [email protected] | |
Message-ID: <[email protected]> | |
Subject: [Contact AC] |
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
Started POST "/contact" for 192.168.233.1 at 2012-01-04 13:28:12 +0100 | |
Processing by ContactController#create as HTML | |
Parameters: {"utf8"=>"â", "authenticity_token"=>"5X39Lm8sV9HScP/au35Z3TA3u62ou fBmmYtA1T0GeQI=", "message"=>{"name"=>"dsda", "email"=>"[email protected]", "message"= >"<p>test12</p>"}, "commit"=>"Send"} | |
Sent mail to [email protected] (425ms) | |
Date: Wed, 04 Jan 2012 13:28:14 +0100 | |
From: [email protected] | |
To: [email protected] | |
Message-ID: <[email protected]> | |
Subject: [Contact AC] |
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
# Contact Mailer | |
class Contact < ActionMailer::Base | |
#default :to => "[email protected]" | |
def contact(message) | |
@message = message | |
@sender = @message.email | |
mail( | |
:from => @sender, | |
:to => "[email protected]", |
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
= form_for([:admin, @stock]) do |f| | |
- if @stock.errors.any? | |
#error_explanation | |
%h2 | |
= pluralize(@stock.errors.count, "error") | |
prohibited this stock from being saved: | |
%ul | |
- @stock.errors.full_messages.each do |msg| | |
%li= msg | |
.field |
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
= form_for([:admin, @stock]) do |f| | |
- if @stock.errors.any? | |
#error_explanation | |
%h2 | |
= pluralize(@stock.errors.count, "error") | |
prohibited this stock from being saved: | |
%ul | |
- @stock.errors.full_messages.each do |msg| | |
%li= msg | |
.field |
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 create | |
@stock = Stock.new(params[:stock]) | |
@is = InvestorStock.new(params[:investor_id]) | |
respond_to do |format| | |
if @stock.save && @is.save | |
format.html { redirect_to admin_stock_url(@stock), notice: 'Stock was successfully created.' } | |
format.json { render json: @stock, status: :created, location: @stock } | |
else | |
format.html { render action: "new" } |
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
Started POST "/admin/stocks" for 192.168.233.1 at 2011-12-28 09:36:42 +0100 | |
Processing by Admin::StocksController#create as HTML | |
Parameters: {"utf8"=>"â", "authenticity_token"=>"6kyoQ8XHDtgZduN8nwtYFBy0Jeekiy/0VFdtVVo+2YU=", "stock"=>{"value"=>"1000", "month"=>"1", "year"=>"2013"}, "investor"=>{"id"=>"1"}, "commit"=>"Gem"} | |
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1 | |
SQL (0.7ms) INSERT INTO "stocks" ("created_at", "month", "updated_at", "value", "year") VALUES (?, ?, ?, ?, ?) [["created_at", Wed, 28 Dec 2011 08:36:42 UTC +00:00], ["month", 1], ["updated_at", Wed, 28 Dec 2011 08:36:42 UTC +00:00], ["value", 1000], ["year", 2013]] | |
Redirected to | |
Completed 500 Internal Server Error in 299ms | |
NoMethodError (undefined method `stock_url' for #<Admin::StocksController:0x00000004cd6960>): | |
app/controllers/admin/stocks_controller.rb:47:in `block (2 levels) in create' |