search for: postscontrol

Displaying 20 results from an estimated 48 matches for "postscontrol".

2008 Jun 02
0
Rails 2.1 - when PostsController is present, creating Admin::PostsController fails
Hi, just found out small problem with Rails 2.1. If I run a "script/generate scaffold post title:string" that creates PostsController and later want to make admin controller for it by running "script/generate controller admin/posts", Rails complain that: "The name ''Admin::PostsHelper'' is either already used in your application or reserved by Ruby on Rails." It worked fine in 2.0.2. --~--~...
2011 Apr 30
8
"uninitialized constant PostsController::Post"
...d 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 end def create @post = Post.new(params[:post]) respond_to do |format| end end end 2)index.html.erb <h1>Posts#index</h1> <p>Find me in app/views/posts/index.html.erb</p> <%= link_to ''New P...
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 ActionController::RoutingError:...
2008 Jul 07
3
How to get a users screen name into a hidden field in a PostsController action?
Instead of the user entering a name, I want to pass their screen name along with supplied :title and :content fields. here is what I''ve got.. f.hidden_field :author, user.screen_name here is the create method from Posts controller: def create @title = "Gravity" @user = User.find(params[:id]) # this does not work, and I don''t know why if request.post?
2009 Feb 24
2
Error going through the "Getting Started" tutorial
Hi, I get this error on step 9 of the Getting Started tutorial: NoMethodError in PostsController#index undefined method `accepts_nested_attributes_for'' for #<Class: 0x23fbc48> Does someone know if it''s a bug? Cheers, Beren --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on...
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 i...
2008 Jun 02
2
Cannot log in/authenticate within RSpec Story
...I make directly seem to be lost. Questions: 1. Can controllers within rspec stories set/get session data? 2. What is the scope of the persistence of sessions in rspec? (Scenario? Story?) 3. Any ideas on why my LoginController sets the session[''username''] variable, only to have my PostsController unable to read it? Also, keep in mind that the code works when I''m actually using the site, but the rspec story fails because it''s not displaying an "Add New Comment" link when it should be due to the PostsController thinking that the user isn''t logged in. -...
2006 Mar 04
4
Submitting data to two different tables with two different models
I''m very new to Rails. I''ve been reading Agile Web Dev for a while and read up on ruby, but I''m still learning. I designed a website for someone for an engineering shop. New projects had to be added manually. Well, I figured this would be a great canidate for railifying! I have the form working perfectly, you can add your data and get it in a table, and listing
2006 Dec 10
5
model-controller-paradigm: What about admin controllers?
Hi all We all know the model-controller-paradigm: I have a model "News" which has a corresponding CRUD-controller "NewsController". But now I''m quite unsure about the following... Guess we have normal visitors that visit our site www.??.com/news and we have administrators that create and modify news items. The admin should see an "Edit" link and a
2012 Apr 09
8
Rails Functional Testing Problem
...which would mistakenly be 4 -- if you really wanted the id of nil, use object_id app/controllers/posts_controller.rb:11:in `create'' posts_controller_test.rb:5:in `test_should_create'' Here is my test file require File.dirname(__FILE__) + "/../test_helper" class PostsControllerTest < ActionController::TestCase def test_should_create post :create, :post => { :message => ''Sausage and Egg Sandwich''} end end Here is my controller class PostsController < ApplicationController def index @posts = Post.all(:order => "created_at D...
2005 Dec 17
0
No javascript fallback
...good for a lot of things, but javascript is not always available. I think the new RJS templates are very good: http://www.codyfauser.com/articles/2005/11/20/rails-rjs-templates And they could be used to create a simple, automatic no javascript fallback. An example: You have a controller called PostsController. There is an action "new". The view displays a form. The form will be submitted to the "create"-action using AJAX, and if the user doesn''t have javascript enabled, it will be submitted to the create action anyway. It looks like this: class PostsController < A...
2010 Aug 30
1
undefined method `route_for' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:
...ve 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 spec/controllers/posts_controller_spec.rb. after all, test is: require ''spec_helper'' describe PostsController do render_views describe "route generation" do it "should be successful" do @post = Post.new(:title => ''blalbla'', :name => ''adfsdfsdf'') @post.save route_for(:controller => "posts", :action =>...
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, upda...
2007 Jul 06
0
Removing One Element From a Serialized Form
...;).serialize(true)}); return false;">(Save)</a></li> Ajax request goes through (a post (with the put method appended) is sent to /posts/1) and the update.rjs file is called. Life is good so far. In the development log this is shown (removed Session ID for brevity): Processing PostsController#update (for 127.0.0.1 at 2007-07-03 18:53:46) [PUT] Parameters: {"commit"=>"Publish", "post"=>{"title"=>"asdfasdfadfaf", "body"=>"afdasdf", "tag_list"=>"", "teaser"=>"ads...
2007 Jul 31
0
Edit not working with named routes
...updated my controller to take advantage of the named routes that were generated. I also updated all of my views and everything was working nicely. Except when I try to edit an existing post. For some reason it just doesn''t want to do anything. Below are the relevant (I think) parts of the PostsController: class PostsController < ApplicationController layout "blog" before_filter :login_required, :except => [:index, :show] before_filter :find_post, :except => [:index, :new, :create] def edit end def update if @post.update_attributes(params[:post]) flash[...
2009 Apr 25
0
'get_user_list' function not working
...working..?? tis s user.rb ( def full_name self.first_name + " " + self.last_name end ) my post controller ( def get_user_list return User.find(:all, :order => ''last_name ASC'').collect {|user| [user.full_name, user.id]} NameError in PostsController#edit undefined local variable or method `get_user_list'' for #<PostsController:0x47c8360>
2011 Aug 04
1
Creating form for associated has_many model
...9;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 CommentsController (versus having the form call the PostsController, as in the example here http://railscasts.com/episodes/17-habtm-checkboxes)? 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...
2013 Jan 12
1
showing posts in blog
When I make a new post in my blog, it returns this when I try to view my current posts: --------------------------------------------------------------------------- ActiveModel::MassAssignmentSecurity::Error in PostsController#create Can''t mass-assign protected attributes: text Rails.root: C:/Users/Josh Koloff/Desktop/Programming Stuff/Rails Stuff/blog Application Trace | Framework Trace | Full Trace app/controllers/posts_controller.rb:43:in `new'' app/controllers/posts_controller.rb:43:in `create&...
2009 Jul 20
2
Hitting unknown error with "can't dup NilClass"
...posts has_many :comments end class post belongs_to :user has_many :comments, :as => :commentable end class comment belongs_to :post belongs_to :user end For this case, I am trying to retrieve each post''s comment together with submitter username and I write as below: class PostsController<ApplicationController def show raise @post.comments.first.user.inspect end end While the first time I run this script, it works fine. But, after I hitting a refresh, it hits following problem "can''t dup NilClass". It is repeats the same for everytime i restart mo...
2011 May 09
0
rails guides - getting started - section 10 security
The example doesn''t work as described for me; not sure if I haven''t followed it right, or there''s a problem with the code. Can someone help me to determine what the problem is. Specifically, after adding the authentication code to the PostsController, with this line: before_filter :authenticate, :except => [:index, :show] The guide says that "we want the user to be authenticated on every action, except for index and show", however, it only authenticates on the new post and edit options; it doesn''t authenticate on dest...