ruby-on-rails

Rails AJAX request also calling entire original page

I'm using jQuery getScript in Rails to load an AJAX search on a dashboard page. I just noticed, though, that in addition to properly making the call it's ALSO reloading the entire page (in the background). I have no idea why this happening. I checked all my before_filters, all my authentication logic, I tried using different jQuery a...

How can I add a column to reference to another table on RoR?

Here is the Customer: class CreateCustomer < ActiveRecord::Migration def self.up create_table :customers do |t| t.column :email, :string, :null => false end end def self.down drop_table :customers end end And this is the customer Info: class CustomerInfo...

Some basic questions about 'delayed_job'

I'm trying delayed_job now, and have some questions. From the http://github.com/collectiveidea/delayed_job page, I can see some information: Workers can be running on any computer, as long as they have access to the database and their clock is in sync. Keep in mind that each worker will check the database at least every 5 ...

Paperclip image uploads in Rails - Paperclip::CommandNotFoundError

I'm using paperclip to handle image uploads to rails. it worked fine on my dev OSX machine, but now on my web server I get this error: [paperclip] /Users/marky/bin/identify '-format' '%wx%h' '/tmp/stream,16451,2.JPG[0]' 2>/dev/null [paperclip] An error was received while processing: #<Paperclip::CommandNotFoundError: Paperclip::CommandN...

Cucumber not outputting to the console

I'm playing with cucumber but for some reason the features and scenarios are not being outputted to the console. When I run cucumber features I get Using the default profile... .... 1 scenario (1 passed) 4 steps (4 passed) 0m0.071s So my tests have passed but I can't see my features or scenarios. Is there a command line flag or s...

Apache+Passenger - Apache running; but not responding to requests

Background I'm running a Ruby on Rails application that has to serve a lot of static files as well. My setup currently is: Debian Linux Lenny 5.0 Apache 2.2.9 Passenger 2.2.10 The problem Everything runs fine. I see apache process spinning up, passenger instances get created and everything works fast and snappy. Then, after som...

PDFKit in rails gives service 500 error

I am trying to use pdfkit in windows in my rails 2.3 environment. However the middleware that pdfkit gives some error which causes rails to load the service error. What do i do about this? Are there any alternatives to PDFkit which are easy to use ? Well i am currently following the Rails screencast on PDFKit. I installed the pdfkit ge...

Optimizing Rails loading for maintenance scripts

Hello, I wrote a script that does maintenance tasks for a rails application. The script uses a class that uses models defined in the application. Just an example, let's say application defines model User, and my class (used within the script), sends messages to it, like User.find id. I am looking for ways to optimize this script, becau...

How to run some tasks in the background and put the results to a global memory hash?

I'm building a website with Rails which can let user check if some domains have been registered. The logic is designed like this: There is a text field on a page let users input some domain names When user click check button, the input will be post to the server server get the inputs, create a background task(which will be executed in ...

passing values to partial in rails 3

Here is how I pass the values/variable to the partial: <%= render "partials/banner", :locals => {:text_1 => t(:"main.home.banner_text_1"), :text_2 => t(:"main.home.banner_text_2") } %> then in the partial: <%= text_1 %> <%= text_2 %> but getting "undefined local variable or method ...

Can I centralize the RoR error into one place?

If some user encounter any errors in the application, I don't want to the user see the default error page, for example, routing error, or some others error. How can I show an error page only (for example, an "Error occur", but not showing any errors in font of the user) , and redirect back the user to main page. How can I modify my appli...

Rails: Nested Resource Content App Management Structure

I am new to rails, and working on an internal content management app. I have made a prototype, but feel that it is messy and there is a better way. I require the following: My current prototype uses the workflow (http://github.com/geekq/workflow) plugin to manage the state of both the project and topics. I have also looked into acts_as_...

How to test custom rails form builders?

What's the best method to test a custom form builder? Is there a test ActiveRecord class/object in Rails' test suite that i could use, or do i have to create my own mock-class? Which AR behavior do i have to 'emulate'? ...

Create resource from another site

Hi, I'm facing this problem, I have a model called Post and I'm creating a new post in this way def create @post = Post.new(params[:post]) @post.save end so, if I want to give at the user the possibility to create a post from his website, what should I do? I need to create a sort of webservices? Thank you ...

RoR: I'm having trouble doing a simple link to an action

I am trying to link to action addData in the entries controller. I have constructed the link like this: <%= link_to image_tag (w.link, :border =>0) ,:controller => :entries, :action => :addData %> but when I click on the link, I get this error: Couldn't find Entry with ID=addData I'm pretty sure this is because I have a restful d...

Using Apache Mahout with Ruby on Rails

I have a ruby on rails application. I have the idea of implementing recommendations in the application. I came to know about Apache Mahout through stackoverflow. Now, If I have to use Mahout, what are the stuff that I have to do. Since it is a Java library, I am not clearly sure how to use it in an Ruby on Rails application. I have a cou...

class declaration for ruby

im new to ruby and rails. in RoR3 a controller inherits from the ActionController::Base request.env["SERVER_ADDR"] so request is a method in Base class (that is inside the ActionController module)? what is env then and ["SERVER_ADDR"]? would be great if someone could make a little code example...that would be very helpful to unders...

Is a redis instance can only work for 1 project?

I'm using Rails with redis. From the introduction of Redis, I found such information: start redis server: redis-server use redis client: > redis-cli redis> set key value OK redis> get key "value" From the sample, I have a question: Is a redis instance can only work for 1 project? You can see, there is no "database" or "collectio...

Is the 'spec' command deprecated in rspec2?

I ask this because typing spec returns this error.. ..ruby-1.9.2-head/lib/ruby/site_ruby/1.9.1/rubygems.rb:335:in `bin_path': can't find executable spec for rspec-2.0.0.beta.17 (Gem::Exception) But 'rspec' seems to work. ...

RoR3 api documentation for all methods used in a controller?

in a controller i can use request and params methods. i know each controller is inheriting from ActionController::Base. however, i cannot find these 2 methods in the api documentation for ActionController::Base http://api.rubyonrails.org where are these methods defined? it would be great to know ALL methods that i can use in a control...