I have user entries as filenames. Of course this is not a good idea, so I want to drop everything except [a-z], [A-Z], [0-9], _ and -.
For instance:
my§document$is°° very&interesting___thisIs%nice445.doc.pdf
should become
my_document_is_____very_interesting___thisIs_nice445_doc.pdf
and then ideally
my_document_is_very_interest...
Hi,
I'm an application developer going web.
After deciding to dump google-apps I'm now starting with Aptana's Rad Rails.
Is there a simple tutorial which will take me through a sample project like "stock quote project" or such for Ruby? which is the best one?
thanks!
...
Hi,
At the minute all my fixtures have the same name as the table that they are intended for, because of a recent issue with rails it doesn't seem possible to have a fixture beginning with the word 'test'
Does anyone know of a way to have a different fixture name and then map it to the correct table?
Thanks,
Andy
...
Hi,
How is it possible to generate an absolute link to the javascript file.
I assume there should be something like the one below (which unfortunately does not seem to be available):
javascript_url 'main' # -> 'http://localhost:3000/javascripts/main.js'
instead of:
javascript_path 'main' # -> '/javascripts/main.js'
I need the a...
Hi,
I'm writing a web application in Rails which uses sqlite. I want the user to be able to search a table in the database by using a regex. Is this possible? Thanks.
...
Sometime back in a blog or in podcast I heard about a rails plugin that takes care of everything you need to worry about launching the site. The webpage will capture the email address of people visiting the site before the launch. And , I think, it also integrates with madmimi to send out emails to those people.
I am not able to recall ...
Is there any way to prevent ActiveRecord from issued a SHOW FIELDS to the database when it's not needed?
I'm working on database performance critical application, and just noticed that on a typical query my SELECT takes 0.5 ms and the related SHOW FIELDS takes 2 ms -- 4 times longer! Even more importantly, it's not needed because I'm al...
The point here is to browse the array docfiles and return two arrays (temporary_file_paths and temporary_file_names).
I decided to return a Hash, but I feel I could get rid of the 2 temporary arrays but I'm not sure how...
def self.foobar docfiles
temporary_information = Hash.new
temporary_file_paths = []
tem...
I am currently using nested model mass assignment on one of my models. It works a treat, however, I'd like to be able to ensure that any nested models that are created "belong_to" the same user.
I've managed to implement this by using alias method chaining with:
def contact_attributes_with_user_id=(attributes)
self.contact_attrib...
Hello all. I've got a question about how Rails handles cookie
encryption/decryption.
I've got this in my config/environment.rb
config.action_controller.session = {
:session_key => [some key],
:secret => [some secret]
}
And this in config/environment/production.rb et al.:
ActionController::Base.session_options[:session_...
I've been working on learning to use Rails the last couple days and I've run into something that I haven't been able to solve with Google.
So I'm just creating a basic contact form that sends an email. Everything seems to be working ok in testing, which tells me that the form is working, and ActionMailer was implemented correctly, howev...
I have a user model that checks to see if a value has changed before_save (by running User.zipcode_changed?). The idea is that this will queue up a delayed job if it has.
Problem is, when I migrate the app from scratch I get an error:
An error has occurred, all later migrations canceled:
undefined method `postcode_changed?' for #<Use...
I'm looking to create a Rails application which generates XML instead of HTML. How do I do this?
...
I have a Rails app that is storing some user information in a cookie, and that information isn't being stored as soon as I would like. A client that is performing five requests in a row from a single page has an empty cookie until the page has completely loaded, and then for the future, the cookie is populated. It is behaving as if the...
I've got a form with nested objects as described here:
http://ryandaigle.com/articles/2009/2/1/what-s-new-in-edge-rails-nested-attributes
It's working fine, but I need to sort the nested objects in the form by their "name" attribute so they are listed in alphabetical order.
Any ideas?
...
I am writing a plugin that provides drafting for models. A delete action is a draftable action and I do not always want to delete the origin until that deletion is published. So I wrote my own destroy method to help out with this. Everything works exactly as I want things to except, custom callbacks for :before_destroy and :after_dest...
I may have over-complicated what i need to do but this is what i now have.
I jab a jobs controller that have 2 fields
starts_at as DATETIME
end_time as DATETIME
I save the event_date in a form using a
calendar_date_select :starts_at ,:time => false
I save the date time as
time_select :starts_at, {:twelve_hour => true}
This sa...
I found example how to use on:
http://www.claytonlz.com/index.php/2009/04/how-to-setup-rspec-cucumber-webrat-rcov-and-autotest-on-leopard/
but I try to find solution to put this all gems to gem.config (enviroment.rb) with using
gemcutter gem repository (this is prefered gems repository now ?)
Maybe some one have properly configured ge...
I have a simple find statement as such:
m = MyModel.find(1, :include => :my_children)
With m.mychildren being an Array; is there anyway to find a particular record from within the array without having to iterate over the entire thing. If I do mychildren.find(1), a new DB query is issues, which doesn't make sense, since they are all lo...
is it possible to add an option like :include_blank => 'Please Select' in a method select _ tag like it is posible with the select method? it seems not to work. is there any substitute for this for select _ tag method?
thank you for your answers.
...