Hi,
I want to use vim to edit restructured tex and see the result in the firefox. I found this posting http://www.zopyx.com/blog/editing-restructuredtext-with-vim which shows the way. It works but every time it opens a new instance of firefox. I want it to open only one instance of it not several tabs of it.
Here is the code:
:com RP ...
I'm having problems with my rails custom validations.
def validates_hsp_program(*attr_names)
options = attr_names.extract_options!
regex = '^('
err = ''
$CetConfig.program.each do |key, val|
regex << val.to_s << '|'
err << $CetConfig.program_prefix + " " + val.to_s + ", "
end
regex.chomp!('|')
...
I have a database of ad html, and some of them contain Javascript functions. Is there a way to have rails allow javascript: tags for a particular attribute on a particular model?
To clarify further, I can bring the html up in an edit form, but when I try to submit, my browser (Firefox) says the connection is reset. IE gives me an error...
What are best-practices (or usual-practices) when it comes to adding more steps in a process in Rails?
For example, I am working with the Spree e-commerce Rails platform and I would like to add a multi-step form people should fill out when trying to "Add to Cart" a Product.
The current spree implementation of adding a product to the ca...
Howdy,
I'm having big trouble testing with rSpec's controller API. Right now I'm using a middleware authentication solution (Warden), and when I run the specs, the proxy added by the middleware is not there, and all the authentication tests are throwing NilPointerExceptions all over the place.
It seems rSpec is not adding the middlewar...
I'm trying to define a static variable and methods in a module that will be extended/used by numerous classes. The following example demonstrates:
module Ammunition
def self.included(base)
base.class_eval("@@ammo = [bullets]")
end
def unload
p @@ammo #<-- doesn't work
end
end
class Tank
include Ammunition
@@...
I'd like to utilize an etherpad interface on my website. Two questions:
1) is there any site with an etherpad api that I could just call remotely?
2) if not, how much trouble is it to install scala and have the two run concurrently?
Thanks
...
I was hoping to run some unit tests but this is what I am getting. The internets are silent on the issue. Rails 2.1
Let me know if there is any other info that would help.
mike@sleepycat:~/projects/myapp$ rake test:units --trace
(in /home/mike/projects/myapp)
** Invoke test:units (first_time)
** Invoke db:test:prepare (f...
What is the standard Rails plugin for syntax highlighting (in a website admin panel for example, not for TextMate) that works right out of the box in a Rails project?
...
In my search form I have a collection_select feature for picking a category.
<% form_tag search_places_path do -%>
<%= collection_select(:place, :category_id, Category.all, :id, :name) %>
When I try this in the controller:
@places = Place.find(:all,
:conditions => ["category_id = ?", params[:category_id]])
I ...
I have an index action and I would like the user to be able to filter the results on the index page by clicking on "filter links" on the same page.
There is a nice railcasts video that allows you to filter results by typing into a search box.
I would like to filter results based on links the user clicks. How can I do this? Is there a w...
I'm trying to access my parent model in my child model when validating. I found something about an inverse property on the has_one, but my Rails 2.3.5 doesn't recognize it, so it must have never made it into the release. I'm not sure if it's exactly what I need though.
I want to validate the child conditionally based on parent attri...
I am working on a project in ruby on rails and I am having a very difficult time with a basic problem. I am trying to call a custom action in one of my controllers, but the request is somehow getting redirected to the default 'show' action and I cannot figure out why.
link in edit.html.erb:
<%= link_to 'Mass Text Entry', :action=>"crea...
Hi, I'm (completely) new to ROR and have got an application to maintain and upgrade. I've the source code and am trying to build database using db:migrate rake command. I've started using Aptana Studio for the development. When I run dg:migrate I get following errors:
rake db:migrate
(in G:/Projects/.../.../trunk)
MissingSourceFile no s...
I have a Rails project and I used Migrations to setup the database schema (I'm using sqlite3). I have a XML file that I want to insert into my database. What's the best way to approach this? I'm thinking there's some Ruby script that I can write once and use to parse the XML file and insert it into my database, but intuitively it feels l...
Hello all
I have the php script where the password encoding done using the
openssl:
$key = openssl_get_publickey($certificate);
openssl_public_encrypt($pass,$userPassCrypted,$key,OPENSSL_PKCS1_PADDING);
openssl_free_key($key);
Now I trying to make the same with ruby
require 'openssl'
cert = OpenSSL::X509::Certificate.new(certi...
I'm working on some code that uses a lot of after_save callbacks, and I remember seeing a plugin that allows the model.changes array to persist after a call to save.
It would be a great help if I could just write if body_did_change? in my after_save calls, instead of having to hack together something with a before_save filter just to se...
I need to generate excel documents with ruby (from rails) on a Linux Machine.
I know of Spreadsheet::Excel, but it doesn't support formulas, and uses a pretty old format..
Is there any other option, not necessarely free or opensource, that is a bit more powerful?
thanks
...
I want to use the current version of bundler (there have been quite some changes from 0.8 to 0.9) to mange the gems of my Rails app. First I created a Gemfile in the root of the app folder and added all the needed gems to it. Then I placed (as recommended in the manual) the following code to my config/environment.rb:
begin
# Require t...
Hi,
I've made a rails rake task that uploads/crops/re-sizes (with paperclip) silly amounts of images.
I wanted to know how to output a message to the terminal when it was running (e.g. chipolata.jpg processed) and at the end, it takes a good few minutes to run and a little feedback would be good.
Thanks.
...