我们有一个在生产和登台服务器上运行的大型rails项目.每次我们部署到登台或生产时创建标签是个好主意(这会自动发生在capistrano上).或者最好创建名为"devlopment"和"staging"的分支,(master将包含生产状态)?
首先,我需要说我在Asp.net上的经验非常小,这就是为什么这个问题在某些方面会引起混淆的原因.我首先创建了https://code.visualstudio.com/Docs/ASPnet5 MVC6项目yo aspnet.然后我将这一行添加到project.json中的"dependencies"
"Microsoft.Framework.ConfigurationModel.Xml": "1.0.0-beta4",
"System.Web.NHaml.Mvc3": "4.0.8",
Run Code Online (Sandbox Code Playgroud)
然后我用这个Google代码内容创建了haml.xml,并在Startup.cs文件中扩展了以下行:
var configuration = new Configuration()
.AddJsonFile("config.json")
.AddXmlFile("haml.xml")
.AddJsonFile($"config.{env.EnvironmentName}.json", optional: true);
Run Code Online (Sandbox Code Playgroud)
这是我的控制器的样子:
public class HomeController : Controller
{
public IActionResult Index()
{
return View(@"~/Views/Shared/Test.haml");
}
}
Run Code Online (Sandbox Code Playgroud)
应用程序启动,但我无法呈现操作,这是浏览器中显示的错误
处理请求时发生未处理的异常.
InvalidOperationException:找不到视图'〜/ Views/Shared/Test.haml'.搜索了以下位置:〜/ Views/Shared/Test.haml.Microsoft.AspNet.Mvc.Rendering.ViewEngineResult.EnsureSuccessful()[0x00000] in,第0行
但是此文件确实存在于此目录中.任何提示或帮助表示赞赏.
基本上我想要的是一个非常简单的MVC 5或6项目的详细解释或工作示例,它使用NHaml或任何其他提供Haml语法的lib(如果它与osx上的Mono一起工作,这是一个奖励).坦克很多!
我在这里有这个数组:
Array
(
[0] => Array
(
[presentation] => Präsentationen
)
[1] => Array
(
[news] => Aktuelle Meldungen
[devplan] => Förderprogramme
[salesdoc] => Vertriebsunterlagen
)
[2] => Array
(
[user/settings] => Mein Account
)
[3] => Array
(
)
[4] => Array
(
[orders] => Projekte
)
)
Run Code Online (Sandbox Code Playgroud)
我想解开数组的第一个深度来得到这个:
Array
(
[presentation] => Präsentationen
[news] => Aktuelle Meldungen
[devplan] => Förderprogramme
[salesdoc] => Vertriebsunterlagen
[user/settings] => Mein Account
[orders] => Projekte
)
Run Code Online (Sandbox Code Playgroud) Visual Studio Code告诉我"无法找到.NET CLI工具.将不会启用.NET Core调试.请确保已安装.NET CLI工具并且正在路径上." 这可以防止任何代码完成等.我能解决这个问题吗?
我正在尝试在CodeIgniter控制器中编写一个函数,它可以使用可选参数.但是,我总是收到Missing Argument警告.我不是要试图压制警告 - 我试图将参数声明为可选(如果它们不存在,可能是空字符串,或者其他东西).
我错过了什么?
由于
马拉
我在 VSCode 的输出中收到此消息
[fail]: OmniSharp.MSBuild.ProjectLoader
The reference assemblies for framework ".NETFramework,Version=v4.7.1" were not found.
To resolve this, install the SDK or Targeting Pack for this framework version
or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the
Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you …Run Code Online (Sandbox Code Playgroud) 我想写自己的宝石,帮助我在我的rails应用程序.它还会包含一些提供html的控制器.所以我需要在浏览器中测试它(html/css/js).
什么是最好的做法?
现在我使用回声宝石来构建我的宝石(有没有更好的宝石?).rake安装切换到其他选项卡停止rails应用程序启动rails应用程序(因此它已加载了gem),然后在具有良好旧刷新的浏览器中对其进行测试.
这不好玩.我能以某种方式提高效率吗?难道不为ruby文件编写测试吗?
我不明白为什么我必须更新我的gems localy并将其推送到heroku,以获得它们的更新版本?
为什么没有heroku bundle update命令?
我怎样才能取消ORDER BYrails 3中的所有sql状态?
chain.unscoped.order("id ASC")
Run Code Online (Sandbox Code Playgroud)
我遇到的问题是,这也会丢弃WHERE语句,如果没有它们,我的查询就毫无意义.类似的东西.unscoped('order')会很好.
这个问题有很多答案(问题1 问题2),但这个应该有效的解决方案对我不起作用:
files:
"/etc/nginx/conf.d/proxy.conf" :
mode: "000755"
owner: root
group: root
content: |
client_max_body_size 50M;
Run Code Online (Sandbox Code Playgroud)
我已经通过ssh及其正确检查了这个创建文件的状态和内容.我也尝试了其他值并多次重启服务器.
client_max_body_size 0;
Run Code Online (Sandbox Code Playgroud)
要么
http {
client_max_body_size 50M;
}
Run Code Online (Sandbox Code Playgroud)
这个值也不起作用.
它只是不会工作,即使是"只是"一个6mb的图像.它适用于大小为0.5mb的较小图像.它是一个RoR应用程序,"64位Amazon Linux 2018.03 v2.8.0运行Ruby 2.5(Puma)".实例大小为t2.micro.