ruby-on-rails-3.2

Bundler could not find compatible versions for gem, updating Rails app

我的未来我决定 提交于 2019-12-20 12:28:13
问题 After createing a brand new rails app Following the official rails blog post, attempting to convert apps to rails 3.2.0.rc2 yields the following Updated Gemfile to depend on rails ~> 3.2.0.rc2 gem 'rails', '~>3.2.0.rc2' Updated Gemfile to depend on sass-rails ~> 3.2.3 gem 'sass-rails', '~> 3.2.3' $ bundle install Fetching source index for http://rubygems.org/ Bundler could not find compatible versions for gem "activesupport": In snapshot (Gemfile.lock): activesupport (3.1.1) In Gemfile: rails

Adding custom data attributes rails image tag

放肆的年华 提交于 2019-12-20 11:34:16
问题 I need to add data-description and data-title for galleria in my rails application but I can't see how to do this with the image tag. So far I have this: <div id="galleria"> <% @entries.each do |entry| %> <%= image_tag entry.filename, :title => "title", :class => "class", :data-description => entry.caption, :data-title => entry.caption %> <% end %> </div> But this raises the undefined local variable or method `description' error, so how would I do this in rails 3? 回答1: The correct syntax for

Adding custom data attributes rails image tag

杀马特。学长 韩版系。学妹 提交于 2019-12-20 11:34:10
问题 I need to add data-description and data-title for galleria in my rails application but I can't see how to do this with the image tag. So far I have this: <div id="galleria"> <% @entries.each do |entry| %> <%= image_tag entry.filename, :title => "title", :class => "class", :data-description => entry.caption, :data-title => entry.caption %> <% end %> </div> But this raises the undefined local variable or method `description' error, so how would I do this in rails 3? 回答1: The correct syntax for

Rails - How to test that ActionMailer sent a specific attachment?

烈酒焚心 提交于 2019-12-20 11:07:10
问题 In my ActionMailer::TestCase test, I'm expecting: @expected.to = BuyadsproMailer.group_to(campaign.agency.users) @expected.subject = "You submitted #{offer_log.total} worth of offers for #{offer_log.campaign.name} " @expected.from = "BuyAds Pro <feedback@buyads.com>" @expected.body = read_fixture('deliver_to_agency') @expected.content_type = "multipart/mixed;\r\n boundary=\"something\"" @expected.attachments["#{offer_log.aws_key}.pdf"] = { :mime_type => 'application/pdf', :content => fake_pdf

Excluding files from assets:precompile in rails

安稳与你 提交于 2019-12-20 10:36:37
问题 I use codekit for writing less which it then converts to css automatically. I don't want rails to convert my less files to css, I rather codekit do it. if I precompile the assets via rake assets:precompile I get rake aborted! cannot load such file -- less How do I exclude a specific folder/file types from precompiling? (all my less files are in app/assets/stylesheets/less and the css (which I do want to be precompiled) are in app/assets/stylesheets/css update deleting application.less solves

Routing Error uninitialized constant Users

痴心易碎 提交于 2019-12-20 10:23:26
问题 I am a rails newbie... I am trying to set up Sign in with facebook for a demo app. I am using OmniAuth and following this tutorial https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview I get this error when redirecting to fB: Routing Error: uninitialized constant Users Try running rake routes for more information on available routes. Environment Windows 7 Rails version :3.2.9.rc2 omniauth-1.1.1 devise-2.1.2 My routes.rb looks like this: root :to => 'static_pages#home' resources

Integrating CKEditor with Rails 3.2

人盡茶涼 提交于 2019-12-20 09:56:05
问题 Similar to Integrating CKEditor with Rails 3.1 Asset Pipline I am trying to integrate ckeditor with my rails 3.2 application. I have all ckeditor files copied under /app/assets/javascripts/ckeditor/* . I have the following lines in my application.js and application.js is included in my layout file: //= require jquery //= require jquery_ujs //= require ckeditor/ckeditor //= require_self Taken it from the answer to Integrating CKEditor with Rails 3.1 Asset Pipline I can understand that I need

How do Rails ActiveRecord relationship helpers allow methods such as `user.groups.new`?

主宰稳场 提交于 2019-12-20 04:37:16
问题 In Rails, I have created a Model that retrieves users from an LDAP database rather than from ActiveRecord. Now I am attempting to integrate my ActiveRecord models with the LDAP-based models, so I am writing methods in my models that emulate some common ActiveRecord methods. One of the methods I am trying to emulate is one that is normally created by the has_many through relationship on ActiveRecord. In ActiveRecord, this relationship would allow the following: user = User.first groups = user

undefined method `protect_against_forgery?' for #<#<Class:0x0

僤鯓⒐⒋嵵緔 提交于 2019-12-19 18:53:50
问题 I have the following code in my routes.rb file . resources :users do member do get :following,:followers end collection do put :activate_email end end And I have a user email activation link like this : <%= link_to "Activate",activate_email_users_url(email_token: @user.email_token),method: :put %> When I click on the activate link , this is the url that is generated http://localhost:3000/users/activate_email?email_token=WWNvMN-r_lXgovrQiDlSSQ Update: Ok, So I think I kno what the problem is .

Uninitialized constant “Controller Name”

∥☆過路亽.° 提交于 2019-12-19 14:46:11
问题 I'm having an error with my routes/resources and controllers. I have the following in the routes.rb: # routes.rb resources :users do resource :schedule end And I have a schedule_controller.rb inside controllers/users/ set up as I think it should be: class Users::ScheduleController < ApplicationController # Controller methods here... end Running a rake:routes shows user_schedule POST /users/:user_id/schedule(.:format) schedules#create new_user_schedule GET /users/:user_id/schedule/new(.:format