Displaying 20 results from an estimated 70000 matches similar to: "ActsAsTaggableOn scoped to Account"
2010 Aug 09
2
Auto-increment column scoped to another column
Hi,
I have one field that needs to be incremented automatically, but be
scoped to another column. So it should increment based on the last value
of the previous row with the same value of the scoped column.
I''m not trying to replace ID with another primary key or anything crazy
like that, just trying to auto-increment a database column!
Any idea of how to do this? Rails 3. Thanks!
--
2010 Nov 16
15
acts_as_taggable, undefined method 'empty?'
I''ve tried out ''acts_as_taggable'', ''acts_as_taggable_on'' and
''acts_as_taggable_on_steroids'' and all of them output "undefined
method ''empty?''" with the tag_cloud action.
I am following the guides precisely. Yet I can find no references to
this error anywhere, so I must be doing something wrong...
I am on
2012 Mar 30
1
cancan breaks scoped mass assignment
Hi all,
I just installed cancan on a new project and found out that it creates
some problems with the new scoped mass assignment features of rails 3.2
.
Basically, in my User model I create some attr_accessible attributes in
order to avoid users to edit their roles or other sensitive information.
From the administration I allow admins to edit those protected
attributes by passing
2011 Jul 14
1
RoutingError with RSpec Controller test on Scoped Route
So I have a route that looks like this:
scope "4" do
scope "public" do
scope ":apikey" do
resources :shops
end
end
end
And a bunch of controller specs, an example of which looks like this:
describe ShopsController do
describe "when responding to a GET" do
context "#new" do
it "should create a new instance
2012 Apr 13
0
Scoped attr_accessible not working?
Please refer to the ActiveModel MassAssignmentSecurity api<http://api.rubyonrails.org/classes/ActiveModel/MassAssignmentSecurity/ClassMethods.html>for this.
I''m on Rails3.2.3/Ruby1.9.3 and trying to use that technique in the
controller as described. It is supposed to dynamically restrict the
attributes that can be mass assigned. However, sanitize_for_mass_assignment
is ignoring
2010 Aug 05
3
how to ? Rails 3 ActiveRecord eager loading and AREL
Hello everyone,
I would like to eager load scoped records to avoid queries executed in a
loop (huge performance impact).
The "scoped" part is what is giving me a hard time.
I''m using Rails3 RC.
Does anyone have any idea how I can do it?
Here is a test case : we have an "Article" and a "Comment" Activerecord
models,
article has many comments
comment
2011 Jun 04
1
rails 3 engine under dynamic scope
hello,
i have a rails 3 engine scoped dynamically like this:
scope "/:locale" do
mount MyEngine::Engine => '''', :as => ''my_engine''
end
I can''t seem to be able to set my own locale like this:
my_engine.page_path(page, :locale => ''de'')
the path is generated like this:
/en/page/12345?locale=de
instead of
2011 Oct 05
0
Optional Dynamic Prepended Route via scope
Hello,
Say I have the following in my routes file:
scope "(/:organization)" do
resources :systems, :except => [:destroy] do
member do
get :packages
end
end
end
resources :dashboard do
collection do
get :notices
end
The organization can be changed by the user and various resources such
as systems are scoped off of the organization. So, the
2010 Sep 23
6
Named scope in named scope ??
Hi,
I would like to return a combination of named scopes in a named
scope :
For example, I have a named scope filter and I want to add a named
scope eval_filters like
Product.eval_filters([''x'',''y'',''z'']) is equivalent to
Product.filter(''x'').filter(''y'').filter(''z'')
Anybody know how can I
2011 Sep 13
4
Changing adapters in ActiveRecord does not change the generated sql
If I establish a new connection with a new adapter (ie. switch from mysql to
postgresl) the generated sql is still mysql specific. I tried all sorts of
reset methods on AR::Base but to no avail. There must be something being
memoized on ActiveRecord base that has to do with the adapter and it doesn''t
get cleared when you establish a connection with a new adapter.
I know this
2010 Feb 23
1
Rails on Snow Leopard
In particular, if you''re putting Rails on Snow Leopard to work on a
project that you started on Linux.
If you run rake db:create and see an error like this:
Couldn''t create database for {"reconnect"=>false, "encoding"=>"utf8",
"username"=>"root", "adapter"=>"mysql",
2010 Jun 24
1
Custom account subdomains with Rails 3
Hi,
I needed to handle custom account subdomains with Rails and I wrote a
simple rack middleware for that http://github.com/drogus/rack-subdomain.
It works by mapping any subdomain to given PATH. For example when user
hits drogus.example.org/account and mapping is /users/:subdomain, it
will map the request to example.org/users/drogus/account
I accomplished it with rack middleware, cause I wanted
2010 May 31
2
has_many and has_and_belongs_to conflit
Hi,
I have 2 models: User and Article.
I have this relationship:
* User has many articles (and Article belongs to user)
* User has and belongs to many articles (and Article habtm users)
But this is tricky because of: current_user.articles ...this can return
articles thanks to *has_many* and *has_and_belongs_to* relations. So
there''s a collision.
How can I ask articles thanks
2011 Aug 21
0
problem with typo6.0.8
hi all
i am using typo6.0.8 in rails3..
when i click on articles tab of typo admin page in browser.. i get the
following error.. and all the remaining tags are working fine.
undefined method `gsub!'' for 2011-08-21 06:28:15 UTC:Time
Extracted source (around line *#34*):
31: %></td>
32: <td><%= collection_select_with_current(:search, :user_id,
User.find(:all),
2011 Feb 11
1
accept_nested_attributes, reject_if doesn't work.
class Post < ActiveRecord::Base
validates :name, :presence => true
validates :title, :presence => true,
:length => { :minimum => 5 }
has_many :comments, :dependent => :destroy
has_many :tags
accepts_nested_attributes_for :tags, :allow_destroy => :true,
:reject_if => proc { |attrs| attrs.all? { |k, v| v.blank? or v.nil? } }
end
rails c
2011 Aug 17
1
has_many :through, collection<<(object) and duplicates.
Hi,
I''m facing a strange behavior in Rails with the has_many association and
the generated collection<<(object, ...) method that comes along.
I''ve got an Object model and a Tag model, plus a taggings table to join
the two together.
On Object, I set these associations:
has_many :taggings, :as => :taggable, :dependent => :destroy
has_many :tags,
2010 Jan 05
2
Conditional named_scope chaining with params (Need help)
Hello there,
I have a model that has more then one named_scope.
In my action Index of the controller that handle this model I want to do
this in a drier way:
if params[:ownership] == "mine"
@posts = Post.tagged_with(params[:tags], :on =>
:tags).owner(current_user.id).paginate :all, :page => params[:page],
:order => ''created_at DESC''
else
2013 May 27
3
Ransack, acts-as-taggable-on and checkboxes in search form
need some help on ransack filtering.
I have model Project, which has many tags through acts_as_taggable gem.
Project.rb:
class Project < ActiveRecord::Base
include PublicActivity::Common
belongs_to :customer
belongs_to :category
has_many :attachments, :as => :attachable
has_many :reports, :dependent => :destroy
has_many :messages, :dependent
2010 Mar 27
2
Shorter Rails 3 routes
Hi,
I have a small blog application, and I would like to shorten its routes.
Here they are:
Blog::Application.routes.draw do
resources :categories do
resources :articles do
resources :comments
end
end
A rake routes command produce the following lines:
GET
/categories/:category_id/articles/:article_id/comments(.:format)
2010 Feb 06
1
accepts_nested_attributes_for with has_many => :through
I have two models, links and tags, associated through a 3rd model,
link_tags. I added the following to my link model,
has_many :tags, :through => :link_tags
has_many :link_tags
accepts_nested_attributes_for :tags, :allow_destroy => :false,
:reject_if => proc { |attrs| attrs.all? { |k, v| v.blank? } }
and put this in a partial called by the new and edit forms for links,