Displaying 20 results from an estimated 20000 matches similar to: "Need help in changing data in production."
2013 Jul 11
1
Do I Edit the Migration Too to Show the Belongs To
Hi Everyone,
Do I edit the corresponding migration also to show the belongs_to (and the
has_many)? I have a many to many relationship where I am using the
"has_many :through" association. When I place in the individual classes the
''has_many :through'' and the ''belongs_to'' associations, do I also edit the
corresponding migrations to reflect those
2013 Jan 15
7
javascript flash messages gem?
Does anybody knows a gem for managing flash messages? I would want to
add messages to the flash div in the client. Bootstrap support is a plus.
--
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,
2010 Aug 18
6
Once I added this HABTM, one of my 'through' relationships, on a non-habtm model, seems to have broke?
I''m a rails newb and have been Googling about this, but I''m still stumped.
Not showing everything here, but basically it should be a pretty common
setup so I''m sure others know what I''m doing wrong.
- A meter can belong to many meter_groups
- A meter_group can have many meters.
- A user can ''subscribe'' to viewing a meter_group (Subscription)
2012 May 04
3
Database schema question
Im setting up a very basic rails app and have a question about the needed
migrations & associations.
Basically, my app is an occasion reminder service that emails users when
occasions that they select or input are coming up.
Occasions will be selected from a checkbox type list or alternatively
manually input by the user (name and date of the occasion).
Users can have_many occassions.
2010 Aug 19
1
has_many :through question
I am trying to create an association table using the ":through" option
in "has_many" but not having success. I have created the necessary
migrations of the association tables and run rake db:migrate
I have the following model:
class Group < ActiveRecord::Base
has_many :users, :through => :group_user
has_many :invites, :through => :group_invite, :class_name =>
2010 Oct 11
8
Nooby Stuck - "has_and_belongs_to_many" relationship
trying to set up a "has_and_belongs_to_many" relationship
would very much appreciate the help, not sure what im doing wrong at all.
Scheme.rb
class Scheme < ActiveRecord::Base
validates :schemename, :presence => true
belongs_to :user
has_many :levels, :dependent => :destroy
has_and_belongs_to_many :works
end
Work.rb
class Work < ActiveRecord::Base
2011 Jul 26
1
ActiveRecord has_many associations
Given the models Country, State, City and Person as follows.
class Country < ActiveRecord::Base
has_many :states
end
class State < ActiveRecord::Base
belongs_to :country
has_many :cities
end
class City < ActiveRecord::Base
belongs_to :state
has_many :people
end
class Person < ActiveRecord::Base
belongs_to :city
end
Is there any way that doesn''t allow to delete
2010 Nov 11
5
ActiveRecord query
I have these sql code in postgresql
"SELECT * from convenios where id NOT IN
(SELECT convenio_id from solicituds where usuario_id=?"
but don''t find a way of used it in rails
except
find_by_sql.
There is a another way??
class Usuario < ActiveRecord::Base
belongs_to :persona
has_many :solicituds, :dependent => :destroy
has_many :convenios, :through =>
2012 Jan 18
2
Polymorphic and standard association issue
Hello all,
I''m having a strange issue with a model that belongs_to two other
models. The one association is polymorphic and the other is normal.
================================
class Role < ActiveRecord::Base
belongs_to :user
belongs_to :permission, :polymorphic => true
end
class User < ActiveRecord::Base
has_many :roles
has_many :programs, :through => :roles
end
2013 May 13
1
RAILS GET IDS
I don''t know how to solve something about a project I''m doing in Ruby on
Rails.
I want to save the IDS of my 3 models to my table DETAILS between these,
my BD is Mysql.
ASIGNATURAS--MALLAS--NIVELS-------->ASIGNATURA_ID--_MALLAS_ID--_NIVELS_ID
In the view MALLA, i list my asignaturas, mallas and niveles, and in the
controller MALLA i want to save the arrays to my model
2011 Sep 04
2
has_many :through basic fubar
I''m trying to do, what seems like, a very basic join. However, the
association just doesn''t seem to work. I''m sure it''s something very
simple but I don''t know what.
class Role < ActiveRecord::Base
belongs_to :packages
belongs_to :users
end
class Package < ActiveRecord::Base
has_many :roles
has_many :users, :through => :roles
end
2010 Dec 30
3
rake db:seed with has_many through (m:n with seperate table)
My model consists of users and tasks (m:n), the relation is stored in a
seperate table sharedtabs (that contains some extra fields).
Between tabs and tasks there is a 1:n relation.
I have trouble writing my seed.rb:
works: (1)
tab = Tab.create(:name => ''Admin'', :category => 0)
tab.tasks.create(:name => ''Admin_Tab1_Private Task 1'')
works: (2)
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
2011 May 31
1
Geokit query with multiple models involved
Hello,
My database structure consists of Store, Book, BookStore and Address
as below.
class Store < ActiveRecord::Base
has_many :book_stores
has_many :books, :through => :book_stores
has_many :addresses
acts_as_mappable :through => :addresses
end
class Address < ActiveRecord::Base
belongs_to :store
acts_as_mappable
end
class Book < ActiveRecord::Base
has_many
2010 Sep 29
2
Railroad problem with :through?
I have the following model layout:
class List < ActiveRecord::Base
has_many :subscribers, :through => :list_subscribers
has_many :list_subscribers
end
class Subscriber < ActiveRecord::Base
has_many :lists
has_many :lists, :through => :list_subscribers
end
class ListSubscriber< ActiveRecord::Base
belongs_to :list
belongs_to :subscriber
validates_uniqueness_of :subscriber_id,
2007 Apr 11
4
machine authentication at Active Directory
On a 802.1X environment, it's possible to permit a windows
desktop gain access to the network by using only machine
authentication at the Active Directory (no need for login +
password).
Is it possible to do the same with a Linux desktop with samba? I
mean a Linux desktop pass machine credentials to Active Directory
as windows do (SID), without any login and password.
--
Otto Fuchshuber
2013 Mar 25
1
validates presence of foreign key fails in nested form
I''m using accepts_nested_attributes as follows:
class Timesheet < ActiveRecord::Base
attr_accessible :status, :user_id, :start_date, :end_date,
:activities_attributes
has_many :activities, dependent: :destroy
has_many :time_entries, through: :activities
accepts_nested_attributes_for :activities, allow_destroy: true
end
class Activity < ActiveRecord::Base
attr_accessible
2010 Aug 29
4
Wrong class being returned in association
I''m using Rails 3.0.0rc and have the following models:
class User
has_many :readings
has_many :conversations, :through=>:readings
end
class Reading
belongs_to :user
belongs_to :conversation
end
class Conversation
has_many :readings
has_many :users, :through=>:readings
end
and this controller code:
class ConversationsController
def show
@user =
2010 Jun 03
2
creating fixtures for has_many :through
I''m stymied at how to create a fixture that establishes a has_many
:through relationship.
I''ve watched the railscast at:
http://media.railscasts.com/videos/081_fixtures_in_rails_2.mov
... but that''s for HABTM relationships. I''ve read:
http://www.ruby-forum.com/topic/145676
but that ultimately doesn''t answer any question. So with no further
ado:
2010 Jan 27
2
has_many, through with nested models?
First the data model:
class Forum < ActiveRecord::Base
has_many :topics, :dependent => :destroy, :order => ''created_at
desc''
end
class User < ActiveRecord::Base
has_many :topics, :dependent => :destroy
has_many :comments, :dependent => :destroy
has_many :replies, :dependent => :destroy
end
class Topic < ActiveRecord::Base
belongs_to