ruby-on-rails-3

DateTime with MongoDB/Mongoid and Rails 3 Not Populating

独自空忆成欢 提交于 2019-12-31 14:52:31
问题 Here is the code in my Model include Mongoid::Document include Mongoid::Timestamps field :message, :type => String field :send_at, :type => DateTime Here is the code for my form partial <%= f.label :send_at %><br /> <%= f.datetime_select :send_at %> But the date and time is never populated. I made sure that Mongo and Mongoid are up to date as well. Not sure if there's something I'm missing. [UPDATE LOG ENTRIES] Started POST "/notifis" for 127.0.0.1 at Mon Oct 18 05:48:05 -0400 2010 Processing

Rails - Nginx needs to be restarted after deploying with Capistrano?

一笑奈何 提交于 2019-12-31 14:26:32
问题 I am using Capistrano to deploy my Rails application. whenever I deploy, changes would not be reflected on the browser, and I still need to restart nginx to update the site (running sudo /etc/init.d/nginx restart). I'm not really sure why but isn't it supposed to be updated after restarting application? (using touch /app/tmp/restart.txt) Here's my deploy.rb require "rvm/capistrano" set :rvm_ruby_string, 'ruby-1.9.3-p194@app_name' set :rvm_type, :user require "bundler/capistrano" set

Add a JavaScript display to the Home page to count down from 140 characters. (Rails Tutorial, 2nd Ed, Chapter 10, Exercise 7)

[亡魂溺海] 提交于 2019-12-31 13:13:34
问题 This exercise was a bit tricky. Figured I'd post my solution to see if anyone did it differently or if there's anyone who knows a better way. I'm not sure on best practices for using the Asset Pipline .. for example, the correct order to put things in the application.js manifest file, or when to put things in lib versus app. I just put the following in lib to try getting it to work. From Michael Hartl's Rails Tutorial 2nd ed Chapter 10, Exercise 7: (challenging) Add a JavaScript display to

List of reserved words in rails *3*

半城伤御伤魂 提交于 2019-12-31 12:59:40
问题 Is there a good, authoritative list of reserved words for RAILS-3? Candidates: http://oldwiki.rubyonrails.org/rails/pages/ReservedWords, but it seems a bit out of date and rails2. http://cheat.errtheblog.com/s/rails_reserved_words (but there seems no authority to this - it could just grow and grow...) http://latheesh.com/2010/02/02/rails-reserved-words/ Background: I'm maintaining a long-serving rails app and it has plenty of usages of reserved words (judging that http://oldwiki.rubyonrails

List of reserved words in rails *3*

大城市里の小女人 提交于 2019-12-31 12:58:04
问题 Is there a good, authoritative list of reserved words for RAILS-3? Candidates: http://oldwiki.rubyonrails.org/rails/pages/ReservedWords, but it seems a bit out of date and rails2. http://cheat.errtheblog.com/s/rails_reserved_words (but there seems no authority to this - it could just grow and grow...) http://latheesh.com/2010/02/02/rails-reserved-words/ Background: I'm maintaining a long-serving rails app and it has plenty of usages of reserved words (judging that http://oldwiki.rubyonrails

what is the use of the pool option in database.yml

老子叫甜甜 提交于 2019-12-31 12:38:31
问题 Most widely used options in database.yml are of following : adapter encoding database pool username password socket host port timeout I know the use of the most of the above but pool. So i want to know what is the use of the pool option in database.yml or there is any other parameter which we need to set for the application having very heavy traffic. 回答1: It sets the amount of possible connections per ruby process. So in case you are threading your rails app, or you use transactions

what is the use of the pool option in database.yml

醉酒当歌 提交于 2019-12-31 12:37:28
问题 Most widely used options in database.yml are of following : adapter encoding database pool username password socket host port timeout I know the use of the most of the above but pool. So i want to know what is the use of the pool option in database.yml or there is any other parameter which we need to set for the application having very heavy traffic. 回答1: It sets the amount of possible connections per ruby process. So in case you are threading your rails app, or you use transactions

How to disable a form submit button “a là Ruby on Rails Way”?

谁说我不能喝 提交于 2019-12-31 12:01:27
问题 I am using Ruby on Rails 3 and I would like to disable and toogle the CSS class of a form.submit when the form is AJAX submitted and until the AJAX HTTP request is completed (I am using the default jQuery framework for JavaScript). My form is the following: <%= form_for(@article, :remote => true) do |form| %> ... <%= form.submit(nil, {:id => 'button_id', :class => 'button_class'}) %> <% end %> How can I make that in a "common"/"good"/"proper" way? 回答1: The Rails jQuery bridge (jquery_ujs.js)

rails 3 response format and versioning using vendor MIME type in the Accept header

假如想象 提交于 2019-12-31 11:43:54
问题 Preamble: I investigated how to version an API and found several ways to do it. I decided to try peter williams' suggestion and created new vendor mime types to specify version and format. I could find no definitive write-up for doing this following "the rails way" so I pieced together info from several places. I was able to get it working, but there is some goofiness in the way the renderers handle Widget array vs Widget instance in respond_with . Basic steps & problem: I registered mime

rails 3 response format and versioning using vendor MIME type in the Accept header

怎甘沉沦 提交于 2019-12-31 11:43:15
问题 Preamble: I investigated how to version an API and found several ways to do it. I decided to try peter williams' suggestion and created new vendor mime types to specify version and format. I could find no definitive write-up for doing this following "the rails way" so I pieced together info from several places. I was able to get it working, but there is some goofiness in the way the renderers handle Widget array vs Widget instance in respond_with . Basic steps & problem: I registered mime