AJAX upload using Prototype.js plugin
Hi friend, How to upload a image file using ajax by using prototype.js plugin, I need to display those image after it is uploaded please help to solve this problem. Thanks ...
Hi friend, How to upload a image file using ajax by using prototype.js plugin, I need to display those image after it is uploaded please help to solve this problem. Thanks ...
In most frameworks, sending a redirect means setting the HTTP headers and exiting without sending any HTML data back to the browser. However, using Firebug I see that Rails is not following this convention: def update @phone_number = PhoneNumber.find(params[:id]) if @phone_number.update_attributes(params[:phone_number]) fl...
I want to save to a log file some SQL query rails performs, (namely the CREATE, UPDATE and DELETE ones) therefore I need to intercept all queries and then filter them maybe with some regexp and log them as needed. Where would I put such a thing in the rails code? ...
Are models available within the modules. Can I access constants stored in a model class within a model. I tried require 'modelfilename.rb' and tried to use the constants by Model::Constant_name but its unable to get the value. Since the constants are related to the model i store them with model and I access them within the module using ...
Is there a way to create mysql triggers using Activerecord migrations ? Has anybody worked on it share your experience . Thanks ...
The following works just fine: Then /^I should see a button called "([^\"]*)"$/ do |name| response.should have_selector("li") do |li| li.should have_selector("a") do |a| a.should contain(name) end end end Now I need to complement it with a step like this: Then /^I should not see a button called "([^\"]*)"$/ do |name...
how can i get controller name out of the object if i don't know what is the object? i am trying to do object.class.tableize but rails says undefined method `tableize' for #<Class:0xb6f8ee20> i tried adding demodulize with same result thanks ...
I've seen the question asked a few times on the Google groups but no one seems to follow-up with an answer or solution.. Is it possible to use a central database for User creation and authentication from multiple Rails applications using Authlogic? It isn't an option for me to use OpenID right now, I'd love to but my client does not su...
I have an application that uses the Google Maps API to geocode distances between lat/long pairs as a way of displaying people near to you on your phone (currently Android, working on iPhone). The issue is that even with a test group of 40 users, we are taking upwards of 10 seconds to do our calculations and send the results back to the u...
I am trying to return more informative failure messages from an expectation. I have a helper method that iterates a hash, testing for mass assignment protection on a model. If the expectation fails I would like to output which attribute failed. I have come across failure_message_for_should, but I am not sure how to properly use it. Tha...
I'm thinking about building a login system for Ruby on Rails, much like this one http://visionmasterdesigns.com/tutorial-create-a-login-system-in-ruby-on-rails/ In terms of security, should I limit the attempts a user can have to login if they get their username wrong? Also,The basic steps of logins seem to be: authenticating userna...
I have installed rails using rubystack and set env path, so I can use it in cmd. When I try to use it with cygwin I doesn't work (it shouldn't), how to make this rails work on both windows and cygwin env or I have to install it separately. Thanks ...
Hi guys, I have to debug some error that is db related and have been continuously monitoring the log when there is an error caused by db. Since the error is already logged, I want to have exceptions like: ActiveRecord::StatementInvalid to be suppressed so that user won't see the 'something went wrong page'. The error is limited to a s...
This is probably a silly question, but is there a way I can pull out the root bucket name out of the YML s3 file I have? Other tutorials I've seen just assume that the buckets are named development/test-(whatever). I just want to pull exactly what is in the amazon 3s yml out of there, or else I'll have to hard code it... I've tried like...
I'm implementing a Blog with Post and votable Comments. When loading a Post, I want to eagerly load all votes by the current user for the Post's Comments. Something like this (which doesn't work): @post.comments.all(:joins => :votes, :conditions => ['votes.user_id = ?', current_user.id]) Each Comment has a method called rated_by? d...
Capistrano and Git worked properly till I moved my site to another server. My first attempt to deploy went wrong because of an SSH-known-hosts related problem. Even if I managed to solve this problem, another one raised and I can't deploy any more: * executing `deploy' * executing `deploy:update' ** transaction: start * executi...
AS it reads I would like to use the same model connecting to different databases, something like this: require 'rubygems' require 'active_record' require "active_resource" dbs = [ 'db_one' ] $config = YAML.load_file(File.join(File.dirname(__FILE__), 'database.yml')) #Tables we use from 3db class My3DB < ActiveRecord::Base self.abstr...
Hello people, this question is certainly newbie-generated. When I installed Apache and Passenger to work I received 3 lines of code to add to the apache2.conf file on etc/apache2 path, but because of an authorization reason I couldn't add those lines to the file. I want to know, how can I retrieve these lines? P.S. Passenger Gem Version...
I'm new to rails. I need to validate the uniqueness of two fields in an object (row) before I add them. Employee_id and area_id are the two fields in my emp_area table. There can be multiple records with the same employee_id and multiple records with the same area_id, but no two records can have the same employee_id and the same area_...
I have badges (sorta like StackOverflow). Some of them can be attached to badgeable things (e.g. a badge for >X comments on a post is attached to the post). Almost all come in multiple levels (e.g. >20, >100, >200), and you can only have one level per badgeable x badge type (= badgeset_id). To make it easier to enforce the one-level-p...