ruby-on-rails

Problem while running Resque -Sceduler in production mode.

I am getting this error while running resque scheduler on capistrano server in production mode. I'd appreciate any help,its urgent for me. (in /data/amsapp_staging/releases/20101008121309) ** Invoke resque:scheduler (first_time) ** Invoke resque:scheduler_setup (first_time) ** Execute resque:scheduler_setup ** Invoke resque:setup (first...

Using the expect{}.to change, isn't passing, but works in console

I'm trying to test a method on my model. Running in the console works, but my rspec test does not pass. Checkout the code: Model: def import(master) hsh = master.attributes.delete_if { |k,v| k == 'id' } self.update_attributes(hsh) end Rspec test: describe "#import" do let(:master) { Factory(:sheet, :work_order => 'M1234', :sa...

Redirect to XML in Ruby on Rails

I'm new to Ruby on Rails, so maybe I'm doing something wrong... In a controller (Users), I have a "before_filter" that calls an "authenticate" method in my ApplicationController class. The Users controller can be accessed via HTML or XML with respond_to do |format| format.html format.xml end The problem is when the filter doesn'...

How to test file upload to webservice in Cucumber-Rails

Hi Given I have a webservice which accepts file uploads. And I want to test it in Cucumber When I put the following code in Step Definition post '/webservice', 'picture[file]' => File.new(Rails.root.join(@path_to_file), 'rb') Then I should see the saved file Unfortunately, this is not the case. Any help would be greatly appreciate...

How to know if Spork is running

Hi. I'm trying to speed up "rspecing" in a rails 2.3.8 app with spork. When I run spork in the root of the project I get: (...stuff...) No server is running Running specs locally: Spork is ready and listening on 8989! And then, if I run specs, the message No server is running Running specs locally which appears if I run them w...

Using checkboxes with parameters from a many-to-many link table

I have the following models class Outbreak < ActiveRecord::Base has_many :risks has_many :factors, :through => :risks end class Risk < ActiveRecord::Base belongs_to :outbreak belongs_to :factor end class Factor < ActiveRecord::Base has_many :risks has_many :outbreaks, :through => :risks end Risk table id : int...

Rails 3 Exception Notification error

I am converting a rails 2.3.5 app to rails 3 app. I am getting an error in the below code the error Undefined method `filter_sensitive_post_data_parameters' for #<#<Class:0x0000010726a478>:0x000001069e7080> in app/views/exception_notifier/_request.rhtml <% if @request.respond_to?(:protocol) %> * URL : <%= @request....

acts_as_commentable_with_threading -Not returning User model on new comment creation

In my controller @comment = Comment.build_from(@post, @user.id, comment_body) @comment.save When I access, @comment.user this is weird - Watch window shows that this a User object with an object id but it is practically empty meaning the attributes is nil so when I do @comment.user.id, it chokes. The comment.rb...

The best solution to keep files in database (Rails)

I would like to know what will be the best way to save binary files 'in database'. Of course they will be on the disk as files, but i need some 'link' to them in the DB. Any great solutions? ...

Rails 3 - How do I get Rspec spec/ & autotest to work?

I was all setup with Rspec and Autotest before I updated to Rails 3. When running rspec spec/ I'm getting: * spec/spec.opts is deprecated. * please use ./.rspec or ~/.rspec instead. I tried changed spec.opts to spec.rspec and running rspec spec/ again. But now I get a whole mess of warnings: DEPRECATION WARNING: Use toplevel init.rb...

Getting Ruby on Rails 3 to work.

I just installed RoR 3 with sudo gem install rails. I tried this multiple times, but every time I run $ rails I get an error and I hate it: imac:~ rsonic$ rails /Users/rsonic/.gem/ruby/1.8/bin/rails:19:in `load': no such file to load -- rails (LoadError) from /Users/rsonic/.gem/ruby/1.8/bin/rails:19 How can I fix this? I want to u...

jquery and ajax tooltips don't work on live loaded content

Hello Everyone, I am using Ruby on Rails and Jquery as my library and 2 plugins but this should be a fairly plugin independent question. I am using the jquery.pageLess plugin which makes an ajax call to the pagination that is built in to rails in order to load new items onto the page when you scroll to the bottom (much like the new goo...

Rails 3 routing failures

I'm having a couple issues with Rails 3 routing, and I just can't fathom why things aren't working. For instance, I have a functional test that includes: assert_routing("/store/users/[email protected]/license/ch7bHtrx", {:controller => 'store/users', :action => 'license', :email => '[email protected]', :id => 'ch7bHtrx' }) which p...

How do I automatically pay users using paypal in my rails app?

Hey all, I'm trying to write a marketplace style application. Maybe E-Bay style in which the app connects buyers / sellers and then takes some commission. I cannot use Amazon FPS as I don't have a US credit card. So my best option is probably paypal. Unfortunately, most of the material out there is all about telling me how the app can ...

Activerecord limit returns NoMethodError

Hi, i'm new to rails. i'm trying to get some results from table in a controller using the limit method. I did that on the controller: @articles = Article.limit(5) And i got NoMethodError exception : undefined method `limit' But when i did it that way it worked: @articles = Article.all(:limit => 5) Although i saw the first metho...

Multiple-Word Model in a Cucumber / Pickle statement

I can't find any examples of how to use models that contain multiple words in a Pickle / Cucumber statement. Here is the statement: Given a visitor_activity_type exists with name:"ContactForm" I've tried with spaces, no spaces, underscores, and camel casing. But nothing seems to work. Of course, maybe I'm doing something else wrong. C...

Nested Attributes not being saved

I have a form for creating/editing an event. There is a Client drop down which renders some custom questions and answers dependent on the selected Client. I'm running Rails 2.3.9 with Ruby 1.8.6 and Mongrel on Windows. Here is the relevant code: Event form - form_for @event do |f| .... = f.collection_select(:client_id, Client....

confused, where are the defintions of show and index actions?

I'm looking at this code, I can see that is says actions: show and index but where are the methods show and index?? http://github.com/railsdog/spree/blob/master/core/app/controllers/products_controller.rb class ProductsController < Spree::BaseController HTTP_REFERER_REGEXP = /^https?:\/\/[^\/]+\/t\/([a-z0-9\-\/]+\/)$/ #prepend_bef...

User class inferred by Authlogic loses respond_to?

I'm trying to move the authlogic (and other common plugin) configuration from one of my Ruby on Rails applications to a plugin so that I don't have to duplicate the common permissions and authentication features in each application. The user session class is defined in app/model/user_session.rb for the main application: class UserSessi...

Ruby On Rails - Securing Downloads Area

If I upload files to my server and thus have clients/customers download these files. How may I restrict the access of the file? Such as, if I upload a file to www.domain.com/files/download.zip And if the user has correct permissions he can download the file, but what if the user knows the direct link to the file itself? Cause I can ...