Rails

Rails 3 render action from another controller

匿名 (未验证) 提交于 2019-12-03 08:44:33
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I need to render another controller action and i get this error Missing partial controller/index with {:formats=>[:html], :locale=>[:en, :en], :handlers=>[:rjs, :rhtml, :rxml, :erb, :builder]} in view paths "/path_to/app/views" how can i render another controller action into a view but without sending an redirect to the client ? I've tried "index", :controller=>"controller" %> but it seems that is not working. 回答1: Try to render template: "controller/index" %> Or file: "#{Rails.root}/app/controllers/controller/index" %> And I believe you

Why is Rails giving me “Can't verify CSRF token authenticity” error?

匿名 (未验证) 提交于 2019-12-03 08:44:33
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am getting a "Can't verify CSRF token authenticity" in Rails production. My questions are: Why is it doing this? How can I fix it? Here's my Heroku logs (some values anonymized): The only manifestation I'm aware of is when my friend tries to log in using Safari on his iPhone 5. His user account was created right about 6 months ago. I'm 99% sure that he accessed the site just fine with his phone at that time. Since then he hasn't logged in and I'm not aware of any changes I've made to the login/auth codes. Yesterday I had him hit my site

Installing Rails 4.2.0.beta1 - Unresolved dependency found during sorting

匿名 (未验证) 提交于 2019-12-03 08:42:37
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've attempted to install Rails 4.2.0.beta1 ( released Aug 20, 2014 ). I get an error "Unresolved dependency found during sorting." Here are the details: $ ruby -v ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0] $ gem -v 2.4.1 $ gem install rails --pre ERROR: While executing gem ... (Gem::DependencyError) Unresolved dependency found during sorting - activesupport (>= 4.0) (requested by sprockets-rails-3.0.0.beta1) How can I install Rails 4.2.0.beta1? 回答1: This issue has been fixed on RubyGems. Upgrade to at least 2.4.4 Have a

node.js + socket.io + redis + rails ― RealTime application

匿名 (未验证) 提交于 2019-12-03 08:42:37
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I need to add realtime to my application (Ruby On Rails), so, I think that the better way to do it is to use node.js + socket.io + redis. I have this application.js file in a backend (node.js) var app = require('http').createServer(); var io = require('socket.io'); var redis = require('redis').createClient(); var _ = require('underscore')._; io = io.listen(app); io.configure(function() { io.set("transports", ["xhr-polling"]); io.set("polling duration", 10); io.set("close timeout", 10); io.set("log level", 1); }) redis.subscribe('rt-change');

Ruby Error: “No such file or directory ― script/generate (LoadError)”

匿名 (未验证) 提交于 2019-12-03 08:42:37
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I know that this error has been discussed elsewhere on the web, and this may seem like a stupid question, but I've got a very strange situation on my hands here. I'm running on Snow Leopard, with fully updated Ruby and Rails gems. I created a new Rails project using ruby new testing , then navigated into that folder using cd ~/testing , and tried to create a basic scaffolding using ruby script/generate scaffold newtest name:string , and I got this error back: ruby: No such file or directory -- script/generate (LoadError) I have searched

Rails Completed 406 Not Acceptable

匿名 (未验证) 提交于 2019-12-03 08:42:37
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I don't know what the heck is going on here, I just updated my rails from 3.1.0rc4 to 3.1.0 and I suddenly find that all ajax won't work, It's causing 406 error all the time. Everything was perfectly fine before I update to 3.1.0 Guys, I am going to lose controll now, help me. 回答1: Make sure that you're setting the correct content-type and that your controllers respond to the specified format. This often happens if the request content-type is set to 'application/json' and your controller doesn't have either respond_to :json declared or a

Springboot项目基于gitlab+docker+rancher的CI/CD Demo搭建系列(二):CentOs7安装Gitlab

*爱你&永不变心* 提交于 2019-12-03 08:42:08
安装GitLab 官网安装步骤: https://about.gitlab.com/install/#centos-7 安装前配置,防火墙之类的 邮件配置 登陆gitlab 安装Gitlab 打开防火墙的http和ssh访问 sudo yum install -y curl policycoreutils-python openssh-server sudo systemctl enable sshd sudo systemctl start sshd sudo firewall-cmd --permanent --add-service=http sudo systemctl reload firewalld 安装Postfix邮件通知 sudo yum install postfix sudo systemctl enable postfix sudo systemctl start postfix 如果希望其他的方式, 参考链接 [root@iZm5e1zao4uxbr8etk59y5Z /]# sudo systemctl start postfix Job for postfix.service failed because the control process exited with error code. See "systemctl status postfix

ActiveRecord Rails 3 scope vs class method

匿名 (未验证) 提交于 2019-12-03 08:41:19
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm new to the new query interface of ActiveRecord so I'm still figuring things out. I was hoping someone could explain the difference between using a scope in an ActiveRecord model and just using a class method (ie self.some_method ) From what I can gather, a scope is always expected to return a relation, whereas a class method doesn't necessarily have to. Is this true? For instance, I thought it would make sense to do something like: class Person scope :grouped_counts, group(:name).count end But this doesn't work. I get this error:

Why are my Rails initializers caching ENV variables in the console (Foreman, Dev env)

匿名 (未验证) 提交于 2019-12-03 08:41:19
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: What started as a minor annoyance has now turned into a headache. I am building a Rails 4 app and am using Foreman for my dev setup with a Procfile and .env file for configuration. When I set an ENV variable in the .env file, it is correctly picked up by my app. In this case I am setting some ENV options for Paperclip in an initializer. The problem surfaces when I go to change the value of the ENV variables. In the console, if I type ENV["MY_VAR"], it shows the new value. However, the value that was used in my initializer, which

Named_scope in rails unique records?

匿名 (未验证) 提交于 2019-12-03 08:41:19
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Is it possible to have named_scope return records unique for a certain column? e.g named_scope :unique_styles, :order =>"title desc", :limit => 3 That will give me three styles but what if I want to make sure the title is different? In this case there may be three records with the same style, I want this named_scope to only give unique values of title. So ["style 1", "style 1", "style 1"] isn't possible, it'll force itself to give ["style 1", "some style 2", "maybe another 3"] i think group may do it and I'm using that for now. If anyone has