ruby-on-rails

How can I fill a page in Div in RoR?

I have a div called "main", and I have two hyper link, one is called "Google", another is "Yahoo!" , I want the user click the "Google", and the google.com will fill in the main div within refresh, same as "Yahoo!". what should I do in RoR? ...

Rails Associations - Callback Sequence/Magic

Taking following association declaration as an example: class Post has_many :comments end Just by declaring the has_many :comments, ActiveRecord adds several methods of which I am particularly interested in comments which returns array of comments. I browsed through the code and following seems to be the callback sequence: def has_m...

Auto_complete_for question

Hi, I've recently installed this plugin, and I meant to create a Tag field with it, like StackOverFlow does. When I put the following syntax on my AnnouncementsController(I want to tag announcements) it works great: auto_complete_for :announcement, :title protect_from_forgery :only => [:create, :delete, :update] Also, I had to a...

nested models, validations, and deletions

After struggling with this for hours, I think I've finally developed a solution to the following problem. I have the code here: http://pastie.org/767503 . What I am doing is allowing for classic http modification of a logic expression like (OR (AND ItemsFromCollectionPredicate) (AND TruePredicate)) which is the params hash below "co...

ActsAsSolr::SearchResults

hi all, In my ROR application using acts_as_solr plugin as a search engine which runs on top of Lucene library. now, i am able to search the results as below in controller def search @user_class=User.find_by_solr("rajesh") respond_to do |format| format.html # search.html.erb format.xml { render :xml => ...

Android: How to edit specific record from database in Android Programming (Using Ruby on rails)

At first,I have a database created by using Ruby on rails. I just already implement insert function(HTTPPost) in my Android Application and it's work. But I don't know how to retrieve specific record from my databases and insert it back to specific record in Android (Like edit function in RoR) This is my insert code : private void inse...

Rails - iterate over db entries in one field, separated by linebreaks

Hi everyone, In my application I have a products model which has among other things four fields for image paths. I use this to build a slide show. However, I would love to have all those paths in one big text field and seperate them by whatever works (linebreak would be the easiest to handle in the form). I was thinking something li...

How best for a Windows boy to start with *nix web development?

I have been a Windows/M$ boy now for over 15 years and specialisted in web design for 10 years of that using Classic ASP and ASP.net. Trouble is all the latest funky languages that I want to play with (Django using Python, Rails, NitroJS) are *nix based and often run off Macs and all use Apache not a sniff of a IIS port/version. I've pl...

What are the most useful TextMate bundles or plugins for Rails development.

I'm compiling a list of the most useful bundles and plugins for TextMate which are helpful for using while developing with Rails. I have two which I use religiously: Project Plus Zen Coding ...

does rails postgres adapter support ssl?

i'm trying to configure a rails app to remotely connect to a postgres db. i've noticed that the connection adapters for mysql have options that specify the required info for setting up an ssl connection, but there is no equivalent options for the postgres/pg adapter. after googling around, i haven't been able to find anything either (on...

Shoulda: Test validates_presence_of :on => :update

I'm using Shoulda in combination with Test::Unit on one of the projects I work on. The issue I'm running into is that I recently changed this: class MyModel < ActiveRecord::Base validates_presence_of :attribute_one, :attribute_two end to this: class MyModel < ActiveRecord::Base validates_presence_of :attribute_one validates_pr...

Rails rake test returns an error message

I am a rails newbie and receive the following message when I run rake test. This is a an application based on rails community engine. I tried creating a test application just to make sure that my gems etc. are fine and I am able to run rake test successfully in that application. It would be great if someone could shed a light on what i...

Starting with Ruby 1.9.x, Rails 3, and/or Merb

I need to spend some serious time reading about changes in Ruby 1.9.1 and upcoming Rails 3/Merb. Can people suggest any articles to read? Not really looking for one answer, just kinda looking for a compilation of resources people are using to keep up with what's coming and what currently exists, so if you stop by, let me know what you'r...

RAILS - Dont understand password reset code

Im having problems understanding the app logic to this password reset code i found below on the web. A user receives a an email with a link with some reset code. After clicking on this they go to the action below called reset The user is found in the db by referencing the reset code. The form to change password is shown and the user e...

Updated checkbox, when there is no data passed. ROR. What is going on?

I constructed a Many-to-Many association between Users and Roles. When a non-administrator logs in, I have hidden the Edit Role function, using using the following code: view/users/edit.html.erb <%= error_messages_for :user %> <% form_for @user do |f| -%> <p><label for="login">Login</label><br/> <%= f.text_field :login %></p> ...

Who else out there is using the Facebooker plugin for Rails?

I've been working with the plugin for a couple weeks. Any other SOers using it, and if so, is there any knowledge or wisdom you've gleaned from using the plugin/gem? ...

Authlogic:facebook connect - error undefined local variable or method

Hi, I'm trying to integrate facebook connect to authlogic which is working fine with OAuth twitter. I get this error right after putting the button to the login form. undefined local variable or method `authlogic_facebook_login_button' Does anyone here know what the issue is? I already restarted the server after installing the plugin...

How can I guess action name from url in Rails?

For example I have a url generated by something_path or something_url methods. I need to know action name from that url. ...

Extending a ruby gem in Rails

Let's say I have a Rails app that gets most of it's functionality from a gem (for instance, a CMS). If I now need to add some customisation (for instance, add a property to a user) what is the best practice way of doing this? If I customise the gem, then I will have issues with updating the gem in the future. What is the best approach...

Updating an unpacked and customised gem

We have an interesting scenario I need to sort out: 1) We have an existing application running with an unpacked gem 2) The application has some customisations to the unpacked gem 3) I would like to somehow "merge" a new version of said gem into this unpacked gem to bring it up to date. Any ideas on a nice way of doing this? All the c...