I have a rails app with a heavy initial data in the database. Everytime I use rake db:reset I must import a sql file for loading this data. That is not kinda rails way, so I whis I could get this data into a seed.rb and deploy it with the app.
...
I have in project.rb:
has_many :items, :dependent => :destroy
And in item.rb:
belongs_to :project
My projects fixture:
b1_s_first_project:
title: B1's first project
And my items fixture:
b1_s_first_project_s_first_item:
title: B1's first project's first item
project: b1_s_first_project
In my unit test, I set local varia...
hi
i want to add a enquiry id number to my emails so that when a user replies i i can automatically attach the email to an enquiry.
I am going to put a message with please do not remove this enquiry number when replying but it would be good if i can put a custom header with the enquiry number so the user doesnt see it.
Is this possibl...
Hi All,
I have application which allow users to create there on URL for a page on a particular domain.
What I want to achieve is to create URL having variable number of parameters separated by "/". For example:
www.mydomain.com/a
ww.mydomain.com/a/b
www.mydomain.com/a/b/c
and so on. After the root, everything would be considered as...
So..
<%= submit_tag 'Save', :name => 'save' %>
<%= submit_tag 'Save to Library', :name => 'library' %>
then in my controller:
with_action do |a|
a.save do
end
a.library do
end
end
the problem is that only one of the actions is getting invoked... the same one for both submit_tags...
any idea why?
or how I can ge...
I'm working on a rails app that integrates with other systems (which can't be changed), and I need to handle the case below:
A user is redirected to my app with a URL like:
http://myapp.com/index?action=signout
The problem is, I can't access this param through params[:action], since Rails uses that to keep track of the current action....
As an Oracle ADF developer I am familiar with being able to create an Entity (the rails equivalent would be a Model) that includes all of the DB constraints (PK, FK, unique, length, any non-trigger induced constraint). As a result, in ADF I can very easily create a field on the view that is based on an Entities attribute.
For the sake o...
i installed ruby and then gem of rails. when i am trying to start server using
ruby script/server
i am getting an error
ruby: No such file or directory -- script/server (LoadError)
...
I'm trying to use a class as a before filter for multiple controllers. Because the filter must do slightly different things based on which controller is calling it, it seems like I need to use a class as a filter in order to get the controller passed in to filter.
So far, I have something like
class ShowFilter
def self.filter(controll...
I have one model where i am using resque.
This is my model.
Class Test < ActiveRecord::Base
@queue = :default
def self.perform(params)
puts "Processed a job!"
end
def self.load_test123(params)
Resque.enqueue(DataFile, params)
end
end
is this a proper way ???
...
I'm using Ubuntu 10.04. In the terminal, when I go to my app and type (without using the "ruby" in front):
script/generate controller recipes
I get a "Permission denied" error. When I use this however:
ruby script/generate controller recipes
everything works as expected. Is there something I have to do to Ubuntu to make the prepend...
Hi Folks,
I am very confused by a sudden problem with running rake tasks:
softwareclick:/myapp/current# rake my_task --trace
(in /myapp/releases/20100621162444)
** Invoke my_task (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
undefined method `text_area' for class `ActionView::Base'
/myapp/releases...
I want to start script/delayed_job start on my production when i will start my rails server.
Is there anyway i can do that?
EDIT::
I have added this line to my config/initializers/delayed_job.rb .
Delayed::Worker.new.start
But my delayed job server is not starting when i am running my rails applicaiton.
Is there any other solution...
Hi guys, I have the following issue:
I have two classes in my rails app, joined by a HABTM association, like so:
#ad.rb
has_and_belongs_to_many :specs
#spec.rb
has_and_belongs_to_many :ads
joined by an ads_specs table.
I'm trying to perform a search on the Ad class using the excellent searchlogic gem. Everything went fine until I wan...
I am implementing an application that manipulate XML documents using Ruby on Rails. I want to have models that encapsulate all the logic and then convert them to corresponding XML document when save. Although I do not need database persistence for my models, I want my models to have validation mechanism like ActiveRecord's. Also, for con...
QUESTION
Which of the Youtube Data API auth methods will allow me to upload videos to a single channel without having to force my site's user to authenticate?
OAuth
AuthSub
Client Login
I've read http://code.google.com/apis/youtube/2.0/developers_guide_protocol.html#Authentication but am still unsure.
BACKGROUND
I'm building an ap...
I have to make a simple difference between two dates:
Date.parse("2009-06-20") - Date.today
This gives me the difference of the dates in days.
Anyone know a way to easily convert that to the following format:
The event occurred X years, Y months and Z days ago
Thank you.
...
I'm using ar-extensions' import feature to do bulk import and it's quick, but not as quick as I'd like. Two problems I am seeing from the logs:
I still see individual SQL insert statements - why isn't it doing multirow insertion?
I have a :validates_uniqueness_of and I see that it does a SELECT for every row to do it. Is there a "bulk ...
This looks like code in the C language, but I am not completely sure ...
# define v putchar
# define print(x) main(){v(4+v(v(52)-4));return 0;}/*
#>+++++++4+[>++++++<-]>++++.----.++++.*/
print(202*2);exit();
#define/*>.@*/exit()
...
I'm implementing an ActivityStream for my site based on the answer provided in this question: http://stackoverflow.com/questions/202198/whats-the-best-manner-of-implementing-a-social-activity-stream.
My approach is to use observers after_create to create the activity record, including the metadata. I have a ton of observers, and don't ...