ruby-on-rails

Rails Spree demands account creation after bootstrapping without sample data

I'm using the Spree Rails gem for my ecommerce site. During development I've been using the sample data. After re-bootstrapping the database using "rake db:bootstrap" and this time NOT loading sample data, any time I go to any page on my site, it redirects me to /users/new. I have removed all my custom route rules. Any ideas why this i...

Rails/facebox_render - Ajax is not defined (facebox's always loading...)

Hi, I tried to make a simple test with facebox_render and rails 3. Here are my steps: 1.) Installed Jquery 1.4.2 (Jrails) 2.) Installed the plugin rails plugin install git://github.com/ihower/facebox_render.git 3.) and added the following lines: in my application.html.erb <head> <title><%= yield(:title) || "Untitled" %></title>...

Rails 3 global render

Is there a way to tell an entire controller to render a particular partial or text? Example: class PageNotesController < ApplicationController render :text => "Testing" def index @notes = PageNotes.all end def show @note = PageNotes.find(params[:id]) end def create @note = PageNotes.create(params[:note]) end...

Ruby on rails form_for and uncountable models

<% form_for(@software) do |f| %> is producing a form tag that looks like this: <form action="/software.%23%3Csoftware:0x24b2eac%3E" ... The software model is a bit special, in that I've made it uncountable (softwares didn't sit well with me) environment.rb: ActiveSupport::Inflector.inflections do |inflect| inflect.uncountable %w...

Rails after_filter get javascript and stylesheet values

Is it possible in rails using a filter that appears, after the view (after_filter), to collect the data that has appeared inside of the javascript_include_tag and stylesheet_link_tag methods? for example: ---rails view starts javascript_include_tag 'file.js' ---rails view is complete and after_filter runs @js_files = get_included_java...

Rails 3. Using ajax on a rendered partial. Please help!

Hello! I am using Rails 3 to load a partial (form) into another page with the code below. The problem is that I want to use :remote => true on the form and use ajax upon it (validation) etc. $("#form_open").bind("ajax:complete", function(et, e){ $("#form_area").html(e.responseText); $("#form_open").html("Add contact informatio...

rspec validates_presence_of polymorphic attributes ruby on rails

I am writing an rspec for an address model that has a polymorphic attribute called :addressable. I am using factory girl for testing. This model has no controller because I do not wish to create a standalone address but that doesnt stop the rspec from creating a standalone address. My model, factory and rspec are class Address < Act...

Testing Applications built on top of RESTful web services

Lets say; I am developing a Web Application which talks to a RESTful web service for certain things. The RESTful web service isn't third party, but is being developed parallely with main application (A good example would be, E commerce application and payment processor; or Social network and SSO system). In such a system, acceptance(c...

Postinstall, rvm(ruby version manager) without root access.

I am trying to use rvm(ruby version manager) and after the source installation, I need to add rvm command into my profile. I added following code to the $HOME/.profile file but it does not seem to work. [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session. So I just manually typed bel...

rails i18n help please

hi all i have added internationalization to my site via domainname.com/en/etc I have done this by adding to map.with_options(:path_prefix => ":locale") do |m| to wrap around all my resources in routes file. I have added this to application_controller before_filter :set_locale def set_locale # if params[:locale] is nil then I18...

Problem including installed gems

I'm having issues requiring gems in my rails application, I have tried multiple gems, and I made sure they were installed by issuing "gem list --local", they're there .. they just can't be found, I keep getting this error "Could not find RubyGem twitter4r (= 0.2.0)" for twitter4r gem and a similar one for other ones. I feel that I shoul...

Retrieving data from API and display it.

I have a link which is returning data in xml. I don't know how may i fetch data from api and display it. I want to fetch data from provided link like http://api.testdata.co.in/a/pn-1?koid=1234&amp;dfr=12.14.127.10 . Any help ? ...

Rails: Adding methods to models to perform checks based on current_user?

I have a model that looks something like this: class Comment < ActiveRecord::Base ... #allow editing comment if it is moderated and the user passed-in #is the one that owns the comment def can_edit?(user) moderated? and user.Type == User and user.id == self.user_id end ... end And a call in a view: <%= link_to 'Show C...

500's, timeouts, and redirect loops with Radiant (a RoR CMS)

I'm struggling to get a simple CMS website up and running but can't get past the installation stage. I've been working on this off and on over 4 days and am getting burnt out and demotivated on the project. To summerise my pains: I keep getting Redirect loops and FCGI timeouts no matter what I do. Unfortunatly I've never touched Ruby, R...

Rails 3 - w jQuery - Global Loading Event?

Hello, is there a Rails 3 jQuery global loading event? I'd like to display a LOADING banner anytime jQuery is AJAX loading... and remove it when it's done... Ideas? Thanks ...

schedule_fu locks mysql up

I've been using schedule_fu for recurring events but I keep getting this Mysql::Error: Lock wait timeout excedded. Anyone else experienced this problem or do you know what causes a Mysql::Error like this. I'm using Rails 2 and developing on OS X. SQL (0.1ms) BEGIN SQL (0.1ms) SAVEPOINT active_record_1 CalendarDate Create (0.0ms)...

prevent page caching with Rails and Passenger in Development Environment

I am running Rails 3 and Passenger 2 and I don't know why but my page is still cached despite having this configuration (in one of my virtual hosts): <VirtualHost *:80> ServerName railstut.dev ServerAlias *.railstut.dev DocumentRoot "/home/ygamretuta/dev/railstut/public/" RailsEnv "development" <Directory "/home/yga...

Ruby On Rails 3 submit form AJAX update results in div

I am stuck; I did a search and I can't find a pointer on how to get this project to work. I have a form on my index.html.erb as: <html> <head> <title>Ajax List Demo</title> <h1>Listing posts</h1> <%= javascript_include_tag "prototype" %> </head> <body> <h3>Add to list using Ajax</h3> <% form_tag ( :remote=>tru...

How to install mysql on a new machine for an old app ?

Not exactly sure how to go about this. My app's database.yml development: adapter: mysql encoding: utf8 reconnect: false database: application-dev pool: 5 username: root password: angles123 socket: /tmp/mysql.sock I was thinking that it would be wise to go ahead and mysqladmin -u root --password=angles123, and then on...

Rails 2: Ajax & Table Display Filtering based on Selected Option

My scenario (running Rails 2.3.5): On a department's products page (index.js.rjs), there is a table showing the products with their id, name, category. The view of this table is specified by a partial file called _index.html.erb. I'm going to add in a selection/option drop down menu above the table to show all the product categories. ...