Undefined method & ldquo; _path & rdquo; in the rails

I am trying to create a new model and provide user a link to a form to fill the model object. My model (/models/paypal_order): class PaypalOrder < ActiveRecord::Base attr_accessor :card_number, :card_verification end My controller (controllers/paypal

Rails: starts writing tests late in development

We've built a fully functional v. 1 application in Ruby on Rails without writing a single test. We'd like to write all necessary tests so that the next version can be developed in that fashion. Where should we start? We've done research on how to wri

Integrating googlefonts into the Ruby on Rails 3.2 application

I have to use fonts form Google in one Rails application . The ordinary HTML code defines googlefonts usage like this : <link href='http://fonts.googleapis.com/css?family=PT+Sans:400,700,400italic' rel='stylesheet' type='text/css'> I tried to add th

.html () returns undefined

I'm new to JQuery and am having trouble getting the content of a div block. <div class="update_status"> Updated successfully </div> And when the following script runs: $(document).ready(function () { $(function () { var $status_div =

attr_accessible on create only in Rails 3.2 and more

Is there way to say in Rails model that the attribute is accessible only if creating new record but when updating not? something like: class DesiredModel < ActiveRecord::Base attr_accessible :type, :only => [:create] # this is just example attr_acce

assets: precompile the level of the stack too deep

I'm trying to have success on running the task rake assets:precompile but I have the following error ** Invoke assets:precompile (first_time) ** Execute assets:precompile rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace **

change the name of the project

How to change your project name in ruby on rails ? while u create a project name of project is scattered in below files In Rails 3, there are references to the application name in the following files: config/application.rb config/environment.rb confi

Pagination of a mixed ActiveRecord request

I am attempting to paginate a shuffled ActiveRecord query. The syntax for doing this using the Kaminari gem is: @users = Kaminari.paginate_array(User.all.shuffle).page(params[:page]).per(20) The issue with this is that User.all is re-shuffled on each

OAuth :: Not allowed 401 int twitter-omniauth gem

I have been trying to authenticate users using twitter-omniauth gem for last days, yet not successful. (Authentication with facebook works perfectly) I'm keep getting 401 Unauthorized error. I search through stackoverflow, but none of the answers cou

Problem with Association on rails 3

View <%= form_for @product, :url => admin_products_path do |f| %> <div> <%= f.label :name %> <%= f.text_field :name %> </div> <div> <%= f.label :description %> <%= f.text_area :description, :rows => 7 %&g

belongs to: class_name behaving weirdly

I have a Task model and User model. A task can be assigned a user to process it, while a user can be assigned many tasks. The field names are a little off so I am trying to use the class_name options etc, but for whatever reason I'm getting some odd

How to get the post ID in the rails?

This is is how I have my models define for a simple blog def User has_many :comments, :dependent => :destroy has_many :posts end def Post belongs_to :user has_many :comments end def Comment belongs_to :user belongs_to :post end In my Post Controller

Best way to randomize (Ruby / Rails 3)

This question already has an answer here: Rails select random record 7 answers I'm currently using: @users = User.order("RANDOM()").limit(6) to generate a list of 6 random users - however, this method takes a 1200ms toll on page load times. Is t

Graph of the Facebook Graph API

I wanted to use the Facebook graph API in my rails app. What is the recommended gem to work with the FB graph APIs? ThanksThis is a well written FB graph support for Ruby - https://github.com/nov/fb_graph

Improve and "every" statement using Ruby

I am using Ruby on Rails 3 and I would like to improve the following code. accounts = [] ids.each { |id| accounts << Account.find_by_id(id) } puts accounts How can I do?If ids might have ids which don't correspond to real Accounts: accounts = ids.ma

Ruby / Rails Parsing Emails

I'm currently using the following to parse emails: def parse_emails(emails) valid_emails, invalid_emails = [], [] unless emails.nil? emails.split(/, ?/).each do |full_email| unless full_email.blank? if full_email.index(/\<.+\>/) email = full_email.m

Geocoding Gem for Mongoid

Is there a geocoding gem similar to acts_as_geocodable for Mongoid? So far as I can tell all geocoding gems seem to be built for ActiveRecord.Geocoder seems to work with mongoid http://www.rubygeocoder.com/ There is also a nice screencast here http:/