ruby-on-rails

Using Prawn & Prawnto for Rails PDF generation

This is probably more a design or usage question but the main issue is using the Prawn plugin with Rails 2.3.4 and accessing the resulting PDF object to render it to a file. The scenario is basically; a controller with the respond_to block setup a view with code for rendering the text, graphics etc to PDF It looks like: From C...

Haml installation in Rails app failing

I have a small rails app I got all gung-ho on tonight wanting to convert all the erb to haml templates. The Haml docs suggest running haml --rails /path/to/app to install it as a plugin (using the gem already installed on the system). Unfortunately, when I attempt to start the webserver for rails, I receive the following error: /code/s...

Multi-page Account Creation

I'm trying to build a user sign-up page that will span three pages and create two records, a user object and a ticket object: the first (index) collects just one summary field of the problem. the second (signup_a) collects the detail description of the problem, autopopulates the summary from previous, a few associated details that will...

ferret_server start problem druing the deploy

Hi When do the cap deploy everything works fine except the ferret-server, while restarting server its try to stop the ferret_server in production mode and try to start the ferret_server but it fails due to permission problem .Here is the output from my deploy file** transaction: commit executing deploy:restart' triggering before ca...

Problem create resource through web-service

I want to let anybody to create user into my site, so I tired create some dummy user scaffold and use curl -d "user=dummy" http://localhost:3000/users ,but this not work. How to accomplish this kind of task. ...

multi-friend-selector action does not break out of iframe

we have a facebook app and every time a user invites a friend the application redirects to the "action" URL but it's always facebook inside of an iframe. For the life of me I've tried every combination of URL's for the action, but it just won't break out of the frame. Any idea how to avoid this? Thanks, Chad ...

How to prevent caller from continuing after redirect_to in Rails ?

Hello, I defined a before filter in my controller: before_filter :find, :only => [:caller] and I want to catch exceptions in "find" method : def find begin ... rescue Exception redirect_to somewhere end end but how can I prevent the "caller" method from continuing executing ? ...

rails Rake and mysql ssh port forwarding.

Hello, I need to create a rake task to do some active record operations via a ssh tunnel. The rake task is run on a remote windows machine so I would like to keep things in ruby. This is my latest attempt. desc "Syncronizes the tablets DB with the Server" task(:sync => :environment) do require 'rubygems' require...

Playing around with mails in Rails

Hi, I`m trying to create the following feature: You register and receive an email like [email protected] and when you send something to this email it automatically appears in something like your wall... So my problem is how to realize the creation of the email and the receiving of the mail itself. Any ideas? ...

Are multiple ActiveRecord instances kept in sync automatically?

Assume this code instance1 = MyModel.find(1) instance2 = MyModel.find(1) Is instance1.equals(instance2) true? (i.e. are they the same objects?) And after this: instance1.my_column = "new value" Does instance2.my_column also contain "new value"? ...

Avoiding race condition in a Ruby on Rails application, how to?

I'm developing a rails application in which each subdomain has a separate database. And I'm doing something like this. #app/controller/application_controller.rb class ApplicationController < ActionController::Base before_filter :select_database private def select_database MyModel.use_database(request.subdomains.first) end e...

Geokit error - "uninitialized constant"

I followed the install steps to the letter to get Geokit working on my site. I can do a distance calculation just fine, but when I try to render a Google map using: @map = GMap.new("map") It throws me this error: NameError in TechsController#home uninitialized constant TechsController::GMap Anyone know why? I have a feeling it h...

Crypto requirements and language/framework selection.

I want to build a web-based information management application for a client. The application will be used to store passwords and critical documents online. I want to know: (1) Which language/framework to go with: PHP or Ruby on Rails (RoR) or any other? (2) What type of hosting for good-security, Linux or Windows? Any other thing to b...

How to reset a single table in rails?

I want the primary key values to start from 1 again. ...

Rails - How to set a validation to occur in just one of my own controller methods

I have a password_reset_token field in my model and it just stores an authentication token which will be used to parse a reset password url. It's going to be nil unless the forgot_password method in my controller is called. It's here the token is generated. I want a validation to only run here otherwise every time I update a user obj...

Calling a rails app's main 'yield' from a partial

Hi, my question is very simple. I will ask it first incase the answer is obvious, and then I will explain what I mean, incase it's not obvious. Is it considered ok to make your main 'yield' call from a partial instead of doing it directly from your layout.html.haml file? Does doing so result in any kind of perforance loss. Explanat...

SQLite3 problem since Rails 2.3.5 update

Hi, I was running Rails 2.3.4 with SQLite3 on a Snow Leopard box without any problems. I've just done a pull on a new project that requires 2.3.5 so I did a sudo gem update to get the latest version of Rails. This installed fine but when I ran rake db:migrate I got the following error: rake aborted! uninitialized constant SQLite3::Driv...

Rails - How do you insert a variable into a regular expression (Regex) for instance assert_match

I want to do something like assert_match /blah blah blah #{@user}/, @some_text but I'm not having any luck with it working. What am I doing wrong here? ...

auto page breaks when printing long pages with ruby on rails

hi all I have a rails app that creates quotations with information and images on that can be very different in size and the data they display. Each quote contains many setions of varying sizes. I need to find a way to auomatically put page breaks into the quote when printing so that none of th sections are cut into printing on 2 pages...

Rails Friendly URLs

Hello, I have a model called Project and I've defined the "to_param" method as this: def to_param permalink end I am using this permalink plugin github.com/febuiles/make_permalink so when I call p.permalink it will generate id-name. The problem is that when I TYPE /projects/1 in my web-browser the URL doesn't change to /projects/1-...