Why do the Rails helper methods prevent "unobtrusive JavaScript"?
I heard Ryan Bates say that the Rails JavaScript helper methods prevent "unobtrusive JavaScript". Is this correct and, if so, could someone explain why? ...
I heard Ryan Bates say that the Rails JavaScript helper methods prevent "unobtrusive JavaScript". Is this correct and, if so, could someone explain why? ...
I am using the google geocoding api in my app but im finding it hard to parse the returned address information reliably. Im hoping someone has a library or way of parsing the info to prevent me from having to write this my self and cover every case. Im using the json api and can extract the address line and the coordinates easily enough...
I'm looking at this Railscast episode and wondering why the call to escape_javascript is needed here: $("#reviews").append("<%= escape_javascript(render(:partial => @review)) %>"); What is escape_javascript used for? According to the Rails docs: escape_javascript(javascript) Escape carrier returns and single and double quo...
Not exactly sure how to look this up, but I'm not finding the solution anywhere. I want to assign an array of users an array of websites. Like so: users = User.all sites = Site.all users.each do |user| sites.each do |site| user.websites << site end end Obviously, this does not work because I'm missing something about block s...
Ok title is confusing, Ill tell you my problem first: the polymorphic_url method was changed in Rails 2.2.1 to include some extra functionality I need. However, I want to make the application still work in older versions of Rails, so I wanted to patch on the 2.2.1 behaviour if an older Rails version is running. alias_method_chain to th...
I am on leopard. It comes with Ruby 1.8 & Sqlite3 pre-installed. I have updated ruby to 1.9.1 & added Mysql. Here's the problem. I cannot get the path to correctly point to ruby 1.9.1. I tried to update the sym-link to no avail. I am able to get into Mysql from the terminal but I cannot connect to the server through Ruby because Sqlite3 ...
If I have an international phone number such as this: 0541754301 how can I format it to produce something like this: 0541-754-301 ...
I'm investigating a rails app - the prod server has two version of a specific gem installed, how can I tell which version the prod app is using? ...
Hi, I'm using Ultrasphinx with Aspell spelling support to search a Rails app. I want my users to be able to search using boolean operators ("king OR queen"). I'm using the german aspell directory, since the app is for Germany. The Problem: Ultrasphinx always proposes corrections for the boolean OR ("did you mean 'king OHR queen'") whic...
I have a rails create action which send back some jquery in a file: create.js.erb var appearance = $("<%= escape_javascript(render(:partial => @appearance)) %>").effect("highlight", {color: '#E6ff00'}, 2000); $("#sortable").append(appearance); $("#new_appearance")[0].reset(); I have started using HAML and want to know how I should be...
Here's what I've determined: Delta indexing works fine in development Delta indexing does not work when I push to the production server, and no action is logged in searchd.log I'm running Phusion Passenger, and, as recommended in the basic troubleshooting guide, have confirmed that: www-data has permission to run indexing rake tasks (...
Rails is a target that moves fast which makes finding up-to-date books difficult. I know there are some great Rails Guides that cover Rails 2.3; but sometimes I just want something in print. Are there any Rails books that have recently or will soon be released that cover up to Rails 2.3? Thanks ...
Say I have controllers Apples and Bees, and new actions in both. In Bee's new action, I set some variables for display in 'bees/new'. I happen to also want to render this same template from Apples's new method. What's the correct way of setting up the variables in this case? I take it copying over the assignments from Bees isn't the ...
Hi there we're using memcache in several of our Rails applications. Now I was wondering: Is there a way to get a list of all objects stored in memcache including the amount of data each value occupies? E.g.: key | memory(Bytes) | % ----------------------------------- foo_key | 15013 | 0.3 bar_key | 2201 ...
I have an existing database(Postgresql). How can i create models from it? How can i pass column names for Rails? As if something like this: Person: Name :table_name_for_name_attribute Surname :table_name_for_surname_attribute PersonalCode :table_name_for_perconal_code_attribute Unfortunately, my database is not following Rails convent...
I am making a RoR site that is delivered in several languages, and want to change a part of the url by its language. ex. http://xxxx/en/index.html http://xxxx/fr/index.html I know I can do this via the route.rb map.locale ':lang/index.html' and designate the language when calling this in view. However, there is an exception to this...
I'm trying to understand what does and doesn't work in Ruby gems (primarily from the perspective of creating one for myself to reuse functionality from one project to the next). When you create a Ruby gem, are you limited to including only Ruby functionality or could you create a gem that consisted of Rails templates, CSS files and Java...
A user has many employments. What do you think? Is this a valid and clear way to fetch all siblings (belonging to the same user) of a given employment object? class Employment < ActiveRecord::Base belongs_to :user has_many :silblings, :primary_key => :user_id, :foreign_key => :user_id, :class_name => 'Employment' end...
When I try to upload a photo in Ruby on Rails using Paperclip on my local machine it works perfectly. When I try to upload a photo in Ruby on Rails using Paperclip on our Linux (CentOS 5.2) server with Apache and Phusion Passenger, I get: 2 errors prohibited this user from being saved There were problems with the following ...
I'm trying to find a solution to add HTTP digest auth to a site that uses Authlogic. Authlogic itself only supports HTTP simple auth. I'm googling and googling and can't find any ready solution or even an outline. ...