Hi All,
In my application controller, I have a method that is supposed to check for the existence of another method in a subclassed controller to set the filename of a downloaded file, but i'm having trouble making it work properly
i've tried
def filename
begin
send "filename_method"
rescue NoMethodError
default_filename
...
I am using Single-Table Inheritance (STI) on one of my models for a Rails App and I am having problems storing model objects on a constant. I have isolated the problem into a sample project and submitted it to GitHub: http://github.com/fcoury/rails-sti-caching
What I am trying to do is loading a model instance (in this case a Music mode...
I've created an iFrame component for people to integrate into their websites. The iFrame needs to be passed a GET variable from the URL string when the page is loaded on the remote site. In this case, the parent page would be called as http://www.theirsite.com/tracking=12345 and the tracking variable should be written into the html cod...
Ruby on Rails has a bunch of plugins which extend the normal scaffolding:
Lipsiadmin
Hobo
Streamlined
ActiveScaffold
Does the PHP community have anything similar? phpmyadmin is great, but it doesn't have any way to control the presentation of the data. You always get all of the data in its presentation format. These Rails framewor...
Part of a real estate application I'm writing will allow a user to subscribe to a location and if a new property becomes available in that location then the user will receive an email notifying them of this.
I plan on runnning a background process once every few hours to handle the matching.
Right now I have a model called location an...
Hi All,
I have a method in a rails helper file like this
def table_for(collection, *args)
options = args.extract_options!
...
end
and i want to be able to call this method like this
args = [:name, :description, :start_date, :end_date]
table_for(@things, args)
so that I can dynamically pass in the arguments based on a form commit...
I'm running Tiger and (stupidly) decided to upgrade Rails from 1.1.6 to 1.2.6. I ran the command "sudo gem install rails --include-dependencies" and everything seemed to go OK. However, after the install, when I ran the command "rails -v", I got the errors shown below. Could it be that 1.2.6 is not compatible with Tiger? I've been se...
If there is no user with an id of 1 in the database, trying User.find(1) will raise an exception.
Why is this?
...
I'm writing a rails app that, by its nature, CANNOT require users to register, and thus cannot use authentication as the usual means to protect records. (I know, I know...) User information here is limited to email addresses. So I do need a way to make my model IDs unpredictable so that other IDs cannot be easily guessed. (I know, I kn...
I'm using Ruby on Rails to build a simple application to keep track of a shop's opening and closing times and its appointments, and I'm having some trouble validating the appointments against closings in the shop's schedule.
I've been using Runt to compose the schedule. For example, if the shop is open Monday morning from 9am-12pm clos...
What would be some advantages of using etags/stale?/fresh_when? instead of page caching (on a file cache)?
Apache automatically handles etags for static files, but even if it didn't, page caching would still be better since the Rails app doesn't even get called.
So, in what instances would I use the methods provided by Rails (stale?/fr...
Im using the Active_Search plugin to try and add some simple search features to my app, it works OK when their it is found somethind in the DB but if i simply run a search with no input then it gives me the error message "ActiveSearch::EmptyTermError".
How do i make the search action return the correct values (which it can do), but also...
I would like to be able to track views of an item in a way that I can see what items were the most viewed yesterday, last week or any given period.
How can I do that using either PHP or Rails? Is there a plugin for this in Rails, or is there a simple way of doing this using PHP/memcached?
...
I just read this as a requirement on a job listing:
Aware of the pitfalls of code like: User.find(:all).each
and knew instantly I was unqualified for this job because for the life of me, I don't understand what the problem is . . .
Is it design related? Store the database request in a variable and THEN iterate over it?
Is it dang...
Lets say I have a model called Recipe. Each Recipe has several photos, a PDF file and a video. Is there a plugin out there that lets me have something as simple as Recipe.photos, Recipe.photos.first.filename, Recipe.pdf.filename, Recipe.video.filesize and so on?
...
My site provides a javascript that shows the rate of the Dutch equivalent of the Dow Jones index. Users can embed this script in their website.
It looks like this:
<script type="text/javascript" src="http://www.aexscript.nl/r/gratis"></script>
The corresponding controller action looks like this:
def show
@script = Script....
I'm having difficulty getting CSS to work like I want it to for flashes (those little messages that show when you log in or do something or whatnot to confirm your action, eg in Rails).
I want it to:
live within any arbitrary div
look like a centered box with text in it
be only as big as needed to fit the text (if less than specified ...
I am trying to use the paperclip plugin to let users choose an avatar pic, upload and then store it. I cant seem to get this working.
I have generated the three fields:
add_column :users, :avatar_file_name, :string
add_column :users, :avatar_content_type, :string
add_column :users, :avatar_file_size, :integer
add_column ...
I have a RESTful Rails application with a resource called "Foo". I'm trying to use REST Client to do a put:
resource = RestClient::Resource.new 'http://localhost:3000/foos/1', :user => 'me', :password => 'secret'
resource.put :name => 'somethingwitty', :content_type => 'application/xml'
But my app raises:
ActionController::InvalidAut...
Hello,
I want to display "tips" on my page that changes every say 30 seconds. The results from the "find" method in rails is not ordered by ID. It will be ordered by another column.
What is the best way fetch "next" value. Is there a way to get number of row in result set and then find by next row id?
Thanks,
Tam
...