ruby-on-rails-3.1

devise_invitable routing error

﹥>﹥吖頭↗ 提交于 2019-12-12 04:44:59
问题 THE ERROR: Started GET "/users/invitation/new" for 127.0.0.1 at 2013-01-09 01:00:31 +0100 Processing by Devise::InvitationsController#new as HTML User Load (451.8ms) SELECT "users".* FROM "users" WHERE "users"."id" = 3 LIMIT 1 Rendered users/invitations/new.html.erb within layouts/application (69.2ms) Rendered layouts/_google_analytics.html.erb (0.4ms) Rendered layouts/_navbar.html.erb (73.6ms) Completed 500 Internal Server Error in 10785ms ActionView::Template::Error (No route matches {

number (currency) into english words

ⅰ亾dé卋堺 提交于 2019-12-12 04:04:44
问题 I have an application that generate invoices. The system works with three currencies: Pounds, US Dollars and Euros. As part of the requirements, invoices must have the total amount displayed in english words. For example: £100.50 - One hundred Pounds and fifty pences. $100.50 - One hundred US Dollars and fifty cents. €100.50 - One hundred Euros and fifty cents. I found this post from 2010, but It doesn't really solve my problem. I would like to know what is the best way to convert numbers

how to use ajax response back in your view page?

只愿长相守 提交于 2019-12-12 03:43:37
问题 I have this as my view page <html> <head> <script> function submit_form() { $('#my_form').submit(); } </script> </head> <body> <div class="container"> <%= form_tag({:action => 'submit_form'}, :remote => true,:method=>:post,:id => 'my_form',:class => 'my_form_class') do %> <%= select(:grade,:id,@distinct_grade_list,{},:onchange => "submit_form()")%> <%= select(:period,:id,@distinct_period_list)%> <% end %> <br/> <div id="farzi2" style="border: 3px solid blue;margin-top: 20px"> <%= select(

Scope for Self-joining HABTM Association

☆樱花仙子☆ 提交于 2019-12-12 03:22:01
问题 With Rails 3.1.3 on Ruby 1.9.2 , I have: class User < ActiveRecord::Base has_and_belongs_to_many :states end class State < ActiveRecord::Base has_and_belongs_to_many :users end A User is associated with many State s, and a State with many User s. Given a User , I want to find all other User s who are in any of her states. I tried: class User < ActiveRecord::Base scope :in_state, lambda { |states| joins(:states).where(:states => states) } end User.in_state(current_user.states).all With this

ruby on rails associations newbie

一笑奈何 提交于 2019-12-12 03:19:25
问题 This might be considered as a re-post of rails 3 associations error. But its something which I am not able to understand . But ok ... heres the deal.. I have asked a question in here which was related to a table schema. The post is what is bad in this table schema structure and the query was : `CREATE TABLE "pages" ( "id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "body" varchar(255), "author" varchar(255), "email" varchar(255), "reference" varchar(255), "created_at"

Rails3.1.3 Error : /gems/actionpack-3.1.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout

自古美人都是妖i 提交于 2019-12-12 03:18:00
问题 I am trying to use gem 'fancybox-rails' & have updated the files as required by gem. I created a controller and a view to generate a page with video links. I am using Rails 3.1.3. I have updated my bundle using "bundle update" & everything seems to be in line but I am getting the following error. Here is the whole code for the application : https://github.com/jaipratik/i_have_removed_it I am getting the following errors. Output - Development log (may be useful ) Rendered /Users/jayparteek/

Cannot configure assets via pipeline on local production rails 3.1.3 server

谁说我不能喝 提交于 2019-12-12 03:06:14
问题 This month, I upgraded from Rails 3.0 to Rails 3.1 - this week I tried to launch the server in production mode - today I have hit a wall ! I am unable to get my production environment server to serve up my public assets (JavaScript and CSS) via the asset pipeline, unless I set config.assets.compile = true in my environment.rb file, which for speed reasons I obviously don't want to do. I have a large number of JS and CSS files, each of which tends to get used on one or two different pages.

rails 3 and jquery railscast 197 issues

假如想象 提交于 2019-12-12 02:46:15
问题 Im doing railscast episode 196-197, everything works fine except that no "add answers","add question" just "remove question", Im working with ruby1.9.2 and rails 3.1.1, I know the episode is in rails 2.3, but must be something like a = or % that I miss...at the end of the episode, give a option for jquery but not works to me,please help! thanks in advance. 回答1: Thanks DeathHammer. This fixed the same issur for me. It was the syntax changes in Rails 3 for the helper method that did it.

Object.save failed in spec data validation

折月煮酒 提交于 2019-12-12 02:46:15
问题 Here is the failed spec code for create in customer controller: describe CustomersController do before(:each) do #the following recognizes that there is a before filter without execution of it. controller.should_receive(:require_signin) controller.should_receive(:require_employee) end render_views describe "'create' successful" do before(:each) do category = Factory(:category) sales = Factory(:user) @customer = Factory.attributes_for(:customer, :category1_id => category.id, :sales_id => sales

polymorphic association and setting default value for an asset

匆匆过客 提交于 2019-12-12 02:37:54
问题 Newbie question. I have the following models: class Asset < ActiveRecord::Base belongs_to :assetable, :polymorphic => true #paperclip has_attached_file :asset, :hash_secret => "my-secret", :url => "/images/:hash_:basename_:style.:extension", :path => UPLOAD_PATH + "/:hash_:basename_:style.:extension", :styles => { :medium => "300x300>", :thumb => "75x75>" } end class Location < ActiveRecord::Base has_many :assets, :as => :assetable, :dependent => :destroy end class MenuItem < ActiveRecord: