ruby-on-rails

Why is my textarea input not accepting input?

When I insert a new text_area input(created by rails) into an existing form with jQuery it doesn't allow the user to type in the box, but the text_field(also created by rails) input field does. -form_tag user_posts_path do [email protected]_with_index do |post,index| -semantic_fields_for "posts[#{index}]", post do |f| =re...

How can I get vestal_versions to store the user who changed the record?

I'm using vestal_versions 1.0.2 and rails 2.3.8 I'm trying to associate a user with changes made to models as shown in the the documentation: @user.update_attributes(:last_name => "Jobs", :updated_by => "Tyler") @user.versions.last.user # => "Tyler" Documentation: http://github.com/laserlemon/vestal_versions After calling @user.save...

infinite loop in authlogic rails app

I have a rails app with authlogic and facebook. Shortly after the first time I logged into facebook, all of my pages stopped responding and logs show Processing UserSessionsController#new (for [IP ADDRESS] at 2010-07-08 00:32:31) [GET] Parameters: {"action"=>"new", "controller"=>"user_sessions"} SystemStackError (stack level too dee...

Javascript (prototype) plugin to cycle through images

Can anyone recommend a javascript plugin that rotates some small images on a card. For an example of the functionality I want check out http://sortfolio.com Would prefer Prototype implementation, but JQuery could work also if necessary. I'm curious to see if there are any other cool implementations of this too (such as just hovering t...

Multiple instances of a single object in a Rails Array?

G'day guys, trying to build a small invoicing system (that can generate PDF's using prawn), but am having an issue with generating multiples of indivdual items in the array. I have the Invoice class which has_many :items, but when I try to add a multiple of an item to the invoice, it won't actually add that to the invoice and it doesn't ...

Rails DB Seeding

For some reason, the food_id field in 'ratings' isn't populating when I run the seed.rb file below. Can somebody help me figure out why? Seed file contains the following lines: Food.create(:id => 1, :description => 'Stonyfield Farm Yomommy 4oz. Strawberry') OverallRating.create(:score => 0, :count => 1, :food_id => 1) Code for Food ...

Where to put code that generates select options

I have a select dropdown where I generate the options from database entries, then add an option to the beginning like: @select = Service.find_services_by_id(id).collect { |p| [p.name, p.id] } @select.unshift( [ "Choose a service", 0] ) Then in the HAML view I have: =select_tag "service_id", options_for_select(@select) But I'm looki...

Comparing string before and after DB save in Rails?

Hi all, I am trying to validate uniqueness on an article description. After I save it to the DB, if I retrieve it it comes back in a stripped down format (missing some chars). If I put a validator on the uniquness of the text in the desc. it doens't get called. If I do a find_by_desc it fails since the text is slightly different. Any i...

validating presence of email address (can't be blank)- Ruby on Rails

Pretty new at all this. I have a simple form for users to enter a couple pieces of information and then input their email address and push the submit button. I want to make it mandatory that they have to fill out their email address in order to push the submit button. If they don't fill out their email address they should get an error me...

Avoiding "Single Table Inheritance" in Rails/ActiveRecord and Legacy Schema

I am trying to integrate with a Legacy table that has a column named "type". Rails will "smartly" assume that whenever we have a 'type' column in a table, then it will try to use Single Table Inheritance. Is there anyway to avoid this? (I can't rename the column). ...

Any suggestion for Ruby on Rails multilingual translation management?

I am developing a Ruby on Rails application with multilingual support. Now I have 4 languages, each have a separate yml file. I found this is inconvenience that when I add a new translation, I need to add all the lines manually to each yml file. Does any good translation management tools can help me on this? Thanks everyone. :) ...

Ruby -- I have a project of ruby on rails downloaded from net...how to execute that project ??

I have a project of ruby on rails downloaded from net...how to execute that project ?? if possible send me the links or include the steps i have Eclipse as an IDE and concerned plug in installed !! Please Help !! ...

How to set a maximum login count for my rails application

For each organization , using my application need to set a ' maximum license count' ,for.example ,100.Then,one user in that organization login to the application the 'used count' become 1.If login another user, 'used count' increment to become 2.In that way, if try to access the application by many users, and 'used count' become 100,the ...

Using Webrat to check a list has a specific number of li elements

For a cucumber step, I know that a particular ul element should have 5 children li. How can I assert this with Webrat? I'm guessing there could be something like: Then ".selector" should have n ".another-selector" or maybe Then I should see n ".selector" within ".another.selector" Is there anything like this floating around, or sho...

How is ActiveSupport::SecureRandom secure?

Is the ActiveSupport::SecureRandom secure in the way that it is 'impossible' to figure out random numbers or is it secure in the way that it will return UUIDs? ...

Ruby, Rails, and Windows 7 x64

Just wanted to know if anyone out there has had the same difficulty as I have - I've done a vanilla install of Ruby 1.9.1 using the windows installer, with only a couple of gems: actionmailer (2.3.8) actionpack (2.3.8) activerecord (2.3.8) activeresource (2.3.8) activesupport (2.3.8) bson (1.0.3) jnunemaker-validatable (1.8.4) mongo (1....

user profiles lookup-table values as constants (denormalised) or models (normalised)

My site contains user profiles with fields such as hair and eye color. I have been implementing lookup-table type fields with constants in my user model, ie. HAIR = %w[shaved black blond brown red grey white bald] EYES = %w[black brown blue hazel green grey other] used in my views with collection_select statements to populate drop...

what is ruby-on-rails' order of operations when constructing from a hash?

I have an Attendance model that allows the user to enter a starting, ending and break time, each as a ruby Time object. Each attendance also has a day (ruby Date object). I want the 'Date' elements of the times to be the same, so I override the assignment operators like this: def startTime= (t) self[:startTime] = Time.mktime(day.yea...

Rails: Hash#to_json - split over multiple lines?

I'm having a slight annoyance with the javascript_I18n plugin, which generates js-friendly versions of the I18n translation tables, so that you can localise your javascript. It all works fine, but it works by calling to_json on each locale's translations hash and outputting the results into a file. When you call to_json on a hash the r...

Apache rewriteCond Rails multi domain setup cache

He People. I have a rails app running for multiple sites and it has a cache that looks like this: tmp/cache/adomain.com/the cached files No this is not picked up by Apache (obviously) and i am trying to set it up in my httpd.conf. But I wasn't able to get it working. This is something i tried: < VirtualHost *:80 > Passenger...