ruby-on-rails-3.1

Turning a calendar into a form using Rails?

时光毁灭记忆、已成空白 提交于 2020-01-02 19:12:34
问题 Question : How do I turn a calendar into a form where the dateselect is rendered to match the calendar day instead of the current date? What I'm trying to do: I'd like to create a calendar that displays the cyclist's workouts. Create workouts within each calendar day, automatically rendering the workoutdate that matches the given day in the form Each workout has many intervals. Each calendar day has one workout. Plugins: Extracted the table_builder.rb and calendar_helper.rb from https:/

Turning a calendar into a form using Rails?

一世执手 提交于 2020-01-02 19:12:27
问题 Question : How do I turn a calendar into a form where the dateselect is rendered to match the calendar day instead of the current date? What I'm trying to do: I'd like to create a calendar that displays the cyclist's workouts. Create workouts within each calendar day, automatically rendering the workoutdate that matches the given day in the form Each workout has many intervals. Each calendar day has one workout. Plugins: Extracted the table_builder.rb and calendar_helper.rb from https:/

Rake and Uninitialized Constants

筅森魡賤 提交于 2020-01-02 18:25:01
问题 I have spent hours upon days trying to resolve this. Rake is throwing the following error: dcarpenter$ rake rake aborted! uninitialized constant ActionView::Helpers::JavaScriptProxy I can't seem to find anyone who has had this issue on Google, this site or elsewhere. What steps should I take to resolve this and what do I need to know? rake --trace yields: /Users/dcarpenter/Dropbox/workspace/gems/rake-0.9.2/lib/rake/ext/module.rb:36:in `const_missing' /Users/dcarpenter/Dropbox/workspace/gems

Rake and Uninitialized Constants

你。 提交于 2020-01-02 18:24:10
问题 I have spent hours upon days trying to resolve this. Rake is throwing the following error: dcarpenter$ rake rake aborted! uninitialized constant ActionView::Helpers::JavaScriptProxy I can't seem to find anyone who has had this issue on Google, this site or elsewhere. What steps should I take to resolve this and what do I need to know? rake --trace yields: /Users/dcarpenter/Dropbox/workspace/gems/rake-0.9.2/lib/rake/ext/module.rb:36:in `const_missing' /Users/dcarpenter/Dropbox/workspace/gems

Rails 3 - DB seed data validation

为君一笑 提交于 2020-01-02 09:55:56
问题 I am seeding a test database in Rails 3.1 through thousands of create calls in the seeds.rb file. A little problem arises when these calls do not pass the model validations: rails will not notify me this, and the seeding goes on correctly until the end of the file. At the end of the process I do not know which records have been created and which aren't, unless I check them one by one ... Is there a way to get notified when records do not pass validations when using rake db:seed or rake db

Rails 3: How to declare Rack middleware in application.rb

只愿长相守 提交于 2020-01-02 07:11:32
问题 Many examples such as these two: How to use rack middleware with Rails3? http://asciicasts.com/episodes/151-rack-middleware define middleware in a class and then add config.middleware.use "ClassNameHere" to config/application.rb but I can't figure where in application.rb to add this. I have put it inside of class Application < Rails::Application . I am also not sure if there is a specific location where I put my middleware class. I have mine in /lib. Say my middleware class is called

Ruby on Rails: why do i get message for javascript and css after rails s?

我们两清 提交于 2020-01-02 02:06:43
问题 rails s=> Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2011-10-11 03:37:03 -0900 Served asset /application.css - 304 Not Modified (0ms) Started GET "/assets/home.css?body=1" for 127.0.0.1 at 2011-10-11 03:37:03 -0900 Served asset /home.css - 304 Not Modified (0ms) Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2011-10-11 03:37:03 -0900 Served asset /jquery_ujs.js - 304 Not Modified (0ms) Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2011-10-11 03:37:03

Capistrano compile assets error - assets:precompile:nondigest?

元气小坏坏 提交于 2020-01-02 01:59:53
问题 My App seems to be deploying correctly but I'm getting this error: * executing "cd /home/deploy/tomahawk/releases/20120208222225 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile" servers: ["ip_address"] [ip_address] executing command *** [err :: ip_address] /opt/ruby/bin/ruby /opt/ruby/bin/rake assets:precompile:nondigest RAILS_ENV=production RAILS_GROUPS=assets I've tried solutions here for trying to compile assets: http://lassebunk.dk/2011/09/03/getting-your

What is the best place to store static assets (files) in rails 3.1 ( pdf forms, xls files, etc)

佐手、 提交于 2020-01-02 01:14:10
问题 I have a bunch of static assets ( not jpg, css, & js) - rather files like pdf forms, xls that I need to serve to users. They rarely change. Before I used to store them in public folder, but with the introduction of the assets pipeline in rails 3.1 what is the best place to store files like that now now? thanks 回答1: Actually I just tested it by creating a folder in app/assets/files and sticking my xls files in there, and rake assets:precompile task just picked it up. Also this needs to be

form_for wrong number of arguments (3 for 2) since upgrade to rails 3.1

萝らか妹 提交于 2020-01-02 01:03:33
问题 this form_for used to work before I ported my application to rails 3.1 <div class="form-box" style="padding-left:1em;"> <% action = @existing_mass.nil? ? "add_to_power_plant": "update_power_plant_substrate"; submit_button_label = @existing_mass.nil? ? 'Add': 'Update'; %> <%= form_for :substrate_mass, @substrate_mass, :remote => true, :url => { :action => action, :substrate_id => @substrate_mass.substrate } do |f| %> <div> <%= f.label :quantity_per_year, "Quantity" %> <%= f.text_field