ruby-on-rails

Is Ruby on Rails dying?

I am interested in learning Ruby/RoR, but it seems to have lost the popularity it had a few short years ago, and from what I've read, few webhosts support it. Is it on its way out? ...

Self-Referential Association has a routing error..

I am following Ryan Bate's tutorial: http://railscasts.com/episodes/163-self-referential-association But my setup is slightly different. I am making comments that are self-referential so that comments can be commented on. The form displays in the view, but when I submit, I get this : Routing Error No route matches "/conversations" ...

Posting xml to a rest api in rails

Hi I need to post some xml info to a restful api can anyone give me a clue of how to do this? I'm using rails. Thanks in advance ...

Inheriting and routing a custom action from ApplicationController in Rails

Hi all, I am using Rails 2.3.2 but I'm sure this applies to newer versions as well. I would like to define a custom action in ApplicationController. However, I don't want to add a custom route to every single controller subclass which uses this action. Is there an easy way to do this? My first inclination was to just route directly to...

How can I use devise's "warden" to authenticate a rack app in the same stack as the rails app that uses devise ?

By the way, I'm using rails 3. How can I use devise's "warden" to authenticate a rack app in the same stack as the rails app that uses devise ? My problem is that when I call this: request.env['warden'] # nil :( from the other application on the rack stack I get nil ! I integrated dav4rack (webdav) in my rails app via config.ru. I ...

Creating a 'configuration settings' object, persisted to the db, that you can create properties for

Since Rails is using Ruby (dynamic language), would it be possible to create a very flexible 'configuration' class that has properties that you use throughout the website, AND have the ability to add new class properties (in the db for web modification) and then just use it in the code. Each property would be of a specific type like a ...

Right way to force uniqueness on a join model? (has_many :through)

I have a parent/child relationship via our users table, with models as such: class User < ActiveRecord::Base # Parents relationship has_many :children_parents, :class_name => "ParentsChild", :foreign_key => "child_id", :dependent => :destroy has_many :parents, :through => :children_parents # Children relatiopnship has_many :...

Show the latest commit value within a web application?

Hi Everyone, I have a few Rails applications and I use Git as the version control system. I use either GitHub or Beanstalk as the repository hosts. What I am trying to is quite simple in theory. Somehow show the latest commit ID number (hash?) in the footer of the web application. So that when I am looking at the web application I can...

Rails: using validation for user register/login

I have a simple User class with the following validation of name uniqueness: class User < ActiveRecord::Base validates :name, :uniqueness => true, It works great when a new user is created. However, when I check the login form, the user enters his name, and the system says it's already taken which doesn't make any sense. So I impl...

Django or Ruby on Rails - user extensions, plugins

Which framework has the most mature, flexible, intergrated, centralized and easy-to-use plugins/extension system. My main requirements are: a centralized system/repository where i could find a extension i need no need to make changes in the source code, the plugin should be easily enabled and disabled large plugin/extension database ...

Why are all strings ASCII-8BIT after I upgraded to Rails 3?

I upgraded to RoR 3.0.1 and Ruby to 1.9.2. Now all the strings in my views are ASCII-8BIT? I believe I have my app set up to use UTF 8 application.rb config.encoding = "utf-8" database.yml development: adapter: mysql encoding: utf8 I'm running OS X RVM rvm 1.0.16 Ruby ruby-1.9.2-p0 Rails 3.0.1 I'd expect that the enodin...

How to get netmask?

I know how to get from ifconfig. (linux) But is there another way? Can found it in socket. ...

Error installing gems

I am getting an error when installing certain gems. I am using ubuntu 10.10. The error messages shows this. ERROR: While executing gem ... (NoMethodError) undefined method `spec' for nil:NilClass ...

rake aborted! Permission denied - rsa_key

Trying to run db:migrate keep getting rake aborted == CreateLocalKeys: migrating ================================================ rake aborted! An error has occurred, all later migrations canceled: Permission denied - rsa_key I can't find anything about this any help is appreciated Thanks ...

passenger 3 standalone rvm rails

I have a rails app I am trying to run under passenger 3 standalone: passenger start -a 127.0.0.1 -p 3001 -d Ive installed this with rvm cd myapp rvm use 1.9.2 gem install passenger --pre I want to set environment variables for my app but can't figure out how and where to set them. I just need to source my .profile which has all m...

Rails: Updating two fields of an ActiveRecord instance simultaniously

I have a model, called Book, that has the fields title and filename (and other fields but they are unrelated). I'd like that the filename field was automatically created using the title, thus in my Book.rb: class Book < ActiveRecord::Base # ... def title=(title) self.filename = sanitize_filename(title) self.title = title ...

Finding a node with no children in a tree like structure with Rails

Hi, I have a tree like structure roughly like this: class Node < ActiveRecord::Base belongs_to :parent, :class_name => self.to_s, :foreign_key => 'parent_id' has_many :children, :class_name => self.to_s, :foreign_key => 'parent_id', :dependent => :destroy ... end I can load all nodes that don't have a parent with this sco...

How do I restart phusion passenger?

rails@george:/srv/fsg_distro$ sudo passenger-status *** Phusion Passenger: no passenger_native_support.so found for the current Ruby interpreter. Compiling one... # mkdir -p /usr/lib/ruby/gems/1.8/gems/passenger-3.0.0/ext/ruby/ruby-1.8.7-x86_64-linux # cd /usr/lib/ruby/gems/1.8/gems/passenger-3.0.0/ext/ruby/ruby-1.8.7-x86_64-linux # /usr...

nested routing in rails

Desired url, a geo example: domain.com/france/ # Would show all things to do in France domain.com/france/ile-de-france/ # Would show all things to do in Ile-de-France domain.com/france/ile-de-france/paris # Would show all things to do in paris This geographical url writing is quite easy of course with rails routing. Problem is that it...

soap connection problem with rails

hello I have two scripts, one is in http://txtcnsl.com/netTxt/soaptest and works fine, but when I try to move to another server fails http://voiplatinoamerica.com/siteweb/adminpanel/login the code is the two scripts client = Savon::Client.new "https://pbs1.sipids.com/wsdl/SessionAdminService.wsdl" , :end_point => "https://pbs1.sipids...