ruby-on-rails-3.1

Unicorn/Nginx process missing, socket open

与世无争的帅哥 提交于 2020-01-01 05:35:09
问题 I am trying to deploy code using Capistrano, and it fails on deploy:start or deploy:stop because the Unicorn process is already killed. However if I try to cap deploy:start , I get a stderr claiming that Address already in use - /tmp/my_app.socket . How would this happen, and how might I get out of this mess? 回答1: Still not sure how this happens, but the following solution seems to work: lsof /tmp/my_app.socket - lists the pids kill -9 pid - (replace 'pid' with one of those listed) Then cap

rails 3.1.1 engines - with mountable engines, is it possible to access parent app assets, default layout?

亡梦爱人 提交于 2020-01-01 05:22:16
问题 This is more for experimentation - I am aware that I can do this with --full but I wanted the functionality of namespacing in the app to avoid conflicts The idea is to have a main app - which handles authentication, common items, admin screens etc Then creating engines to add further functionality like crm cms blog wiki forum etc These engines I can pick and choose as I need for whatever kind of app I am building. Is this possible? Is it just the case of applying both --mountable and --full

can't activate mysql2 (~> 0.3.6), already activated mysql2-0.3.2 in Rails 3.1

佐手、 提交于 2020-01-01 04:46:11
问题 I'm just trying to get the most basic of basic shell of a rails app running under 3.1, and I'm getting this weird error when I run bundle exec rake db:migrate- Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter` (can't activate mysql2 (~> 0.3.6), already activated mysql2-0.3.2. Make sure all dependencies are added to Gemfile.) All the posts that I've read here and elsewhere say I should be using the newer mysql2 adaptor for rails 3.1, so I have- gem 'mysql2', '0.3.2'

Rails: What is the location option for in the render method

假如想象 提交于 2020-01-01 04:12:05
问题 Hey I am wondering what the location option for the render method in rails is. The docs here http://guides.rubyonrails.org/layouts_and_rendering.html states: "You can use the :location option to set the HTTP Location header:" But I have no idea why you would do this, or what you would use this for. 回答1: Actually location option is used to redirect to a new resource as part of processing the request. For example, render :xml => post.to_xml, :status => :created, :location => post_url(post) is

Rails 3.1 with Asset Pipeline, link_to :confirm message showing twice?

雨燕双飞 提交于 2020-01-01 04:07:05
问题 Okay, so I've seen this question about this problem being caused by multiple linkings of jQuery or Prototype, but I can confirm that I'm only linking to jQuery once on the entire page. My problem is this: when I have a link_to that confirms a deletion, the popup shows twice. Here's the applicable code in my template (written in Slim): link_to('Destroy', depot_path(@depot.id), :confirm => "Really?", :method => :delete) I'm running Rails 3.1.0 with the Asset Pipeline turned on, with gem 'jquery

Javascript is cached in development mode with asset pipeline

梦想的初衷 提交于 2020-01-01 01:48:09
问题 I recently upgraded my application to rails 3.1 and generally everything seems to be working but one thing is driving me insane. I have 2 main js files, we'll call them, application.js and main.js. application.js has my manifest stuff in it and is loading in main.js. That's working fine. My problem is when i'm in development mode and i make a change to main.js, then refresh the page the site doesn't pick up the change. In order to pull in the change I have restart the rails server. I have

How to use Less in a rails 3.1 application?

我的梦境 提交于 2019-12-31 22:27:21
问题 What is the easiest (is there an easy way?) to use Less (in combination with Sass/Scss) in the rails 3.1 assets pipeline? I want to load a file like foo.css.less like i would do for bar.css.scss I found some wonky solution that does not work for me (haven't tried a lot) : https://github.com/thisduck/ruby-less-js/issues/2 The idea would be to use Twitter Bootstrap in a clean way. Thanks in advance 回答1: If you only want to use bootstrap, you can do it by including the 'less-rails' and 'less

Rails - Testing JSON API with functional tests

自作多情 提交于 2019-12-31 10:05:47
问题 I have just a simple question, but I could not found any answer. My ruby on rails 3.2.2 appilcation have a JSON API with a devise session authentication. My question is: How can I test this API with functional or integration tests - and is there a way to handle a session? I do not have a front end, just a API that I can do GET. POST. PUT. and DELETE with JSON Body. Which is the best way to test this automated? EXAMPLE create new user POST www.exmaple.com/users { "user":{ "email" : "test

Rails - Testing JSON API with functional tests

十年热恋 提交于 2019-12-31 10:04:01
问题 I have just a simple question, but I could not found any answer. My ruby on rails 3.2.2 appilcation have a JSON API with a devise session authentication. My question is: How can I test this API with functional or integration tests - and is there a way to handle a session? I do not have a front end, just a API that I can do GET. POST. PUT. and DELETE with JSON Body. Which is the best way to test this automated? EXAMPLE create new user POST www.exmaple.com/users { "user":{ "email" : "test

Use LIKE/regex with variable in mongoid

和自甴很熟 提交于 2019-12-31 09:16:11
问题 I'm trying to find all documents whose text contains the word test. The below works fine: @tweets = Tweet.any_of({ :text => /.*test.*/ }) However, I want to be able to search for a user supplied string. I thought the below would work but it doesn't: searchterm = (params[:searchlogparams][:searchterm]) @tweets = Tweet.any_of({ :text => "/.*"+searchterm+".*/" }) I've tried everything I could think of, anyone know what I could do to make this work. Thanks in advance. 回答1: searchterm = (params[