Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6760551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:04:38+00:00 2026-05-26T14:04:38+00:00

I am having a ruby on rails application.I added a new section called reports

  • 0

I am having a ruby on rails application.I added a new section called reports to the application. It has no model but a controller and many forms in the views folder.
The functionality is working as desired.
The problem I am facing facing is on clicking the submit button, the user who is signed in is signed out automatically.

My code is :

Reports Controller:

    class ReportsController < ApplicationController
    def index
    @projects=Project.find(:all)
    @releases=Release.find(:all)
    @cycles=Cycle.find(:all)   
    report_type=params[:report_type]
    if report_type=="1" && params[:cycles]     
    @cycle=Cycle.find(params[:cycles])
    @ics=@cycle.ics     
    puts " report_type===#{report_type}"
    end
    end


    def  update_releases 
     puts "inside releases"
     project = Project.find(params[:project_id]) 
@releases = project.releases
respond_to do |format| 
format.js 
end
end


def update_cycles 
puts "inside update_cycles"
release = Release.find(params[:release_id]) 
@cycles =release.cycles
respond_to do |format| 
format.js    
end 
end 
end

In index.html.haml :

-set_title "Reports"
-content_for :content_title do
  = link_to "Test Case Manager", "/"
  &raquo;
  = "Reports"
%table.grid.full
%tr
    %td.grid.full_panels{:style => "width: 30%"}
      -panel "Reports" do
        = render "reports",:report_type=>params[:report_type]
    %td.grid.full_panels{:style => "width: 70%"}
      -table_panel "Report details" do
        = render "report_details",:report_type=>params[:report_type]
= javascript_include_tag "pages/ic"

_reports.html.haml:

%table.grid.full
  %tr
    %td.grid.full_panels{:style => "width: 10%"}
      =link_to 'Test Not Run Per Cycle',reports_path(:report_type=>1)
  %tr
    %td.grid.full_panels{:style => "width: 10%"}
      = link_to 'Test Cycle Result Comparison',reports_path(:report_type=>2)
  %tr
    %td.grid.full_panels{:style => "width: 10%"}
      = link_to 'Test Cycle Summary'
  %tr
    %td.grid.full_panels{:style => "width: 10%"}
      = link_to 'Tester summary per cycle'
  %tr
    %td.grid.full_panels{:style => "width: 10%"}
      = link_to 'Test Cycle Failure Report'
  %tr
    %td.grid.full_panels{:style => "width: 10%"}
      = link_to 'Release Test Results Summary'
= javascript_include_tag "pages/ic"

_report_details.html.haml:

-if report_type == "1" 
   = render "tests_not_run_per_cycle",:report_type=>report_type  
   = render "tests_not_run_per_cycle_reports",:report_type=>params[:report_type]

_tests_not_run_per_cycle.html.haml:

-projects=Project.all
-releases = Release.all
-cycles=Release.all
-form_tag reports_path(),:method => :get, :multipart => true  do  
  %table.grid.full_panels
  %tr      
  %td.grid.full_panels{:style => "width: 20%"}
    Project:
  %td.grid.full_panels{:style => "width: 20%"}
    //= select_tag "projects",options_from_collection_for_select(projects,"id","name",params[:projects]),{:onchange => "#{remote_function(:url  => {:action => "update_releases"},:with => "'project_id='+value")}"} 
    = select_tag "projects",options_from_collection_for_select(projects,"id","name",params[:projects]), :class => "update_releases",:include_blank=>true
    //= select_tag 'projects',options_from_collection_for_select(projects, "id", "name"),:'data-remote' => 'true', :'data-url' => 'reports/update_releases', :'data-type' => 'json'  
    =hidden_field_tag "report_type","1"
  %td.grid.full_panels{:style => "width: 20%"}
    Releases:
  %td.grid.full_panels{:style => "width: 20%"}
    <div id="releases">
    = render :partial => 'releases', :object => @releases
  %td.grid.full_panels{:style => "width: 20%"}
    Cycles:
  %td.grid.full_panels{:style => "width: 20%"}
    <div id="cycles">
    = render :partial => 'cycles', :object => @cycles

%tr      
  %td.grid.full_panels{:style => "width: 20%"}
  %td.grid.full_panels{:style => "width: 20%"}
  %td.grid.full_panels{:style => "width: 20%"}
    =submit_tag "Submit"
  %td.grid.full_panels{:style => "width: 20%"}
  %td.grid.full_panels{:style => "width: 20%"}
  %td.grid.full_panels{:style => "width: 20%"}      
= javascript_include_tag "pages/ic"

_tests_not_run_per_cycle_reports:

-if report_type=="1" && params[:cycles]
   -ic_to_platform_config = @cycle.ic_platform_configs
   %table
    %th Root
    %th Suite
    %th Case
    %th IC
    %th Executor
    %th Platform
    -@ics.each do |ic|
      %tr
    -ic_model=Ic.find(ic.id)
    - ic_rev=@cycle.get_ic_rev_assign(ic_model)
    - populate_table ic_rev, ic_to_platform_config[ic_model]
 = javascript_include_tag "pages/ic"

On clicking the submit button the user signed in gets signed out automatically.Please help me out here.

Thanks,
Ramya.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T14:04:39+00:00Added an answer on May 26, 2026 at 2:04 pm

    I had a similar problem a while back – the underlying problem is that if you do a POST request to a Rails application, and your post request does not have an authenticity token as one of the parameters, Rails deletes its session, which usually causes the user to be logged out.

    Take a look at the HTML source of your generated form — does it contain a hidden input field called authenticity token?

    There are a couple of solutions, one would be to skip that check on the server, but the better solution would be to add the authenticity token to the form. Try adding this to the head section of your layout HAML file:

    = csrf_meta_tag
    

    I think that is enough to fix your problem

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a problem in my Ruby on Rails app with a model where
I am having a Ruby and Rails application. I am loading a form using
We are having an issue with a Ruby on Rails 3.0.3 application. It seems
I have an older application running Ruby on Rails 2.2, and I'm having trouble
I am new to Ruby and Rails and am having trouble getting a class
I am new to ruby and rails and I am having difficulty conceptualizing the
The application is written in Ruby on Rails but the problem I am facing
In my Ruby on Rails application I have a page Aboutus - This has
Got a rails application that has a form (new action) with a select with
I'm still new to Ruby on Rails and I'm currently having a issue with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.