小编nei*_*mad的帖子

如何使用After_save条件?

我无法在谷歌上找到它.我有3个型号.

模型1 - > has_many模型2 - >有很多模型3

模型1具有用于确定可以创建多少模型2的字段.和模型2有字段来知道必须创建多少模型3.

我想保存模型1时,自动创建模型2和模型3.

我想从模型1中使用after_create create_model2_record

def create_model2_record
  for(x=0, x<=model1.field; x++){  #c sample
    @model2 = Model2.new
  }
end 
Run Code Online (Sandbox Code Playgroud)

怎么用rails 3来处理这个?thansk

ruby-on-rails ruby-on-rails-3

3
推荐指数
1
解决办法
4681
查看次数

Rails 3 ActionMailer - 没有配方地址

我的prod actionmailer有问题.我托管在site5共享云上.问题是我收到此错误消息.

A message that you sent using the -t command line option contained no
addresses that were not also on the command line, and were therefore
suppressed. This left no recipient addresses, and so no delivery could
be attempted.

------ This is a copy of your message, including all the headers. ------

Date: Sat, 17 Sep 2011 21:06:42 +0000
From: noreply@mydomain.com
To: myemail@mydomain.com
Message-ID: <4e750be27b3ef_4a9c159402ee91b039763@themailserver.com>
Subject: test
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: 7bit
Run Code Online (Sandbox Code Playgroud)

我添加了默认值

default :recipient => 'noreply@mydomain.com' …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails actionmailer ruby-on-rails-3

1
推荐指数
1
解决办法
1361
查看次数

我开始学习WINAPI和C++,但有些不对劲?

我尝试做的WinMain出了问题.我在Windows C++编程中完全是noob,我试着学习.我跟着一个tutoriel来帮助我.但是看起来不行!这是我的代码..

#include <Windows.h>

LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{

    HWND hWnd;
    WNDCLASSEX wc;

    ZeroMemory(&wc, sizeof(WNDCLASSEX));

    wc.cbSize = sizeof(WNDCLASSEX);
    wc.style = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc = WindowProc;
    wc.hInstance = hInstance;
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)COLOR_WINDOW;
    wc.lpszClassName = "WindowClass1";

    RegisterClassEx(&wc);

    hWnd = CreateWindowEx(NULL, "WindowClass1", "Our First Windowed app", WS_OVERLAPPEDWINDOW, 300, 300, 500, 400, NULL, NULL, hInstance, NULL);

    ShowWindow(hWnd, SW_SHOW);

    MSG msg;

    while(GetMessage(&msg, NULL, 0, …
Run Code Online (Sandbox Code Playgroud)

c++ winapi visual-c++

-1
推荐指数
1
解决办法
202
查看次数