I really don't want to use prototip or prototip2 because I have to pay for them and I only need to do one very simple alert. The user will submit a remote form and then a small alert will come up and fade out after 5 seconds or so. It doesn't even need any fancy styling. I'd ideally like to use scriptaculuos over jquery. I just have no i...
So I have a model that I need to be able to serialize to/read from an Excel(XLS) document. I am a bit of a loss as to where this code actually belongs. My initial thought is that the to_xls is a view, but after poking around and seeing things like (to|from)_xml and (to|from)_json in ActiveRecord, I was wondering if maybe this stuff belon...
Hello, all. I've got a dynamic fixture CSV file that's generating predictable data for a table in order for my unit tests to do their thing. It's working as expected and filling the table with the data, but when I check the table after the tests run, I'm seeing a number of additional rows of "blank" data (all zeros, etc). Those aren't be...
class Bill < ActiveRecord::Base
has_many :invoices
end
class Invoice < ActiveRecord::Base
belongs_to :bill
end
Then in my form I've got several fields for invoices all with the name bill[invoice_names][] so I can access them from params[:bill][:invoice_names].
At the moment I've got a method like this on my Bill Model:
#bill.rb
...
I had this to dynamically add items in html
<td id="campus_list">
<%= link_to_function image_tag("new.png", :width => 16) do |page|
page.insert_html :bottom, 'campus_list', :partial => 'campus_selection'
end %>
<br/>
</td>
the template is like this
<div>
<%= select_tag "campuses[]", options_for_select(AvailableCampuses.ma...
OK, so I'm really new to Ruby on Rails. I'm using InstantRails, if that is going to make any difference.
Here is my problem- I am trying to validate some entries into a form. If I use the form without any validations, then it works fine. If I add the validations, it completely changes the application's behavior and does not work.
For ...
I was just watching a preview of a session at Aloha on Rails called "You're Doing it Wrong".
In the short preview, he mentions using ActiveRecord models as enumerations (I assume he means plugins like enumerate_by). This seems like reasonable idea to me, what are the problems? Is it just the overhead required by the additional objects?
...
Hi friend,
I need to know how to fetch file field's file name into textbox using Rails and Prototype
1) I need to upload any file using <%=file_field "text"%>
2) Then I need to fetch those file name into new textbox below
please help to solve this problem.
Thanks
...
First off, let me say that I am familiar with content_for. It's not really what I'm looking for here.
I want to allow a template and any number of partials to build up, say, a list of JavaScript files I want to load, and pass them up to the layout for it to process and add to the <head> area. I only want to load the files if the page ac...
I don't know if this a Ruby question or a Rails question but in this example of a use of nested resources in Rails, how is it possible to assign an event object to an event_id? The event object would seem to represent a larger set of values than the event_id does.
<%= link_to 'Tickets', event_tickets_path(:event_id => @event) %>
...
Could someone please remind how I get the generator to add the lines required to use JSON in my controllers? Having to type format.json { render :json => @story } type lines to each action is starting to get old?
...
In the Rails docs, it says this:
<%= url_for(@workshop) %>
# calls @workshop.to_s
# => /workshops/5
Is this because the string version of every model in Rails corresponds to a URL for a particular instance of that model?
...
I'm trying out the beast forum written in rails and will use this as an example of a problem I keep facing.
The forum has a topics/show action and view with a form at the bottom to create a new post within the topic.
Submitting the form goes to posts/create and if the validation passes redirects back to topics/show and works fine, howe...
I'm using the following webrat matcher:
response.should contain(text)
With the following haml:
%p
You have
= current_user.credits
credits
I've written the cucumber step 'Then I should see "You have 10 credits"', which uses the webrat matcher above. The step fails, webrat does not find the text in the response because the ham...
I have a model with validations defined, I want to monkey patch the model and remove these validations, any ideas?
...
Hello,
Is there any good "Rails Personal Messaging plugins"? Or should I roll my own? This is the features I might need:
Send/recieve personal messages
Notification by email. (you got a new message)
Maybe contacts (not important)
Best regards.
Asbjørn Morell
...
As far as I can tell, this is a views and controller problem.
I need to allow users to edit multiple records in one of my database tables. Railscast 165 deals with a similar situation, but it's not quite on point for me: http://railscasts.com/episodes/165-edit-multiple
I have a fixed set of products, and I need to let users add as...
Greetings,
has anyone of you used the paperclip plugin on Engine Yards hosting service? Are there any problems to solve or anything to pay special attention to?
Is the paperclip on heroku example of Pedro Belo fitting?
Thanks for your comments,
Joe
...
Our client has decided that they would like all blank AR error messages to be changed from "can't be blank" to "must be completed" throughout the entire app.
What's the easiest Rails'y way of doing this?
...
If you call url_for on a model object:
<%= url_for(@workshop) %>
The docs for url_for say it calls @workshop.to_s which results in:
/workshops/5
But if I just call to_s on the model, I don't get the route - how does url_for do this?
...