Hi,
I use ruby to get a report by calling a soap based web service method. By calling such a method (soap_driver.method_foo(params)) I am getting a ruby object of this type SOAP::Mapping::Object.
I inspect the object and get a bunch of QNames, which I try using it to get the info out of the object.
Considering the soapResponse is the ...
Hello,
I'm new to programming and to Ruby on Rails,
and I'm trying to implement an address book on rails with active search with ajax.
Active search is working fine with English letters, but when I'm trying to search Greek entries I don't get any result.
I wrote a code showing what is searching so I noticed that if I put a Greek letter...
Hi,
I'd like to have a more dynamic way of working with filter chains in Ruby on Rails 2.3.2.
At the moment, the filter chain is built as the classes are loaded. I have a very particular need for the filter chain to be rebuilt at some point in time after the classes have loaded.
This is to do with a Rails project (Spree, Radiant may ...
Hi all
I am wanting to create an application that can allow users to add products for sale.
I want to make it so that a user can add whatever type of product he/she likes and let them also create stored and searchable attributes for their products - alot like google base does.
Does anyone know of the best way to do this ie model it.
...
What is the best way to implement a StackOverflow-style Recent Activities page?
I have a Gallery with user's photos and I want them to be notified when other users comment or vote their photos.
Should I create a new table which contains recent activities (updated whenever a user posts a comment or votes) or should I simply use a MySQL ...
So I've decided after a few years away, that I want to get back into Ruby on Rails for some of my personal projects. What I'm wondering is what are the best resources to find out what the new features are in rails? I haven't really even touched Rails since 1.2 was new.
Oh yeah, and is TextMate still the defacto editor for RoR on the Mac...
I'm noob with Rails.
I would like to create a Rails powered website which can install automatically a Rails application (Redmine) when a user creates an account (create the application, setup user's preferences, configure the database, etc.) Each Rails application will use its own subdomain.
Any idea how to do that?
...
Following code works just fine.
class ApplicationController < ActionController::Base
rescue_from ActiveRecord::RecordNotFound, :with => :bad_record
def bad_record
redirect_to root_url
end
end
However I wanted to refactor the code and put this functionality in a lib since my application controller has grown large.
This is what I c...
Say I'm writing a blog app with models for posts, pages and photos. I've got a category model, that may be linked to any of these models. So, a category may contain various kinds of items. Every item only has ONE category.
I could implement this using a generic tagging pattern with a join table, but I want to make sure every subject can...
The situation is simple. In Rails 2.3.3, I've got a "Staff" namespace, and controllers in there inherit from the StaffController. That StaffController itself handles the Staff namespace's root:
map.namespace :staff do |staff|
staff.root :controller=>'staff',
:action=>'index'
# ...
end
In development mode, that works...
How can I sort an array returned by an activerecord query by a 'created_at' date column? Keep in mind, this is once the query has been executed. Don't tell me to do it in the query because I need this to happen in the view.
Thanks
...
It seems to me that it is possible to break ruby on rails such that neither scaffolding works anymore nor database migration when particular model names are used.
In particular I noticed this when using "Dispatcher" for a model to be created via scaffold. If I created the same object with a different name everything works fine.
Has any...
One of our requirements was that all our url's ended with .html
We've overridden the default_url_options method to add the format to the options
def default_url_options(options={})
options.merge(:format => 'html')
end
This works great in the most part...
but it causes issue with the following routes:
map.home '/', :controller => 'h...
If a train leaves less than an hour from now, I want its row in the schedule table to be highlighted red. Currently I'm doing the calculation like this:
if Time.zone.now + 1.hour > t[from_station]
# do whatever
end
This works and kind of makes sense, but I wonder if there's a clearer / more idiomatic way to express this (I could ima...
I currently have this kind of setup:
:procedures, has_many => :steps
Steps are tied to the procedures that they were created under. Currently my method destroy for Procedures is just this:
def destroy
@procedure.destroy
end
Is it necessary to go find all the steps associated with this procedure and invoke their destroy methods,...
I'm still debating whether I want to do this or not but what I'm considering is preventing users from entering hyperlinks into a HTML form in my app. This is to avoid spammy links from showing up for other uses of the app since the app is based on user generated content.
This is a Rails app, so I could do some backend validations on the...
I'm currently evaluating options for adding sub-domain support to a new Ruby on Rails app and was wondering if there were any suggestions or experience that others could share.
Some possible Choices
SubDomain-Fu
http://github.com/mbleigh/subdomain-fu/tree/master
Rolling your own
http://www.robbyonrails.com/articles/2009/01/11/subdo...
Consider this:
class User < ActiveRecord::Base
# name, email, password
end
class Article < ActiveRecord::Base
# user_id, title, text
end
class Favorites < ActiveRecord::Base
# user_id, article_id
end
How do I put this all together in a way that I can have @user.articles (articles created by the user) and @user.favorite_article...
I am using the ruby twitter gem and oauth to gain access to users twitter accounts. In my code, I have:
unless @user.twitter_authd?
oauth = Twitter::OAuth.new('token', 'secret')
session[:twitter_request_token] = oauth.request_token.token
session[:twitter_request_secret] = oauth.request_token.secret
@twitter_auth...
I have a little one-liner in my Rails app that returns a range of copyright dates with an optional parameter, e.g.:
def copyright_dates(start_year = Date.today().year)
[start_year, Date.today().year].sort.uniq.join(" - ")
end
I'm moving the app over to Django, and while I love it, I miss a bit of the conciseness. The same method i...