I'm having an issue with rails not actually executing JS in a template. I have a respond to block in my controller that is like this:
respond_to do |format|
format.js {}
end
and the proper file in the views, but when it renders it actually just prints the JS, like the mime type is wrong. (the file is add_item.js.erb)
For ex...
In my RoR app, I have a query that could return anywhere 0 to 1000000 results, that I'm limiting to 16 and providing pagination for:
find(:all, :conditions => conditions, :limit => limit, :offset => offset)
I'd like to be able to tell the user how many results they're looking at vs. the total amount of results. Something like "Showing...
I have a project which needs to use an agregrate function to sort and return relevant records from one of my active record models. Problem is, despite seeing it used on numerous rails tutorials, and despite it being in the online ActiveRecord documentation, my Rails app throws this error at me when the method is called:
Unknown key(s):...
When I try to deploy my rails app to my shared hosting (dreamhost) I get this error:
can't activate rack (~> 1.0.1, runtime) for [], already activated rack-1.0.0 for []
So I want to freeze the rack gem in my dev environment, and add it to the project, but even though I have this in my config/environment.rb:
config.gem 'rack'
Doing ...
Working from the railscast #160 base code I've set up a very simple site that allows me to log in, out and register an account. (Its almost identical except that I've removed the 'username' from the users migrate table and relevant views so only an email address is required)
I'm now trying to create a new log in action so that I can log...
I am putting some ajax into a rails project. I am trying to refresh a div with the contents of a partial.
page.replace_html("chemicals", :partial => "chemicals", :object => @chemicals)
However, this returns a huge try/catch block, instead of re-rendering the partial correctly. any idea what's going on?
the error is:
try {Element....
Here's the call in the application.html.erb file:
<%= render :partial => 'tasks/_new' %>
Here's the partial being rendered (_new.html.erb):
<% form_for @task do |f| -%>
<%= f.text_field :body %>
<%= submit_tag "Submit" %>
<% end -%>
Here's the method in the 'tasks' controller:
def new
@task = Task.new
respond_to do |forma...
I have set up sweepers to clear specific pages in the page cache when the model is modified via a controller.
How can I use the sweeper from the Rails console (IRB)?
ie. When I modify a model object in the console, either the sweeper should automatically run, or I need a simple way of manually running the sweeper for the modified objec...
Hello,
Can someone provide an example of using Builder to create multiple XML files from a SQL database. I can easily create one containing the entire database as in here...
def index
respond_to do |format|
format.xml { @rides = Rides.find(:all) }
end
end
This will create a file called index.xml based on a file I created calle...
I am trying to solve a strange issue with ferret/acts_as_ferret
Of course I have googled and posted the question:
http://www.ruby-forum.com/topic/188570
Basically aaf works on single models with no issue. It also works on single models using the config/aaf.rb file I have setup. It even works when I do a multi-model search in the consol...
I'm trying to create a log of attributes that have changed within each update to a certain message. The attributes are IssueStatus and IssueType, and both have two polymorphic associations with UpdateAction, that saves the changed_from_id and changed_from_type as well as changed_to_id and changed_to_type perfectly.
class IssueStatus < ...
I am using Vim for Ruby development and I have some annoying problem.
When I type Ruby hashes, I see the wrong indentation:
{
{ #Here it is.
}
}
How it is possible to resolve this?
I am using akitaonrails vimfiles.
...
I recently switched to jQuery using jRails for an app. 99% of all my previous RJS seems to work perfectly, the only except is the :loading => callback when using the remote_form_tag.
<% form_remote_tag :url => '/hostels/update_currency', :loading => visual_effect(:appear, :load_currency), :html => { :id => 'currency' } do %>
I have ...
I just starting using jRails and the jRails auto_complete helper
http://github.com/evilmarty/jrails_auto_complete
I was using the default auto_complete helper before using prototype and the drop in worked fine with jRails except for hovering over the results of the autocomplete. If you use simple text for the result, it works as adver...
Hi.
Say I have a collection of @dogs, and I want to render part of the collection in one place and the rest in another. It's easy to spit them all out together:
render :partial => 'dogs/summary', :collection => @dogs, :as => :dog
But is it possible to manipulate (refine) your collection in-line, or is it better practice to make those...
I have written the following code in my Rails app to generate XML. I am using Aptana IDE to do Rails development and the IDE shows a warning that the code structure is identical in both the blocks. What changes can be done to the code to remove the duplicity in structure? Is there any other way to write the same?
xml.roles do
@roles...
Hi,
I want to call an action of a controller from another controller.
How can I do this?
Some years ago, there were compononents, but they are not available any more.
Best regards
...
Hi, I've got the following controller
def detail
@book = get_book_details(params[:asin])
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @booklists }
end
end
the unbundle lib get_book_details(asin), return a "book = Hash.new" like this:
book[:title]
book[:editorial_reviews] ...
If I have an ActiveRecord::Base model with a default-scope:
class Foo < ActiveRecord::Base
default_scope :conditions => ["bar = ?",bar]
end
Is there any way to do a Foo.find without using the default_scope conditions? In other words, can you override a default scope?
I would have thought that using 'default' in the name would sug...
I'm trying to build a view similar to PivotalTracker where there are a variety of rows in different buckets. There is some polling to the server because rows could be updated by other users while you're working on it and the page should update on its own without having to manually refresh it.
I know how to poll the server and get updat...