I want to use rake background task in rails like this
system("cd #{Rails.root} && RAILS_ENV=#{Rails.env} rake abc:def --
trace 2>&1 >> #{Rails.root}/log/rake.log &")
This is ok in development environment, but will not work in production
mode.
I used logger to check whether the command string is
I have an observer which will do some tidy up work around Model A.
But when I create or destroy A's instance inside a custom rake task,
the observer seems not get called at all?
Can some one explain this?
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails
Thank you for the detailed reply.
I will have a research on mongoDB.
And I am wonderring is there a way to integrate mongoDB with rails?
On 5月12日, 午後9:33, Marnen Laibow-Koser wrote:
> boblu wrote:
> > I have a Lexicon model, and I want user to be able to create dynamic
> > f
I have a Lexicon model, and I want user to be able to create dynamic
feature to every lexicon.
And I have a complicate search interface that let user search on every
single feature (including the dynamic ones) belonged to Lexicon model.
I could have used a serialized text field to save all the dy
I have a Lexicon model, and I want user to be able to create dynamic
feature to every lexicon.
And I have a complicate search interface that let user search on every
single feature (including the dynamic ones) belonged to Lexicon model.
I could have used a serialized text field to save all the dy
my time zone is set like this
config.time_zone = 'Tokyo'
I got this from console
>> temp1.updated_at
=> Tue, 06 Oct 2009 13:26:57 JST +09:00
>> temp1.updated_at.to_formatted_s(:db)
=> "2009-10-06 04:26:57"
>> temp1.updated_at.to_formatted_s(:long)
=> "October 06, 2009 13:26"
Can anyone tell
can tell you it does not work, because the 'belongs_to' declaration
will be evaluated in the abstract class and the sub class will only
inherit the methods generated by 'belongs_to'.
On 8月10日, 午後10:27, Ilan Berci
wrote:
> boblu wrote:
> > anyboby any ideas?
>
> self
anyboby any ideas?
On 8月10日, 午前9:27, boblu wrote:
> Thanks a lot for your reply.
>
> I just tried your suggestion, but I did not get luck.
>
> This is the console output:
>
> Jp::Property.first
> TypeError: can't dup NilClass
> from /rails/activerecord/l
Thank you for your reply.
Actually, that eval is a typo. But I found by removing that 'eval' did
resolved my problem here.
Thank you very much.
On 8月10日, 午前2:55, "s.ross" wrote:
> Hello--
> On Aug 9, 2009, at 9:39 AM,bobluwrote:
>
>
>
>
>
> > I have a module like this:
>
> > module Controller
Thanks a lot for your reply.
I just tried your suggestion, but I did not get luck.
This is the console output:
Jp::Property.first
TypeError: can't dup NilClass
from /rails/activerecord/lib/active_record/base.rb:2189:in `dup'
from /rails/activerecord/lib/active_record/base.rb:218
I have a module like this:
module Controller
module LocaleModels
def self.included(base)
base.send :include, InstanceMethods
end
module InstanceMethods
def locale_Lexeme; constantize_model('Lexeme') end
def locale_Synthetic; constantize_model('Synthetic') end
I have four tables: jp_properties, cn_properties, jp_dictionaries and
cn_dictioanries.
And every jp_property belongs to a jp_dictionary with foreign key
"dictionary_id" in table.
Similarly, every cn_property belongs to a cn_dictionary with foreign
key "dictionary_id" in table too.
Since there a
ongs_to'
declaration in its parent.
So, in my example,
I can never get 'Jp' or 'Cn' strings in the abstract class Property's
'belongs_to' declaration because the instance object 'temp' never saw
that declaration.
Please fix me if I am wrong.
I have many models and want to share common functions among them in
abstract_class models as many as possible.
But why the associations specified in abstract_class do not work?
For example:
class Property < AR::Base
self.abstract_class = true
belongs_to :dictionary, :foreign_key=>'dictiona
variable.
But because all the before_filter and after_filter are wrapped to
almost all actions in my app, so what I really want is that whether
there is something that can persists its value between different
request?
On 7月16日, 午後7:01, boblu wrote:
> I understand that rails drops all insta
I understand that rails drops all instance variables created in normal
controller action after rendering view templates.
But I have the following problem that a normal controller action has
several before_filter and after_filter, which all using same set of
variables fetching from database.
#
oda get loaded only once,
so I did not notice that Lexeme.column_names has been changed in other
process.
Anyway, I had a better idea of find, include, joins and the whole find
action in finding this bug.
Fred, thanks for your advices.
On 3月10日, 午後11:23, boblu wrote:
> I forgot to ment
seems everything went ok, just
like mine in development environment.
I'm wondering are there anyone try running the same find in production
environment?
And does it output the same error?
On 3月10日, 午後6:22, boblu wrote:
> Fred, thanks for the quick reply.
> I did ask the same problem 5 month
Fred, thanks for the quick reply.
I did ask the same problem 5 month ago.
I managed to use join instead of include like this
Lexeme.find(:all, :conditions=>'structures.id<10', :joins=>'left outer
join structures on structures.ref_id=lexemes.id and
structures.meta_id=0')
Since usually I need to s
Here is my weird problem.
Two models like following:
Lexeme
id:int
name:string
Structure
id:int
ref_id:string
meta_id:int
Lexeme can have many structure records through foreign key 'ref_id' in
the structures table.
And these structure records belonging to one lexeme differs between
each other u
Sorry, that was my typo.
The correct error was:
## table 1: companies ##
id int
name string
## table 2: sections ##
id int
ref_company_id int
ref_meta_id int
sec_name string
class Company < ActiveRecord
has_one :main_section, :class=>"Section", :foreig
you
will need the returned companies' sections, you will make a trip to
the DB that may have been avoided by using :include.
On Nov 18, 6:41 pm, boblu <[EMAIL PROTECTED]> wrote:
> yes, the compannies table does not have a columns called
> ref_company_id.
> It is the table
yes, the compannies table does not have a columns called
ref_company_id.
It is the table which is referreced by the sections table that has a
ref_company_id as a foreign key.
Can you explain why that error comes out? 'cause I cannot find any
clue about it.
And thank you for mentioning your blog p
Unknown column 'companies.ref_company_id' in 'field list':
SELECT `companies`.`id` AS t0_r0,
`companies`.`ref_company_id` AS t0_r16,
`companies`.`ref_meta_id` AS t0_r17,
`sections`.`id` AS t1_r0,
`sections`.`ref_company_id` AS t1_r1,
hy that strange SQL
statement comes out.
Can anyone please help me?
On Nov 18, 1:52 pm, boblu <[EMAIL PROTECTED]> wrote:
> I had real weird problem here.
>
> If I use "joins" in find, both development and production environment
> give right answers.
> But, when I use &
I had real weird problem here.
If I use "joins" in find, both development and production environment
give right answers.
But, when I use "include" in find, the development environment goes
all right. However, the find method fails in production enviroment.
Let me describe this in detail.
I hav
Can anybody tell me about this?
Does this "connection pool" have something to do with multiple
database connection?
Or it is only for concurrent access with one database?
On Nov 17, 3:14 pm, "Jeremy Kemper" <[EMAIL PROTECTED]> wrote:
> Right. You need to use a nonblocking database driver to do c
I wrote my app in your way. So I support you.
I don't think it is better to write only one template for both new and
edit.
Because they are different methods in controller, and sometimes they
take different parameters and submit different parameters too.
On Nov 13, 7:33 am, Sam Kong <[EMAIL PROTE
is not the correct ruby way of doing things.
And maybe I should re-orgnize my app structure like your suggestion.
Thank you.
On Oct 31, 5:42 pm, Frederick Cheung <[EMAIL PROTECTED]>
wrote:
> On Oct 31, 8:28 am, boblu <[EMAIL PROTECTED]> wrote:> But sometimes, we need
> some
But sometimes, we need some methods that both used in view and
controller.
Where do you suggest to put them in?
On Oct 31, 5:18 pm, Frederick Cheung <[EMAIL PROTECTED]>
wrote:
> On 31 Oct 2008, at 07:59, boblu <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> &g
In my project, I have
class ApplicationController < ActionController::Base
helper :all
end
module ApplicationHelper
def use_module
###
end
end
class B < ApplicationController
def efd
call_private()
end
private
def call_private()
use_module()
end
why don't you write 2--4 line into a single line ?
page << "if ($('single_blog_info_box_480').childElements().length ==
0 ){$('message').Appear;}"
On Oct 31, 7:35 am, elioncho <[EMAIL PROTECTED]> wrote:
> I added the () but that's not the problem. I added the next alert and
> it shows the events
Your code seems right.
But in case that I havn't used submit_to_remote, so I cannot tell you
what you are missing.
Did you use debug to see whether your XMLHttpRequest call can ge
caught by the 'new' action in controller?
However I can tell you that using form_remote_tag or defining a
button_to_r
I think you' better write a method rather than using belongs_to.
In my opnion, if you use belongs_to :xxx, than you get xxx for all the
object of Category class, not just the root category.
If you write a seperate method, you can write your own logic in it,
for example, for every category, you fir
Do you mean Model.column_names ?
You could just use it, and it will return an arry with all your column
names in your DB tables.
On Oct 28, 11:42 am, Phil Go20 <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> I am just starting on Ruby and I would like to know if there is any
> place in the code where I can
I don't think that you can pass an array or hash which is more than
one level from view to controller.
You'd better divide your objects into strings and pass them seperately
or arrange them in an array or hash which has only one level.
On Oct 27, 10:24 am, daociyiyou <[EMAIL PROTECTED]> wrote:
>
Oct 26, 2:41 am, Frederick Cheung <[EMAIL PROTECTED]>
wrote:
> On Oct 25, 4:56 pm, boblu <[EMAIL PROTECTED]> wrote:
>
> > @Fred
> > Thank you for reply. I just tried the two ways you suggested.
>
> > 1. use link_to_remote :update in view and render :partial in
&
@Fred
Thank you for reply. I just tried the two ways you suggested.
1. use link_to_remote :update in view and render :partial in
controller instead of calling render :update
This really does not make any differences. They gave the same output
which all my staff in
My problem is quite complicated.
In my project, I have to use static tag to generate dynamic
graph with links inside it.
for example in a erb.html file, I wrote.
1. ### this will generate a tree view in my page.
2.