Displaying 20 results from an estimated 2000 matches similar to: "Error going through the "Getting Started" tutorial"
2013 Nov 19
1
[LLVMdev] CodeGen issue with atomic_load_n
Hello,
I found some strange codegen output when playing with Clang's
implementation of GCC atomic builtins and would like to know if this is
some expected behavior or known issue.
The test case is very simple, and the disassembly can be seen here:
http://bit.ly/18LED7t
It looks to me that these instructions after the load are unnecessary, and
GCC does not generate them:
movl %eax,
2012 Feb 07
6
nested route not receiving :id parameter within controller spec
I''ve got a share method in my controller, and I have the following spec:
describe PostsController do
describe "#share" do
it "doesn''t blow up" do
post :share, :id => @post.id
end
# ... etc
And... It blows up!
Failures:
1) PostsController#share shares
Failure/Error: post :share
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
2010 Oct 07
1
Question on polymorphic association
I have 3 models . Doctor, Patient and User
with following associations
class Doctor < ActiveRecord::Base
has_many :patients, :dependent => :destroy
has_one :user, :as => :userable
accepts_nested_attributes_for :user
end
class Patient < ActiveRecord::Base
belongs_to :doctor
has_one :user, :as => :userable
accepts_nested_attributes_for :user
end
class User <
2011 Apr 30
8
"uninitialized constant PostsController::Post"
This time i read scaffold tutorial very carefully and finally try to
generate a form without using the scaffold(just used a controller and
view ).what i have done till now ,is as follow.Using rails 3.0.7.
"rails generate controller posts
index"
1) post_controller.rb
class PostsController < ApplicationController
def index
@post=Post.new
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
2013 Feb 14
1
create object after before_filter :authenticate_user!
hi
I use devise and cancan
my model
class PostsController < ApplicationController
before_filter :authenticate_user!, only: [:create, :update, :destroy]
...
end
so an unauthentificate user can access new post form. Now when
unauthentificate user submit new or edit forms, he is redirected to login
form. But when he logs in, his post is not save in database. Is there
anythings to do such
2008 Jun 02
2
Cannot log in/authenticate within RSpec Story
I''ve been slamming my head against a wall for a while now, and would
like some help. I believe this is session related.
I have a story that looks like:
--------------------------------------------------
Given that a post exists
And I am logged in
When I visit the post details page
Then there should be a link to add a new comment
2009 Oct 15
4
Getting the object in fields_for
I''m using the fields_for helper with accepts_nested_attributes_for
The System model has_many children.
If I do this in my haml template:
-form_for @system do |s|
=s.text_field :name
-s.fields_for :children do |child_fields|
=child_fields.text_field :name
all is fine. The fields_for iterates over all children and puts the
correct data in the fields.
But...what I
2013 Dec 10
2
form_tag + fields_for Rails 4
Hi There,
I''m trying to user fields_for inside a form_tag, but i can''t catch it
on my controller.
I just take some html code off to makes it easy to read
my view...
i''m using campuses_path(current_church, @campus) instead form_for
@campus, because my route is like
resources :campuses, :path => ":church/campuses"
<%= form_tag
2013 Nov 10
3
accepts_nested_attributes_for how, example
I have following tables with following models:
users(id, role_id) *has_many :entries*
categories(id, category_name) *has_many :entries*
entries(id, category_id, user_id) *belongs_to :user, belongs_to
:category, has_one :storage*
storages(id, title, content, entry_id)* belongs_to :entry*, *has_one
:vote*
votes(id, count, storage_id) *belongs_to :storage*
Now,
2010 Nov 28
6
has_one accepts_nested_attributes_for fields_for NOT WORKING HELP
MODEL
class User < ActiveRecord::Base
has_one :address, :dependent => :destroy
accepts_nested_attributes_for :address
end
CONTROL
def new
@user = User.new
@user.build_address # Adicionei
...
VIEW partial _form
....
<% f.fields_for :address do |b| %> # Adicionei
<%= b.text_field :city_manual %> # Adicionei
<% end %>
2009 May 12
2
2.3 Nested Model Forms; build new without updating existing
I''m trying to build something similar to a Facebook messaging app, in
which the view displays all the messages for a particular thread, with
a form box for replying at the bottom of the thread.
The problem is that using fields_for generates form fields for each
existing record, and for one new record. In this case, there is no
need to edit existing messages - just a need to add new
2010 Feb 25
1
accepts_nested_attributes_for vs. multiple controllers on one page
Hi,
I''d like to render the results from show, create, edit and delete
actions for several different models (one controller per model) on one
page.
While these several models are conceptually related, they do not need
to be associated with each other. So, I''d rather not impose
associations on them just to use accepts_nested_attributes_for to
facilitate their presentation in a
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 Jul 13
2
has many relationship
Can you change something in this kind of relationship, because it
works great in previous version?
NameError (uninitialized constant User::Post)
class Post < ActiveRecord::Base
belongs_to :user
...
class User < ActiveRecord::Base
has_many :posts
accepts_nested_attributes_for :posts
...
class PagesController < ApplicationController
def index
@user = User.find(6)
2010 Aug 30
1
undefined method `route_for' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:
Hello, all, I have this error with my rspec - controller - test, and
yes, I do found the thread with the same error here, but it isn''t
helped me, think it''s not my case.
i have rails -v = Rails 3.0.0.rc, rspec -v = 2.0.0.beta.18 (hope they
should match each other).
my test is here: spec/controllers/posts_controller_spec.rb and i ran
it with command: rspec
2011 Aug 04
1
Creating form for associated has_many model
This example shows how to create a form for an associated model
''Comment'', where ''Comment'' belongs_to ''Post'' and ''Post has_many
''Comments''.
http://edgeguides.rubyonrails.org/getting_started.html#generating-a-controller
How might I modify that to display all the comments in the form, and
still have it call the
2012 May 23
1
received unexpected message :id= with (20)
Please help me to understand this error message:
1) PostsController#create when logged in should create a new post and
redirect to a successful message page
Failure/Error: post ''create'', { post: {title: ''New post'',
Mock Post(id: integer, title: string, description: text,
location: string, created_at: datetime, updated_at: datetime, status:
string,