Sorry, you are not allowed to access that page

40 views
Skip to first unread message

Naveed Alam

unread,
Mar 8, 2016, 2:38:45 AM3/8/16
to rubyonra...@googlegroups.com
Dear friends,

I have a method named show_rosterduty in employee controller and and a
view name show_rosterduty.html.erb

in the authorization_rules I already set the name of method along with
other methods of employee, means below the method add_rosterduty.

but it give me the error:

Sorry, you are not allowed to access that page

here are the methods below:

######### Roster Duty #########
def add_rosterduty
@rosterduty = RosterDuty.new(params[:rosterduty])
#logger.info( "Employee: #{@employee.inspect}")
@employee = Employee.find(params[:id])
if request.post? and @rosterduty.save
flash[:notice] = t('flash1')
redirect_to :controller => "employee", :action =>
"add_rosterduty", :id => @employee.id and return
end
end

def show_rosterduty
@rosterduty = RosterDuty.find(params[:id])
@employee = Employee.find(params[:id])
respond_to do |format|
format.html # show_rosterduty.html.erb
format.xml { render :xml => @rosterduty }
end
end

--
Posted via http://www.ruby-forum.com/.

Colin Law

unread,
Mar 8, 2016, 3:41:47 AM3/8/16
to Ruby on Rails: Talk
On 8 March 2016 at 07:38, Naveed Alam <li...@ruby-forum.com> wrote:
> Dear friends,
>
> I have a method named show_rosterduty in employee controller and and a
> view name show_rosterduty.html.erb
>
> in the authorization_rules I already set the name of method along with
> other methods of employee, means below the method add_rosterduty.
>
> but it give me the error:
>
> Sorry, you are not allowed to access that page

Probably a before-filter is not allowing access. Have a look in the
log for clues.

Am I right in thinking that you are an inexperienced developer who has
been given the job of maintaining an existing app? If so then I think
it would be well worth your while taking some time out to learn the
basics of rails before continuing. If you are being employed to do
this then tell your employer. Otherwise I suggest starting with the
tutorial at railstutorial.org, which is free to use online.

Colin

>
> here are the methods below:
>
> ######### Roster Duty #########
> def add_rosterduty
> @rosterduty = RosterDuty.new(params[:rosterduty])
> #logger.info( "Employee: #{@employee.inspect}")
> @employee = Employee.find(params[:id])
> if request.post? and @rosterduty.save
> flash[:notice] = t('flash1')
> redirect_to :controller => "employee", :action =>
> "add_rosterduty", :id => @employee.id and return
> end
> end
>
> def show_rosterduty
> @rosterduty = RosterDuty.find(params[:id])
> @employee = Employee.find(params[:id])
> respond_to do |format|
> format.html # show_rosterduty.html.erb
> format.xml { render :xml => @rosterduty }
> end
> end
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> 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-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/9fb137d5c27da48870ea58bad9446e57%40ruby-forum.com.
> For more options, visit https://groups.google.com/d/optout.

Naveed Alam

unread,
Mar 8, 2016, 4:07:48 AM3/8/16
to rubyonra...@googlegroups.com
>
> Am I right in thinking that you are an inexperienced developer who has
> been given the job of maintaining an existing app? If so then I think
> it would be well worth your while taking some time out to learn the
> basics of rails before continuing. If you are being employed to do
> this then tell your employer. Otherwise I suggest starting with the
> tutorial at railstutorial.org, which is free to use online.
>
> Colin

You are right I am new to Rails programming, and I am editing/updating
an existing app for my organization, I am learning along with work but
due to lack of time I cant learn quickly, and also there is too many
things different from Rails version to version.

Anyway thanks a lot the problem resolved now. It was before filter
issue.

Colin Law

unread,
Mar 8, 2016, 5:58:56 AM3/8/16
to Ruby on Rails: Talk
On 8 March 2016 at 09:07, Naveed Alam <li...@ruby-forum.com> wrote:
>>
>> Am I right in thinking that you are an inexperienced developer who has
>> been given the job of maintaining an existing app? If so then I think
>> it would be well worth your while taking some time out to learn the
>> basics of rails before continuing. If you are being employed to do
>> this then tell your employer. Otherwise I suggest starting with the
>> tutorial at railstutorial.org, which is free to use online.
>>
>> Colin
>
> You are right I am new to Rails programming, and I am editing/updating
> an existing app for my organization, I am learning along with work but
> due to lack of time I cant learn quickly, and also there is too many
> things different from Rails version to version.

That's OK, I am sure people here will continue willingly to give their
time freely so that your organisation can save on the cost of training
you in the basics of Ruby and Rails.

Colin
Reply all
Reply to author
Forward
0 new messages