could someone explain the code in catch_exceptions?
i have difficulties to understand.
thanks
class ApplicationController < ActionController::Base
around_filter :catch_exceptions
private
def catch_exceptions
yield
rescue => exception
logger.debug "Caught exception! #{exception}"
raise
end
end
...
When I do bundle install bundling edge rails I get this error:
No compatible versions could be found for required dependencies:
Conflict on: "bundler":
* bundler (0.9.26) activated by bundler (= 0.9.26, runtime)
* bundler (>= 1.0.0.beta.3, runtime) required by rails (>= 0, runtime)
All possible versions of origin require...
Say I have a string that is a url with params in it:
http://www.google.com/search?hl=en&client=firefox-a&hs=zlX&rls=org.mozilla%3Aen-US%3Aofficial&q=something&cts=1279154269301&aq=f&aqi=&aql=&oq=&gs_rfai=
How can can I form an array of all the params from the string? I'm aware of the params arra...
I can't get rSpec installed for Rails 3.
I'm running Ruby -v=1.8.7, Rails -v=3.0.0.beta4
So far I have..
git clone git://github.com/indirect/rails3-generators.git lib/generators
My GemFile :
group :test do
gem 'rspec'
gem 'rspec-rails'
gem "factory_girl"
gem 'cucumber-rails'
end
I ran :
bundle install
Then :
...
I am new to rails, and have a situation that I can't quite get my head around.
Lets say I have two resources, users and widgets.
Users can use widgets, but widgets are also user created, and should be owned by the user that created them. There needs to be a user uses widget, and a user owns widget. Is the following what I am looking ...
I'm using the Rails3 beta, will_paginate gem, and the geokit gem & plugin.
As the geokit-rails plugin, doesn't seem to support Rails3 scopes (including the :origin symbol is the issue), I need to use the .find syntax.
In lieu of scopes, I need to combine two sets of criteria in array format:
I have a default condition:
conditions = [...
I have a hard time reading open source file download pages like this http://rubyforge.org/frs/?group_id=167 . I click the "One-Click Ruby Installer" link on this page http://wiki.rubyonrails.org/getting-started/installation/windows and it takes me there.
I understand most of it like the versions for mac, win and source, version numbers...
I have a shared host using hostgator and I run my app using mod_proxy because FCGI doesn't really cut it. How can I ensure that if mongrel crashes or stops running that it will be restarted?
...
We really like the idea of hosting with Amazon EC2 and the excellent EC2 on Rails, but our cashflow isn't enough to justify a move to EC2. So we've decided to host with linode. Now we're trying to put together the best Rails server build.
For those that don't know, EC2 on Rails is an opinionated Ubuntu Linux Server image for Amazon's E...
Using the rails button_to helper I'm trying to run the update method in a controller. I need to set the ID of the object being updated manually. The code I have I think should be right, but rails keeps trying to put the ID as part of a route.
in the view:
button_to ">", :controller=>'people', :action=>'update', 'person'=>{:team=>team...
I need to perform these SQL below, but I couldn't get the result.
newid=Header.find_by_sql(
"SELECT coalesce(max(transaction_id),0)+1 AS id
FROM transaction_headers
WHERE transaction_year = #{Time.now.year} AND
transaction_type='#{fields[:transaction_type]}'"
)
But I can't seem to get the result to newid. The only value I ...
I'm trying to use Ruby on Rails' Formbuilder and HAML to edit a model that has some fields that can only be edited a creation. I still want to display them, but I don't want them editable. I've struggled trying to do this and make the form look presentable. So, if the field is editable, I use
= f.text_field :price_code_1, :label_...
Here's my existing code. I could use some guidance on how to optimize this. Essentially, I don't want to have to run a SQL query more than once -- self.active_item?(r). What I'm thinking I can do instead of making separate DB queries, is retrieve an array of all the user's active inventory items (e.g., self.active_inventory_items), tur...
Hi folks, Stackoverflow has taught me so much about what proper RESTful, MVC, GET/POST is that I am wondering how people learn to program/engineer in the past before Stackoverflow existed. ;)
Given that, here is another question on how I can do a (fairly) common procedure in the most appropriate way.
I need to generate a HTML from a ...
I have created a text node and inserted into my document like so:
#<Nokogiri::XML::Text:0x3fcce081481c "<%= stylesheet_link_tag 'style'%>">]>
When I try to save the document with this:
File.open('ng.html', 'w+'){|f| f << page.to_html}
I get this in the actual document:
<%= stylesheet_link_tag 'style'%>
Is there a way to di...
I wrote a rack middleware for my rails that that does something based on the if the REQUEST_URI equals specific string.
However what I quickly found out was in my development environment, which is using WEBrick, is the server puts in the full url for the REQUEST_URI. On my production environment, which is on Heroku, it behaves like exp...
I'm just wondering how to implement database views in Ruby on Rails. Can you guys put some working example? And thank you for every advises and examples.
...
Hi
i am using will_paginate for pagination.
in this iam using images for clicking next and previous.
like, :prev_label & :next_label and it is working good
but, i want to add images to page numbers as well, and on clicking next it should roll over to next image.
Please give me solution for this
...
How can I enforce a min number of nested attributes or associated records during creation of the Model.
This works fine but the error message is shown at the top of the form (nested), I want it to appear inline or near the nested association fields.
Model Vote
has_many :vote_items, :dependent => :destroy
validate :min_vote_items, :if ...
I've been recently playing around with distributing our testing load across multiple machines (and multiple cores) over the network.
I've tried out:
SpecJour http://github.com/sandro/specjour
This worked pretty well and was really easy to set up. Reduced out testing time by about 30% across 4 machines (8 cores)
However, I really li...