Displaying 20 results from an estimated 100 matches similar to: "Exended modules and reject_if in nested_attributes"
2009 Jun 20
0
[Rails 2.3] nested_attributes and validation of nested model
Hi,
I''m using nested models to create form in my view. It looks like this:
<% form_for :user, :url => {:action => "add_owner" }, :html => {
:method => :post } do |u| %>
<li><label>Name: </label><%= u.text_field :name %></li>
<li><label>Surname: </label><%= u.text_field :surname %></li>
<%
2009 Jun 24
1
accepts_nested_attributes_for :reject_if issue
I have the following models:
class Order < ActiveRecord::Base
belongs_to :billing_address
belongs_to :shipping_address
accepts_nested_attributes_for :billing_address
accepts_nested_attributes_for :shipping_address, :reject_if => proc {
|attributes| attributes[''has_shipping_address''] != ''1'' }
def after_initialize
self.build_billing_address
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
2013 Feb 10
0
Nested attributes doesnt get updated
Hi
Am building a nested form and my code works fine with sqlite3 but throws
errors when using Oracle during update action.
Am getting the following error:
ActiveRecord::RecordNotFound in AWRequestsController#update
Couldn''t find WADetail with ID=5000000015 for AWRequest with ID=5000000022.0
Request
*Parameters*:
{"utf8"=>"✓",
2011 Mar 01
6
render :collection calling partial with phantom object?
I have two models with a straightforward has_many / belongs_to
relationship:
class Premise < ActiveRecord::Base
has_many :metered_services, :dependent => :destroy
...
end
class MeteredService < ActiveRecord::Base
belongs_to :premise
...
end
and nested routes to match:
Demo::Application.routes.draw do
devise_for :users
resources :premises do
resources :metered_services
2008 Oct 03
1
Improvements for rails development on linux with gedit
Hi,
For those linux and gedit users, here I have some improvements:
Smart Indent
Syntax Color Improved
Extract Partials, and some more plugins
http://alexandredasilva.wordpress.com/gmate
and
http://alexandredasilva.wordpress.com/2008/10/02/exended-ruby-syntax/
att
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
2016 Apr 18
4
Permission denied on GPT.ini (Event ID 1058)
Ok, try this.
Gif the pc a uid and check again.
If it works then, its a share or security right.
Gpupdate /force works because at that point you "user"/user has a uid and gid.
The error occurs at start up because the COMPUTERNAME$ doent have access to that gpt.ini.
Resetting sysvol in that case doent help because the right on the gpt.ini is set by the group you assigned to the
2010 Nov 11
2
Rails 3 - Nested Forms, using Builder -- Check_box issue
Hello, I have the following:
My Controller:
def new
.
.
@teammembers.each do |teammember|
request = @request_thread.requests.build(:recipient_id =>
teammember.user_id, :full_name => ''Billy Bob T'')
end
My View:
.
.
<%= f.fields_for :requests do |builder| %>
<div class="field">
<%= builder.label
2010 Dec 09
2
Skip validation on nested attribute
Hi,
I have a two models, advert and address.
An advert has one address.
On my advert form I have a nested form of the address. But I only want
to create the nested address depending on the adver kind.
how can I skip the nested attribute validation?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2013 Mar 30
1
How to use group in nested associations
The below query fails:
Timesheet.joins(:time_entries).select("timesheets.*,
sum(time_entries.worktime) as total").group("timesheets.start_date")
The models have the following relations:
Timesheet < AR
has_many :activities, dependent: :destroy, inverse_of: :timesheet
has_many :time_entries, through: :activities
accepts_nested_attributes_for :activities,
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 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,
2009 Nov 06
0
Nested objects not propagating from view
I thought I had this fixed, but apparently not. It works okay from the
console, but not from the view. I have the following:
# partial schema
create_table "users", :force => true do |t|
t.string "login", :null => false
t.string "first_name"
t.string "last_name"
t.string "email", :null => false
2016 Apr 18
0
Permission denied on GPT.ini (Event ID 1058)
Ok,
> I don't think so, I launch gpupdate using local admin account, so as I
> understand it, only computer account is used (since local admin as no
> existence on the domain)
Why a local admin, please use a ?domain admin? ..
Test as follow.
Open de security tab of the GPT.INI.
Advanced settings, last tab, effective settings,
At objecttype, deselect all, select
2010 Aug 04
1
Samba and ZFS
Hi,
I've recently moved our student fileserver from a Solaris 10 server
that was using UFS filesytems to a new Sun Cluster. As part of the move
I decided to employ ZFS for the filesystem so that I could take
advantage of some of ZFS's features. However, it now seems that windows
does not report the amount of space that the user is actually using, or
the amount of quota left,
2011 Feb 08
0
Sorting by inner has_many through attribute
Hello everyone,
For this model:
class User < ActiveRecord::Base
has_many :component_users, :dependent => :destroy
has_many :components, :through => :component_users, :conditions =>
[''components.active = ?'',true]
accepts_nested_attributes_for :component_users, :reject_if => lambda
{ |a| a[:components].blank? || a[:components]
[:name].blank? },
2011 Sep 27
0
accepts_nested_attributes_for is not working for uniqueness
class User < ActiveRecord::Base
accepts_nested_attributes_for :emails, :allow_destroy => true,
:reject_if => proc { |attributes| attributes[''address''].blank? }
end
class Email < ActiveRecord::Base
belongs_to :user
validates_presence_of :address
validates_email_format_of :address
validates_uniqueness_of :address,
2009 Mar 13
1
Problem saving nested attributes for has_many associations (Rails 2.3 RC2 and Edge)
I''ve tested this on both 2.3 RC2 and Edge. This pastie contains
model, helper and view: http://pastie.org/415742
When I save a vocabulary - its terms don''t save. I''m fairly sure it
worked in RC1. Would appreciate any insight.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on
2013 Mar 04
0
fields_for with accepts_nested_attributes: how to pass a value to a label
I can''t figure out how to pass a value from the following object build in
the controller:
class TimesheetsController < AC
...
def new
@timesheet = current_user.timesheets.new
now = Date.today
#generating 7 time entries: monday through sunday
(now.beginning_of_week..now.end_of_week).step { |date|
@timesheet.time_entries.build(:workdate; date)
end
end
...
In the
2009 Oct 05
1
Re: creating 2 things at the same time?
Hi Mike Chai
What I understood is you have relations like
comment has_one picture
picture belongs_to comment
As an example
comment name:string
picture name:string,comment_id:integer
So do as below
in comments_controller new action
@comment = Comment.new
@comment.picture = Picture.new
Now in view/comments/new.html.erb
<% form_for(@comment) do |f| %>
<p>
<%=