Displaying 20 results from an estimated 1100 matches similar to: "Addition to has_many - a ':source_scope' option"
2011 Sep 15
1
bypass defualt scope.
class Shop < ActiveRecord::Base
has_many :documents, :dependent => :restrict
end
class Document < ActiveRecord::Base
belongs_to :shop
default_scope :order => ''updated_at DESC''
end
in the Shop show view I have:
- for document in @shop.documents
%li(id="shop_documents")= link_to document.subject,
shop_document_url(@shop, document)
I want list
2012 Nov 29
3
Proposal: faragment cache with :if / :unless conditions
Hi,
I''m wondering if it would be a good idea to have fragment cache to allow
options :if / :unless to determine whether or not to actually perform
caching on the given block.
It would actually be a good idea in my opinion right now, since I''m working
on a piece of code that would benefit by this feature.
The scenario is the following:
I have a partial, which is
2013 Apr 15
4
Rails' scaffold controller generator - should it test json format also?
(Forgive me if this is incorrect, because I recognized this initially as
something in Rails 4.0.0.beta1 and have just done a cursory look over the
latest generator code.)
Noticed in Rails 4 that the test generated for a scaffold controller only
tests the html format instead of both html and json:
2012 Oct 26
7
How to use Ajax with rails ?
Hi all,
Can any one tell me how to use Ajax with Rails.
Send me quick start up link and videos.
Thanks
Regards
Fahim Babar PAtel
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this
2011 Jul 11
6
Unicorn vs Apache
Hello all,
I have always deploys rails apps with unicorn and nginx as a reverse
proxy in the past. However, I am working with a new firm and they would
like to use Apache with mod_pagespeed in front of unicorn.
We will be deploying a rails 3.1 app with streaming. To me,
mod_pagespeed does not seem like a magic bullet, as it appears to be a
collection of best practices which have to be rewritten
2007 Sep 21
3
multi_score?
Hi!
I''m using acts_as_ferret in my rails project and i need to order the
search results by a combination of the result given by ferret (score)
and a ranking in the database (normalized also). this combination can be
like that:
0.4*ferret_score+0.6*database_score
this database_score is also indexed
any idea?
and someone know how to access the ferret data in the object returned by
2007 Sep 24
2
ferret fuzzy matches
Hi guys,
Is there some way of getting ferret matches string, when i do a fuzzy
search?
The scenario is this:
1. The user search for ''show''
2. Nothing was found
3. So I do a fuzzy search, passing ''show~''
4. It gives me somes results, most of all was matched with ''showcase''
5. So I want to tell the user that: Nothing was found with
2011 Oct 11
3
Want to implement APIs in Rails.
Hi, I want to write APIs for my rails 3.1 application but have never
written an API ever. I am supposed to write REST and SOAP APIs. Is
there a formal book or e-book or screencasts or tutorials which
teaches about APIs in Rails and best practices?
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email
2012 Mar 12
4
how to design a api?
hi,everyone.
now i start to design a api.
the url like this
http://localhost:3000/api?seckey=123&&post_id=1
the visitor need a seckey to access auth.and get info via json.
so i dont think thats a good api.
i need your answers.thx
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2006 Feb 17
0
Load Balance/Backup
Helo,
Good Morning,
Im have many problems with load balance/backup,
In test made with lartc.org scripts, the balance not work 50/50 , and
when i down the link, the internet comes down. I need a Balance like
Round Robin, and when one link comes down, the internet not stop.
In my mini-lab i have 2 links adsl,
3 ethernet card 2 for links and one for lan
my links using DHCP for get configuration.
2012 Aug 13
10
Question about PATCH method, accepts_nested_attributes_for, and updates to association lists (has_many, HABTM)
Am interested in the new PATCH method that will be included in Rails 4, but
have a question/concern, and forgive me if I''m misunderstanding it.
So, if the request parameter _method is set to "patch", the update is
processed as a patch.
But, let''s say you have a model called Airplane and Airplane has a
collection of FlightCrewMembers which it
2006 Nov 21
5
acts_as_ferret with STI models
Can acts_as_ferret search only one of the inherit models in the
hierarchy of STI models? Say you have Contents, with types articles and
comments. I know that you do Contents.find_by_contents, but can you
also create indexed for Comment and Articles?
Thanks for you help
Miguel
--
Posted via http://www.ruby-forum.com/.
2013 Jan 08
4
[LLVMdev] LTO "bug" and Clang warnings
On 8 January 2013 16:53, David Blaikie <dblaikie at gmail.com> wrote:
> I'm not sure what you mean by "fix user's stupidity" here - could you
> clarify?
>
Buffer overrun on foo[20] and relying on it for bar[20].
It might not even be an error to access foo[50] even though foo only has 20
elements (via pointer indirection rules), but it's user error to do so,
2010 Sep 13
0
unscoped option for associations?
Hi all,
I recently encountered a problem in my FriendlyId plugin where a
belongs_to association unexpectedly failed to load because a user was
using state_machine and a default scope to make only "active" records
return by default.
It seems logical to allow associations to be specifed as "unscoped" in
order to bypass any default scopes. Conceptually I see this as similar
to
2011 Feb 02
6
how to set default_scope for the whole application?
I know I can set default_scope for individual active record model, but
can I set one up for the whole application?
thanks
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
2013 Jun 15
1
A puzzle about default_scope
Hi, guys
I have a puzzle about default_scope.
Suppose I have two model:
class User < ActiveRecord::Base
has_many :blogs
default_scope where(deleted_at: nil)
end
class Blog < ActiveRecord::Base
belongs_to :user
end
I want to produce sqlselect blogs.* from blogs inner join users on users.id
= blogs.user_id and users.deleted_at is null
And the code Blog.joins(:user), which I think
2007 Dec 03
18
Need help mocking this out
Let''s say you''re using the restful_authentication plugin.
You have a model called articles. On the index action of the
articlescontroller you simply want to spec out that it''ll scope the results
to the ownership of the current_user.
It should NOT include any articles other than the articles that user owns.
How would you properly spec this out?
Thanks for the help!
2009 Jul 23
11
Problem with named_scope
Here are my scopes:
default_scope :order => ''posted_on DESC'', :conditions => { :status =>
''visible'' }
named_scope :positive, :conditions => { :rating => ''positive'', :status
=> ''visible'' }
named_scope :neutral, :conditions => { :rating => ''neutral'', :status
=>
2013 Apr 08
1
cattr_accessor and Thread.current prblems
Hello,
I am trying to convert three applications to multitenant, all of them have
same structure difference is only in little functions and template designs.
All of them using cattr_accessor for setting currencies and other data, and
it works perfectly
Now i added app_id as cattr_accessor to App model to use it in
default_scope to implement multi-tenancy
class App < ActiveRecord::Base
2009 Jul 11
2
offeride :limit named_scope default_scope
Hi,
Rails 2.3.2
class TestD < ActiveRecord::Base
default_scope :limit => 12
named_scope :limit, lambda { |num| { :limit => num} }
end
ruby script/console
>> TestD.all
TestD Load (0.7ms) SELECT * FROM "test_ds" LIMIT 12
=> []
>> TestD.limit(14)
TestD Load (0.3ms) SELECT * FROM "test_ds" LIMIT 12
=> []
Any ideas why the default limit