I basically want to use link_to to link to the index method of a controller. I tried:
<%= link_to 'Recipes', Recipe %>
but that outputs:
<a href="/recipes/Recipe">Recipes</a>
Which is clearly not right, if it left off that last bit it would do exactly what I want it to. I thought that with RESTful stuff I somehow would start to l...
Let's say I have this model named Product with a field named brand. Suppose the values of brand are stored in the format *this_is_a_brand*. Can I define a method in the model (or anywhere else) that allows me to modify the value of brand before it is called. For example, if I call @product.brand, I want to get This is a Brand, instead of...
By default Attachment Fu stores uploaded files in "public/#{table_name}". I want to modify this to be something like "public/#{table_name}/#{site_id}", where site_id is a property of the model. Note that I've tried using self.site_id and both fail.
has_attachment :storage => :file_system,
:max_size => 25.megabytes,
...
I want to create a route in my rails application along the lines of
/panda/blog
/tiger/blog
/dog/blog
where panda, tiger, and dog are all permalinks (for an animal class)
The normal way of doing this
map.resources :animals do |animal|
animal.resource :blog
end
would create routes along the lines of
/animals/panda/blog
/animals/t...
We are developing a considerably big application using Ruby on Rails framework (CRM system) and are considering to rewrite it to use ExtJS so that Rails would just do the data handling, while ExtJS would do all the browser heavylifting in a desktop-like manner.
Anyone has some experience and hints about what would be the best approach?...
Hi,
I'm using Test/Unit with a standard rails 2.1 project. I would like to be able to test Partial Views in isolation from any particular controller / action.
It seemed as though ZenTest's Test::Rails::ViewTestCase would help, but I couldn't get it working, similarly with view_test http://www.continuousthinking.com/tags/view_test
Mos...
When i deploy a rails application in production mode, it appends a date-time string as a query param to the end of all the static asset urls. This is to prevent browsers using old-out of date cahed copies of the assets after I redeploy the application.
Is there a way to make rails use the old time stamps for the assets that have not ch...
We're thinking about using the rufus-scheduler gem on a Ruby on Rails project to do regular monitoring of a communication queue. Has anyone have experience using this gem on a Rails project? Anyone have strong preferences of an alternative scheduler?
...
I have an extremely simple routes.rb in my Rails app:
ActionController::Routing::Routes.draw do |map|
map.resources :tags
end
Starting up my app with script/server and pointing my browser to localhost:3000/tags/ yields:
ActionController::MethodNotAllowed
Only get and post requests are allowed.
...
Starting up my app with script...
I'm currently working with Groovy and Grails. While Groovy is pretty straight-forward since it's basically Java, I can't say I grok Grails. I read that Groovy is to Grails as Ruby is to Ruby on Rails, but what does that mean?
...
Let's say I'm writing a Library application for a publishing company who already has a People application.
So in my Library application I have
class Person < ActiveResource::Base
self.site = "http://api.people.mypublisher.com/"
end
and now I want to store Articles for each Person:
class Article < ActiveRecord::Base
belongs_to :...
I know I'll get a thousand "Depends on what you're trying to do" answers, but seriously, there really is no solid information about this online yet. Here are my assumptions - I think they're similar for alot of people right now:
It is now October 2008. I want to start writing an application for January 2009. I am willing to use beta...
I'm developing a cart that needs to calculate tax and am looking for a 3rd party tax service to handle the calculations.
I've used Avalara in another app, but it's somewhat miserable since I have to use the Rjb gem with their java library.
Does anyone have a recommendation for a tax service that works well with rails?
...
I am currently using Rails 2.1.0 and want to upgrade to Rails 2.1.1. After issuing the following command
gem update rails
I suppose that I need to change this line
RAILS_GEM_VERSION = '2.1.0' unless defined? RAILS_GEM_VERSION
in environment.rb
What other actions should I take to ensure that my application is using the latest ver...
I have a situation where I have two models, companies and permissions, where companies is in a separate database from my permissions database. This is a has and belongs to many relationship because each company can have many permissions and each permission can belong to many companies.
The reason the two databases are split is because ...
I couldn't really find this in Rails documentation but it seems like 'mattr_accessor' is the Module corollary for 'attr_accessor' (getter & setter) in a normal Ruby class.
Eg. in a class
class User
attr_accessor :name
def set_fullname
@name = "#{self.first_name} #{self.last_name}"
end
end
Eg. in a module
module Authentica...
What is the best way to create a custom title for pages in a rails app with out using a plug-in?
...
Hi,
we're running in this issue. We're using a web service (using soap4r) to run some kind of searches and the problem appears when the webservice server is down and our aplication is trying to connect to it.
At that point the application is unreachable, and all the customers are blocked.
What can we do to avoid that? Is possibile to ...
I have named_scope which is reused in multiple ActiveRecord models.
For example:
named_scope :limit, lambda {|limit| {:limit => limit}}
What is the best practice to extract this code to be shared across models.
Is it possible to extract it to a module or should I rather reopen ActiveRecord::Base class?
...
Let's say you already "know" what your client wants from you (i.e. you already did some analysis and have some clue about what are you supposed to deliver). What are the next steps you usually go through after this phase? In other words, what are the steps (in terms of preparation of the framework, plugins, repository, etc.) you do in th...