ruby-on-rails

Ruby on Rails installation error on Ubuntu

Hi I am a newbie to rails. I just started learning Ubuntu, I am using version 10.04 especially to work on rails and use feedzirra in my college project. I am getting the following error. Could you please help. anergroup@ubuntu:~/ruby$ ruby -v ruby 1.8.8dev (2010-10-01) [i686-linux] anergroup@ubuntu:~/ruby$ rails -v Rails 2.3.8 The l...

let user modify css propertise from front end of rails app

hi all i am creating a cms / portal that i want each user to change certain css properise ie colors, widths, backgrounds etc to customise there own version of my site. What is the best way to do this ? i have looked into sass but not sure if this is possible from front end as the css would need to be recompiled each time etc ? Any on...

Use Authlogic with Typus

Hi, I'm switching to Typus because I prefer its UI over ActiveScaffold and I love the way you can set roles for the admin section. We need that. However, where ActiveScaffold worked flawlessly with Authlogic, Typus doesn't. I'd like to combine the two anyway, but can't seem to find out how. Typus has very basic password encryption, but...

How to receive email via IMAP protocol in Rails 3

What is the best way to receive email via IMAP protocol in Rails 3? ...

PostgreSql + Searching Issue for "'" present in string

Here, I have a problem in searching record in Postgresql DB in RoR Application. Name of table :: address_books, name of attributes :: organization_name, federal_tax_id, city, zip , business_name. In search, organization name contain :: Claire's Inc as record. At the time of searching, it does not show the data while we select Claire's I...

integrated email in and out system in rails app

hi all i have a cms / portal rails app and i want to allow users to send and receive emails from within the application. I want to do this so that i can record and show all activity / communications from and to users contacts. I have done this in another site but had problems displaying and creating html emails within the site. Style...

rails 3 & mysql2 installation on XP.

i want to install rails 3 on windows XP with mysql.rails 3 install straight but during mysql2 installation it gives Native Error Exception .If some one install rails 3 with mysql2 on windows XP please show the installation steps. Error Like this.... D:\ROR\InstantRails\rails_apps>gem install mysql2 Building native extensions. This coul...

Ruby on Rails application not regenerating stylesheets on deploy

I have a Ruby on Rails application that is not generating stylesheets properly. Sometimes SASS doesn't compile the SCSS into CSS and sometimes they concatenated CSS are not generated. I basically get an error writing the files, like this: Error Message: Errno::EACCES: Permission denied - /var/www/app/releases/20101004114929/public/style...

Rails 3.0 - is there a built-in search functionnality in any of ActiveRecord classes ?

Dear all, I'm kind of new to rails - I'm currently learning by developping a web-app, similar to the Agile Rails book (with iteration and all). Knowing rails, I know there's a great way to search in the database. So my question simply is : what is the good way to do so ? - the rails way. Search criteria are classics (keywords in sente...

rails: store output of XML builder in database

In a rails (2.3) app I have been building, I have an XML builder that outputs neat XML. I need to take a snapshot of this XML and store it in the database (or file) upon a certain user action. How do I get the output of the xml builder view from in the middle of another action? This code causes a deadlock in a single threaded applicat...

Maximum value of ActiveResource timeout

This is a bad thing to do but this temporary fix I want to push to production wants me to increase the timeout of ActiveResource. I've set it to 120 seconds. How much further can it go ? ...

Regular expressions: How do I grab a block of text using regex? (in ruby)

I'm using ruby and I'm trying to find a way to grab text in between the {start_grab_entries} and {end_grab_entries} like so: {start_grab_entries} i want to grab the text that you see here in the middle {end_grab_entries} Something like so: $1 => "i want to grab the text that you see here in the middle" So far, ...

Error when comparing two DateTime objects in Ruby on Rails

I'm comparing two DateTime objects (at least I think I am, they look slightly different in the console output below). p DateTime.now p current_user.created_at #schema.rb states that this is a datetime field difference = DateTime.now - current_user.created_at p difference Console output Mon, 04 Oct 2010 22:56:32 +1000 Sat, 14 Aug 2010...

Accepting nested attributes on a belongs_to association

I have a complex form for scheduling events. Here are the abbreviated associations: class Event < ActiveRecord::Base belongs_to :client accepts_nested_attributes_for :client, :reject_if => lambda { |a| a[:name].blank? } end class Client < ActiveRecord::Base has_many :events has_many :questions, :dependent => :destroy accepts_...

like and share in one single button in facebook

Hi. I am a ruby on rails developer can any body tell me how can I prompt the user to like the app when he click on share button of facebook ...

How to name a model something like FileURL

Hi, I want to create a rails' model like FileURL without having to name the file file_u_r_l.rb. How does one go about doing something like this? I understand that you can set table name explicitly but how does one override the default filename to classname mapping? Thanks Prateek ...

Rails-way: Group has_one Manager, Salesman, Contact, Owner, Speaker... all User, how to distinguish?

What is the correct way to model many has_one (or even has_many) relationships on a model where each has_one is just a different role/context of some class? class Group < ActiveRecord::Base has_many :memberships, :as => :membered has_one :admin, :class_name => "User", :through => :memberships has_one :speaker, :class_name => "User...

How do you test route constraints using RSpec

Given a couple of cities in the DB: City.first.attributes => {:id => 1, :name => 'nyc'} City.last.attributes => {:id => 2, :name => 'boston'} And a route like: match '/:city/*dest' => 'cities#do_something', :constraints => {:city => /#{City.all.map{|c| c.name}.join('|'}/} (so the constraints should evaluate to: /nyc|boston/) And a ...

Replace the Boolean Characters from SQL as Text in Rails

Dear All, I am having a data of boolean datatype values such as True/False in sql database column. I created an array of T/F using the find_by_sql (select) options. Now I need to print the array not as True/False. Instead of that I have to print "It Occurs", if data populated as True. nothing should be printed if it is false. How I can ...

i have a facebook user logged in my app. how to get ID's of his friends?

If I have in my web application a facebook user logged in. I want then to be able to post to his friends sth on their new's feed. For this I need an ID of his friend that i want to post to.(at least I think I should need an id or maybe there is some other way). So the question is how to get the ID's of his friends. I can get all the nam...