On Nov 8, 2013, at 11:41 AM, johnnybutler7 <johnnybutl...@gmail.com> wrote:

> Hi Guys,
> 
> Strange issue going on, cant get to the bottom of it.
> 
> I have a bog standard form which submits to the create action fine.  If the 
> validation fails however the new action is rendered with the appropriate 
> errors,
> however in the logs i notice the index action is called silently and I can 
> see the trace of sql, see below:
> 
> controller code
> 
> def create
>     @discussion = Discussion.new
>     @discussion.assign_attributes(params[:discussion].merge(created_by_id: 
> current_user.id), :as => :admin)
>     respond_to do |format|
>       if @discussion.save
>         format.html { redirect_to discussion_path(@discussion), notice: 
> "Discussion was successfully created."}
>       else
>         format.html { render 'new' } 
>       end
>     end
>   end
> 
> Started POST "/discussions" for 127.0.0.1 at 2013-11-08 17:35:29 +0000
> Processing by DiscussionsController#create as HTML
>   Parameters: {"utf8"=>"✓", 
> "authenticity_token"=>"Xmxr58tjF1TEUUWFL+u3/VNzl/1HM83kAeD60LieP/0=", 
> "discussion"=>{"title"=>"", "body"=>"", "user_ids"=>[""]}, "commit"=>"submit"}
> [1m [36m (2.3ms) [0m   [1mBEGIN [0m
>   [1m [35m (2.2ms) [0m  ROLLBACK
> blah blah.....
> Rendered discussions/new.html.erb within layouts/launchpad (50.5ms)
> Completed 200 OK in 362.0ms (Views: 274.6ms | ActiveRecord: 78.1ms)
> 
> Started GET "/discussions" for 127.0.0.1 at 2013-11-08 17:35:30 +0000
> Processing by DiscussionsController#index as HTML
>   [1m [36mUser Load (3.4ms) [0m   [1mSELECT "users".* FROM "users" WHERE 
> "users"."id" = 8 LIMIT 1 [0m
>   [1m [35mContext Load (2.4ms) [0m  SELECT "contexts".* FROM "contexts" WHERE 
> "contexts"."id" = $1 LIMIT 1  [["id", "2"]]
>   [1m [36mRole Load (4.3ms) [0m   [1mSELECT "roles".* FROM "roles" WHERE 
> "roles"."name" = 'PC_USER' LIMIT 1 [0m
>   [1m [35mRole Load (3.8ms) [0m  SELECT "roles".* FROM "roles" 
>   Rendered admin/shared/_quick_links.html.erb (2.1ms)
>   [1m [36mDiscussion Load (3.6ms) [0m   [1mSELECT DISTINCT discussions.* FROM 
> "discussions" INNER JOIN "discussions_users" ON 
> "discussions_users"."discussion_id" = "discussions"."id" INNER JOIN "users" 
> ON "users"."id" = "discussions_users"."user_id" WHERE (created_by_id = 8 OR 
> discussions_users.user_id = 8 OR users.account_id = 1) [0m
> 

The clue might be in what is being rendered in the second request:

>   Rendered admin/shared/_quick_links.html.erb (2.1ms)

Maybe an AJAX request?


-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/E1EBDBCD-A125-42CF-A4DB-8224CBDF9860%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to