I just started using paperclip and have a custom processor. I have put the new processor in the correct location RAILS_ROOT/lib/paperclip_processors But, it does not get loaded.
The reason for not loading, is that Rails.root is nil at the time paperclip is loaded. I've tested this by putting explicit code into the paperclip.rb
puts "W...
Is it something like:
change_column :tablename, :fieldname, :limit => null
...
I have been trying to figure out the right way to log a stack trace. I came across this link which states that logger.error $!, $!.backtrace is the way to go but that does not work for me log_error does. As per documentation I do not see how passing a second argument to the error method would work anyway because the ruby logger that rail...
I have somewhat of a unique situation, if I had a form with a checkbox for every state (as in US states, so 50 states say), I don't really want to add 50 columns to my db, how can I store them in an array in a single column?
I feel like I've seen this done but I'm having a hard time putting my finger on the implementation.
...
I'm using the acts_as_taggable_on_steroids plugin and I've added additional fields to the Tags table that I would like to validate. I would rather not modify the plugin code in /vendor.
What is the best approach?
Making a new subclass would require modifying a lot of code I've already written. Is there a way to inject code into the pl...
I have a class in my /lib folder that my delayed_job daemon calls to work on an object of type Foo. If I don't have a "requires 'foo'" in the worker class then it doesn't know what to do with the YAML it gets from the DB and I get the "undefined method" error. Adding in "requires 'foo'" will obviously fix this, which is the usual solutio...
I have been doing web programming for few years. All this time, I have been using RDBMS. As a side project, I would like to create a web application and would like to use NoSQL. I have never used NoSQL. So I would like to use a NoSQL solution. Web app is going to be a calendar and article list that are going to be shared among a project ...
I am trying to run jruby -S rake db:migrate, but I do not want to start up a daemon in config/initializers whenever I do a migrate. Is there a way to do this? Up until now, I have just been moving the daemon file to a file with a .bak extension so that rails doesn't load it when I do the migrate.
I suspect that this is a stupid way of ...
What is the ideal rails server? Lets assume its on a VPS, such as Linode. Lets assume that any of the sites won't become the next twitter, but they should scale well. It must also support multiple sites and all sites are rails 3. And the database must be on the same server (for now).
Should it use apache or nginx?
Ruby Enterprise Editi...
How can one switch environment in Rails 3?
...
Rails3 app with Rspec2 and Cucumber
Cucumber
Given /^that a user is logged in$/ do
current_user = User.first
render new_user_post_path(current_user)
end
Routes.rb
map.resources :users do |users|
users.resources :posts, :collection => {:view => :get}
end
posts_controller_spec
describe PostsController do
describe "#new" do
...
So I think I have a bunch of rubies scattered around here. I want to install rails 3 and watch the railscast online and the person uses rvm to manage ruby versions. I went to install rvm and followed the instruction. I got to the point where I need to do
rvm install 1.9.2
EDIT: and I did
rvm 1.9.2
However after the installation, I ...
Hello guys,
I'm having some troubles after installing in Windows 7 ruby 1.8.6, rails 2.3.8, some basic gems(also ruby-postgres) and the IDE Rubymine from Jetbrains.
So, after creating a simple project with Rubymine(default PostgresSQL configuration in database.yml), I run it in localhost:3000 but it seems not be recognizing nothing lik...
Hi all,
I've got a "word" model in my rails app. In the index action of my words controller, I grab a set of words from my database and look up their definitions.
I do not store definitions in my database and do not wish to store them there.
However, I would like the controller to add the definition for each word to the word object bef...
Hi,
I am trying to build an auto complete using Solr (TermsComponent) and Rails. Now there are several options of doing this using jRails, 'plain' jQuery, autocomplete plugin etc.
What is the best way to do this? Are there any good tutorial for this?
Thanks in advance for any help.
...
Hi all,
I have a javascript which uses XMLHttpRequest to submit data to a rails controller. In the url, it escapes dots as "%2E", however, rails does not seem to unescape this (the dots are in params[:id]). Is there a way to fix this?
Thanks,
Maz
...
Hi,
I have to implement a fairly database intensive task periodically. I am using rails for the application to which this task is related and thus for the sake of easiness and uniqueness in approach I want to know how can I best implement cron job with rails. I am aware that rake is one solution, but am totally unaware of how to use it....
I am writing a Rails helper method that will add wrapper html to captured content blocks and replace content_for method, such as
- content_for :header do
//haml code
..would become
- content :header do
//haml code
In order to do this I am using Haml and Ruby blocks. This is what it looks like
def content(name,&block)
content_fo...
Hi,
I'm using to_json, and including associations.
However, the resulting json object includes all of the methods for the associated objects, even when I ask it to exclude methods.
I've tried these ways of doing it:
render :json => @entries.to_json(:include => {:labels => {:only => [:label_id, :name], :methods => []}})
render :json =...
I have a search filter that fires an ajax request to update the result set upon changing filters. It often happens that the user will change many filters in one go, firing off many AJAX requests.
So I decided to abort previous requests if a new one is made (by using the ajax.abort() function). Now... Firebug shows all those requests as...