ruby-on-rails

What is the inverse rake operation to rake gems:unpack?

I would like to unfreeze the gems which where previously rake gems:unpacked. What is the operation for this? So far I know only the method of rm -r vendor/gems. For rake rails:freeze:edge there is rake rails:unfreeze. Is there such inverse rake task for gems too? ...

Restriction Content and Attributes in XST: ComplexTypes

I am making an XML schema for an XML document* and I am getting stuck on something which seems like it should be relatively simple to do. Take the following XML snippet: <some_element value="Yes" type="boolean">1</some_element > In this case, I want to restrict the content of some_element to boolean values (xs:boolean) and I want to ...

I am getting this error on each machine after installing ruby and rails, I created one web site and started webricks server but the error is there on each machine

D:\PROJECTS\RubyOnRail\webapp\Welcome>ruby script\server => Booting WEBrick => Rails 2.3.4 application starting on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server [2010-01-31 21:19:34] INFO WEBrick 1.3.1 [2010-01-31 21:19:34] INFO ruby 1.8.6 (2007-09-24) [i386-mswin32] [2010-01-31 21:19:34] INFO WEBrick::HTT...

Make yml translations available in Javascript files

I'm using jQuery in my current Rails project and I'd like to have some way to use the translations from my yml files in Javascript. I know that I can easily use them in my .js.erb templates. But what about the javascript files in /public/javascript? It looks like Babilu (http://github.com/toretore/babilu) would do exactly what I want. ...

Generate URL in Grails

I need to pass a correct URL to a javascript function in one of my GSPs. I don't want to just hard code it just in case the mappings for that URL ever change. I know in Rails I would use the url_for method such as: <%= url_for :controller => 'something', :action => 'edit', :id => 3 %> How would I do this in Grails? I can't seem to ...

RoR: Saving rendered emails as HTML for linking in email.

Like it is in many newsletter services, I want to use Ruby on Rails to write a Newsletter. Now I want to provide a link in this email to view this newsletter in a browser, if the email is not shown correctly in Email Client. How can I do this? ...

app deployed to heroku not stable.

I have an app deployed on heroku which uses postgres. The app is not stable...works sometimes and sometimes gives the custom 500 page error. Code that it is giving error on: def login session[:user_id] = nil if request.post? if @user = User.authenticate(params[:user][:userid], params[:user][:password]) sessio...

accepts_nested_attributes_for and collection_select how to build the view?

Hi, I need some help. I have a model Journey which has many Users (drivers). I want to be able with help of accepts_nested_attributes_for to add and remove drivers from a journey. When I add a driver I want to show the user a <select> where she can select one of the users to be one of the drivers belonging to that particular journey. I ...

Implementing search in a Ruby on Rails 3 application?

I am writing my first Ruby on Rails application and need to implement a "search" feature. It will need to search the database (1 column per table in 3 different tables), and return the most relevant results in each of the 3 categories. Kind of like how you can do a search on Amazon.com that will return results from all the different depa...

Paperclip error

I am getting the following error when uploading an image on the admin panel of spree (RoR e-commerce platform): Paperclip::NotIdentifiedByImageMagickError in Admin/imagesController#create /tmp/stream.4724.0 is not recognized by the 'identify' command. Any ideas? Thanks. ...

Rails application on shared hosting?

Is there a way that I can deploy my locally made rails app on a shared host that has Ruby installed? ...

Can a Model constructor be empty in Rails?

I have a 'Cost' model in rails. Something like the following: class Cost < ActiveRecord::Base belongs_to :cost_type has_many :cost_distributions attr_accessor :epp def initialize() end However, in my tests, when I try to create new instance with the empty constructor cost = Cost.new I get an error: wrong...

rails-settings plugin - namespaces

Hi, I just installed the rails-settings plugin to help manage the configuration of my app. I can declare settings with namespaces like so: Settings['preferences.color'] = :blue Settings['preferences.size'] = :large Settings['license.key'] = 'ABC-DEF' However, according to the documentation, I should be able to return all the se...

Web apps that generate nice photo/video galleries by recursively searching directories

Hi, I am going to upload all of my photos to an Apache web server - they're all in folders & sub-folders. Filenames are not descriptive and I don't care about the meta data. I've worked with PHP Gallery before, but find the process of creating albums, etc. a little laborious. I just want to rsync my local photo folders with my web site...

Issue with mulitple Ruby-on-Rails projects

I created a Ruby-on-Rails project using NetBean 6.8, which operates as expected on port 3000. I created a second RoR project in the NetBeans IDE to experiment with some ideas; it operates on port 3010. Unfortunately, the webserver won't start. It returns the following: /Library/Ruby/Site/1.8/rubygems.rb:827:in `report_activate_error'...

Rails primary key and object id

I'm accessing a rails model with the typical primary key id. However, when I access it in a method, I get the following warning. Object#id will be deprecated; use Object#object_id It seems it's getting confused between object id, and the primary key for the model. is there a way to make sure its using the field id? ...

Objects Being Attached to their Creator Question

I am working on a rails application where one user class named (submitters) are able to login and once they are logged in they create videos. My videos controller is here: class VideosController < ApplicationController def index @videos = Video.find :all end def new @submitter = current_submitter @video = @submitter....

Force validation of blank passwords in Authlogic

I'm adding a password reset feature to my Rails application that uses Authlogic. I was following the guide here: http://www.binarylogic.com/2008/11/16/tutorial-reset-passwords-with-authlogic/ and everything works as I'd like except for one thing: the password reset form accepts blank passwords and simply doesn't change them. I've been s...

HABTM Relationships and the Join Table

I'm trying to connect the values of two join tables that I have and show the results based on a conditional relationship...and i'm having some problems I have a Users Model(:name, :password, :email), and Events model(:name, :etc) and Interests model (:name) I created about 5 records in each model. Then I created two join tables -> Use...

Ruby Hash & Array to xml

I'm using ActiveSupport's to_xml to generate some xml from a hash. I have need for the this ruby: :Shipment => { :Packages => [ {:weight => '5', :type => 'box'}, {:weight => '3', :type => 'tube'} ] } To generate this xml: <Shipment> <Package> <weight>5</weight> <type>box</type> </Package> <Package> <wei...