The goal: running a Rails application on Mongrels, allowing access through Apache after doing basic HTTP Authentication
The problem: reading the supplied username from within Rails
Apache:
<Proxy balancer://mongrel_cluster>
BalancerMember http://127.0.0.1:4001
# ...
Order deny,allow
Deny from all
AuthType Basic
AuthName "<real...
I'm using Authlogic for authentication in my app, using the standard User and UserSession models. I'm building an API into my app, and I want to authenticate API access with a single access token. In my app, every User belongs_to a Company, which has_many users. The API is for access to resources belonging to the company, so I'd like ...
Hi. I just installed HTML Tidy plugin for eclipse. I added the html.erb file type and now it will do its magic on my erb files. However it puts in the title tag and changes a lot of my characters to escape characters. How can I stop this from happening - or is there a ruby alternative which will go through my code, reindent, and stick in...
Hi all,
I have an app that models a House. The House has_many Rooms, Rooms has_many Lights and Small_appliances, etc. I also have a controller called Calculator that is how the app is accessed. Data is added to the house (and its rooms) using the Calculator controller. Then a report is generated, which is located at app/views/calculator...
We are developing a functionality that allows the users to save the downloaded file. We are struggling to get a popup where the user can select a target location / folder to save his file. Can this be achieved using rails?
...
Is there a way to download videos from Drop IO using Drop IO commands / Rails or Net::SFTP?
...
Account < AR
has_many :deposits
accepts_nested_attributes_for :deposits
attr_accessible :max_amount
end
Deposit < AR
belongs_to :account
attr_accessible :amount
validate :validates_amount_less_than_max_amount
def validates_amount_less_than_max_amount
# How do you write this method? When an Account is being created w...
I know I can use something like User.sort {|a, b| a.attribute <=> b.attribute} or User.find and order, but is it a way like comparable interface in Java, so every time I called sort on User object it will do sort on the predefined attributes.
Thanks,
...
I hope someone has already experienced this.
Please help me, how can i solve this problem:
class Article < ActiveRecord::Base
belongs_to :author
belongs_to :publisher
has_one :address, :through => :publisher
end
class Author < ActiveRecord::Base
has_many :articles
has_many :addresses, :through => :articles, :source => :addres...
Hi there
I make a call just like this:
value = ./simulated_annealing
Which is a C Object file, but Rails tells me it cannot find that file. I
put it in the same dir that the rest of the models files (since it's
called by one of those models), but I guess it should be in any other
place.
I've tried that outside Ruby and it works great...
Hi,
I have the following scenario that I want to model the best way for a Rails application.
I have a contact model that belongs to a company. A contact can create an enquiry so contact can have many enquiries. The enquiry can have many messages that can be from and to many contacts. Messages can belong to an enquiry, a company or a...
I am using restful authentication and role requirements plugins. Role requirement plugin created 2 tables roles and roles_users but it didn't create models and controllers for these tables. Should i create them myself or is there something that i am missing? What is the best approach to add and delete roles ? Thanks.
...
How to do that with ActiveRecord? My code:
p = Product.create
l = Label.create
p.labels.add << l
But I get l.parent == nil
create_table "labels", :force => true do |t|
t.integer "product_id"
end
...
I had read through a rails book and once found we can add # TODO: and some # stuff in codes, so we can you some rake cmd to look back.
My problems is I can't find where are those "# stuff" and "rake cmd" I google and search around, but can't find and don't know what keywords to search.
Thanks,
...
I currently have one model, one controller with one action to list all the items in the model.
What I need to do is display different data from the model in two separate views. Is there a way I can use one controller action to display different views based on params, or should I create another action?
The reason why I hesitate to crea...
I have a rails app that just launched and I have over a thousand users signed up to the site. We are interested in keeping in contact with the community through email newsletters. We have been using a third party tool and migrating the email addresses from one database to another. Is there an easier way to do this from rails? I am open t...
Hi,
I've really hit a wall and am need of some help! Thankyou for reading this far!
I'm in the middle of writing an app that talks to my ROR web-server for database requests and works great thanks to ActiveResource. But I now need to also upload files to the server, and I plan to use ASIHTTPRequest which looks great, my problem thoug...
Trying to do a select field for an admin interface.
What I have is not a traditional many-to-many relationship, but I imagine the principles are the same. I have an "Event" model and an "EventRelation" model...every Event can have many sub-events, and one primary event...so EventRelation has primary_event_id and sub_event_id fields.
Ho...
In a recent discussion on ORMs for webapps someone mentioned that there are times you don't want to have IdentityMaps for webapps. I don't understand this, because it seems as though in the context of a singular request to the app, you would want all work on records to be consistent. This means if I "look" at an object A which references...
So I have a method in a reservation model called add_equip. This method does some checking to make sure the added piece of equipment is valid (not conflicting with another reservation).
The checks work. If a added piece of equipment shouldn't be added it isn't, and if it should it is.
The problem is I can't figure out how to send...