On 23 December 2011 07:07, Dharmdip Rathod wrote:
> It's not working !
It is no good just saying it is not working, what response do you
expect from that?
Gautam Pai suggested that you read the documentation, but four minutes
later you posted your reply so I suspect you did not do that. Go back
It's not working !
Gomzi Pai wrote in post #1037968:
> try :scope option in your statement
>
> eg:
>
> validates :itemcode, :uniqueness => true, :scope => :user_id
>
> read the documentation here
>
>
http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#method-i-validates_
the difference might be illustrated by the following:
Article.where(:hidden => true).to_sql
vs.
Article.where(:hidden => true).all.to_sql
in the first, you are able to get the (currently un-executed) sql
statement
in the second, you will get an undefined_method error because having
been evalua
On Apr 7, 1:21 pm, Tom Mac wrote:
> Hi
> Then how can I check that it is not triggering sql. I did not
> understand it properly. Could you explain more please?
>
Look in your development log and ensure that you don't touch the scope
- when you do anything other than adding conditions, joins
Hi
Then how can I check that it is not triggering sql. I did not
understand it properly. Could you explain more please?
Frederick Cheung wrote in post #991438:
> On Apr 7, 10:49am, Tom Mac wrote:
>> Hi Fred
>> Thanks . I tried from sample application also like
>> def index
>> @articles =
On Apr 7, 10:49 am, Tom Mac wrote:
> Hi Fred
> Thanks . I tried from sample application also like
> def index
> @articles = Article.where(:hidden => true)
> puts @articles.inspect
> -
> end
>
> Here also the query executed. I dont know why.
because you called
Hi Fred
Thanks . I tried from sample application also like
def index
@articles = Article.where(:hidden => true)
puts @articles.inspect
-
end
Here also the query executed. I dont know why.
--
Posted via http://www.ruby-forum.com/.
--
You received this message
On Apr 7, 8:56 am, Tom Mac wrote:
> Hi
> I have just started learning Rails3 (ruby1.92, Rails3.0.5) and watched
> railscast episode 202. I tried
> Article.where(:hidden => true) from console. I have a confusion there
> since the cast says that , the above statement execute query in the view
>
Hi
i am talking exactly about this. Now only I found this
https://rails.lighthouseapp.com/projects/8994/tickets/4476-lazy-loading-broken-since-beta3
I am getting this not only in console but application also. Has
anything changed in Rails3.0.5?
--
Posted via http://www.ruby-forum.com/
> At the end of the day, the most important thing is that it works. However, I
> think we should try to get the database do the work. I'll apologize in
> advance that this example is rails2.
>
> # Project -> TaskList -> Task
> Project.all(:group => "projects.id", :joins => {:task_lists => :task
At the end of the day, the most important thing is that it works. However, I
think we should try to get the database do the work. I'll apologize in advance
that this example is rails2.
# Project -> TaskList -> Task
Project.all(:group => "projects.id", :joins => {:task_lists => :task},
:conditio
On 16 October 2010 13:47, Max Reznichenko wrote:
> Colin Law wrote in post #954645:
>>
>> Are the reverse relationships has_many or belongs_to?
>>
>> Colin
>
> Yes, sure.
> A <--belongs_to- B <--belongs_to- C <--belongs_to- D
>
> 2Steve.
>
> Here you have a right solution, but this code should be
Colin Law wrote in post #954645:
>
> Are the reverse relationships has_many or belongs_to?
>
> Colin
Yes, sure.
A <--belongs_to- B <--belongs_to- C <--belongs_to- D
2Steve.
Here you have a right solution, but this code should be written in
controller. In this case, I could easily run through all
> Someone else will have to chime in on how efficient or inefficient
> this is. My last project was on a database that was very reliant on
> "sets" and this is the closest thing I've found in rails to that
> concept.
Just To clarify the last statement, the Database environment was 4D
and in 4D y
I guess I have to chalk to up to another "I didn't know you could do
that". I'll also admit I have no idea how efficient this is.
I've used a technique where I query a belongs_to table with the ids of
a has_many related table. In my test I have
Assessments has_many -> Questions has_many ->
15 matches
Mail list logo