From my understanding, Python's twisted framework provides a higher-level abstraction for networking communications (?).
I am looking for a Ruby equivalent of twisted to use in a Rails application.
...
I'd got a model in which attributes are allowed to be null, but when a null attribute is read I'd like to take a special action. In particular, I'd like to throw a certain exception. That is, something like
class MyModel < ActiveRecord::Base
def anAttr
read_attribute(:anAttr) or raise MyException(:anAttr)
end
end
that's all fi...
Hello,
Given the associations defined below, I'm hoping someone can shed some light on why I can't
access all the Classifieds, that belong to a Category, that in turn belongs to a Section.
I'm guessing it has something to do with the fact that there's a polymorphic relationship
in there, but I'd like to know if there is a proper way to...
A long time ago I ran into a website (I unfortunately lost the address, it was some kind of newspaper site) that allowed you to make use of everything as if you were a registered user. You could rate, favorite and comment articles, and when you did it would display a discreet, embedded message saying you had to register to the website fo...
I am wondering how I can target a specific commit SHA in Git for deployment, using Capistrano? It should be something like
cap deploy --version=<sha targeted>
Can't seem to find the answer to this after a lot of searching.
...
I'm working on a Rails app that existing users can invite additional members to join. The problem with this is that the User model exists in different states and in those different states, different sets of information is required.
For example, John is a member of the site and invites Mary. John enters Mary's name and email address, a...
What's a good solution to parse an RSS/ATOM feed and present the content in a Rails view?
...
I have a typical User model (username, password, name, etc). I want to allow users to attach three chosen categories to their account. Each of the three categories exist in the Category model.
How can I link three foreign keys from Category to a single User without using an intermediate table for tracking? Each Category can belong to an...
I just move my experience on C# into Ruby. Ruby is very interesting programming language, I really like it. I do know Rails is a web application framework that are used by lots of web developers and uses Ruby language. What else of applications should we build on ruby?
...
Hi,
I'm trying to configure SSL on EC2onrails with no luck. At present I am unable to even telnet into my server at port 443, it simply says "trying MY.IP.ADDRESS..." and stays there indefinitely. Telnet into 80 works fine.
This was my starting point: groups.google.com/group/ec2-on-rails-discuss/browse_thread/thread/79b60bf683b2365b (a...
In my application, Users can start and participate in Discussions. They can also Tag Discussions; when they do so, a Tag is created containing the name of the tag (if it didn't already exist), and a Tagging, which remembers which User tagged which Discussion with what Tag, is created too.
So inside the Discussion model we have this:
h...
Projects have many tasks and a task has a custom RESTful action called 'approve'.
I'm expecting the helper to look something like this approve_project_task_url
This isn't working for me:
map.resources :projects,
:has_many => :tasks,
:member => { :approve => :post }
...
I have a rails helper in my application_helper.rb file that looks like this:
def external_link(name)
url = external_links[name]
if url.blank?
Rails.logger.error "No URL defined for external link [#{name}]!"
return "[URL undefined]"
end
return url
end
The 'external_links' variable is a hash that should b...
If Parent has_many :children, must Child :belongs_to :parent?
...
Hello,
Whenever I use:
redirect_to :back
in my Rails controllers, I get the following error:
undefined method `object_url' for SubmissionController:0xb7a37764
I'll paste the application trace below as well:
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/polymorphic_routes.rb:112:in
__send__'
/usr/li...
If you have
Parent
has_many :children
Child
Is there any reason a foreign key on Child (to Parent) and a corresponding belongs_to :parent might not be desirable?
When, if ever, would you not want your Child to be able to access its parent?
...
Why can you not have a foreign key in a polymorphic association, such as the one represented below as a Rails model?
class Comment < ActiveRecord::Base
belongs_to :commentable, :polymorphic => true
end
class Article < ActiveRecord::Base
has_many :comments, :as => :commentable
end
class Photo < ActiveRecord::Base
has_many :commen...
I'm trying to display unique counties listed in my database in select box for a property database. I've figured out how to do this, but now I can't figure out how to access the selected value of the select. This mainly has do with the way the HTML select name is outputted.
My form code, county is an attribute for my property model:
...
I'm trying to test to see if an input field matches one of my factories where the field is empty.
address => {:first_name => '', :last_name => ''}
When checking for what is in the input field I've been using this:
assert_select '#first_name[value=?]', address.first_name
Except this does not work if the first name is blank. I'll get...
I have a before_save filter on my model class which sets a date field to a future date to guarantee the integrity of the data.
This works really well except with it comes to unit testing. I'd like to set up a test scenario which involves setting this date field to a date in the past. I can't do this using ActiveRecord because the befo...