ruby-on-rails

rails jQuery Accordion

How do you set up jQuery to work with rails. I specifically want to use the accordion feature. I have used this before with PHP but i cannot work out where everything needs to go in a rails application. I have imported jQuery into the javascript folder and included it in the application. My HTML is laid out correctly, but i don't under...

working on a big social network, what is the most efficient programming language to use ?

am collecting information to support the re-search that will help to decide which is the best programming language for my project, a team of 4 different experiment developers will start working on a new complex social network, so am looking for the language that will fit my project. 1) the project is divided into modules, that will be ...

Apache rewrite Subdomain to proxy balancer

I'm trying to select a proxy based on a subdomain for a rails installation on apache2 with thin. site1.domain.de -> <Proxy balancer://site1>... site2.domain.de -> <Proxy balancer://site2>... etc.. for a single domain I'm doing the following: <Proxy balancer://site1> BalancerMember http://127.0.0.1:8000 BalancerMember http://127....

Problem with active-record and sql

Hi everybody, I have a little problem: I can't compose sql-query inside AR. So, I have Project and Task models, Project has_many Tasks. Task has aasm-field (i.e. "status"; but it doesn't matter, i can be simple int or string field). So, I want on my projects index page list all (last) projects and for every project I want count it's ac...

Gem installation ERROR: Failed to build gem native extension.

I have latest Xcode Tools 3.2.4 installed. Just whenever I try to install any gem, for example, the MySQL gem, such error occurs: VNMB:rails2app ABC$ sudo env ARCHFLAGS="-arch i386" gem install mysql -- \ --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib \ --with-mysql-include=/usr/local/mysql/include Pas...

run rake task from crontab

Hi! I use Ubuntu, I try run my rake task from cron My rake task: namespase :import do task :import_twitter => :environment do puts "Twitter importing...." end end schedule.rb file every 1.minutes do rake "import:import_twitter", :output => {:error => 'error.log', :standard => 'cron.log'} end with whenever I generate...

How to set Margin using rails Prawn so that, header and footer can be set and displayed outside the margins.

HI I dont have an idea of using margin options with Prawn::Document.generate command. And to use margins for the pdf with header and footer outside the margins. THis is my Prawn pdf code Prawn::Document.generate("public/test.pdf") do page_count.times do |i| go_to_page(i+1) ask = "public/ashok.jpg" ima...

rails 3 routing question.

This is probably quite simple, but how can I make a params optional? resources :places match 'register/:id' => 'places#new', :as => :register currently... it breaks if the :id is not passed which most of the time it won't be. <%= link_to "Place Sign Up", register_path %> ...

How to load all children of a better nested set with activerecord?

Hello, I'm using better nested set. I now want a active record statement, where I can get all top elements and include all elements of this root! How is this possible? I think there must be a possibility to include all the childrens into their root elements in one statement... Does anybody have an idea how to do this? Thanks for your...

Routing problem w.r.t images when using Open Layers in Rails

I'm using Open Layers to display Google Maps. When the map is displayed as a sub-part of the website, as in, 'localhost/geofences/new' , The images are being attempted to be located within the 'geofences' directory instead of loading the images from the document root and hence the images are not being rendered. Is there a solution? If n...

Which version of rails to require a lesser version of RubyGems?

I'm unable to update RubyGems because of shared hosting, but can change versions of rails quite easily. I get the following error when I try to start mongrel: ** Starting Mongrel listening at 0.0.0.0:2011 ** Starting Rails with production environment... Rails requires RubyGems >= 1.3.2 (you have 1.3.1). Please `gem update --system` an...

Find first two records from collection

Hi I want to retrieve the first two records from collection such that, collection is like: @collect_firstnames = @name.firstnames From this collection I want to fetch first two records... I used limit it is not working, :limit => 2 ...

testing a has_one relationship?

I have an object class User < ActiveRecord::Base has_one :subscription end and I have this test: it "should increment shipped count when item_shipped" do @user.attributes = @valid_attributes @user.save subscription = mock_model(Subscription) subscription.stub!(:item_shipped!) subscription.stub!(:user_id) ...

heroku rake db:migrate aborting....

heroku rake db:migrate rake aborted! no such file to load -- acts_as_ferret (See full trace by running task with --trace) (in /disk1/home/slugs/310513_b4b7e61_4c01/mnt) how do I fix this? ...

How do I run Cucumber steps concurrently in Ruby?

In our Cucumber steps, we would like to start a long running task in one step and check that the task is running and that it set up the UI for the task correctly, in another step. Checking the UI must be done while the first step is still running. Our Cucumber looks similar to this: Given I start my long running task And I navigate to...

Can't update records in my Rails database migrations

For example I have the following migration class AddStatusField < ActiveRecord::Migration def self.up add_column :tasks, :status, :string Task.update_all "status='complete'", "completed = 't'" remove_column :tasks, :completed end end When I run this (using rake db:migrate) I get the following message == AddStatusFiel...

Rails Object to hash

Hi, I have the following object that has been created @post = Post.create(:name => 'test', :post_number => 20, :active => true) Once this is saved, I want to be able to get the object back to a hash, e.g. by doing somthing like: @object.to_hash How is this possible from within rails? Thanks ...

Rails not encoding nested data from POST

Hello, I am currently working on rails3 application that uses jQuery. I have a javascript plugin that returns an array of JSON data based on selections that the user has made. I have a save button that reads this array of data form the java script plug in and posts it back to the rails application to be saved. The javascript seems to be ...

How to make a test application with First Data Global Gateway in rails?

Hi, I 've one Rails application in which I want to integrate First Global Data Payment Gateway.I am newbie to the payment gateway so don't know how to configure this with my Rails App. Thanks in advance. ...

Ruby on Rails Chinese Dictionary in Rails and MySQL?

Any help and advice deeply appreciated. I want to create a RoR website that is a chinese dictionary with 2 million entries (records in the SQLite database). Each record has 3 fields: a long Chinese word, an English text, and an integer counter (is updated every time the word has been solicited, +=1). The user inputs a Chinese word, the...