[Rails] Re: Re: Re: warning: toplevel constant Configuration referenced by ActiveRecord::Base::Configuration

2016-04-26 Thread Naveed Alam
Colin Law wrote in post #1183079: > On 26 April 2016 at 05:10, Naveed Alam wrote: >> Yes I have a Configuration Model/Controler below are the links to >> controller, and model > > In that case your simplest solution may be to change the name of the > model. > > Coli

[Rails] Re: Re: warning: toplevel constant Configuration referenced by ActiveRecord::Base::Configuration

2016-04-25 Thread Naveed Alam
Colin Law wrote in post #1183067: > On 25 April 2016 at 16:08, Naveed Alam wrote: >>> => [] >> in 2.3.10 its not changing the theme. > That does not answer the question. > > If you search your code for Configuration does it find anything? > > Colin Yes I

[Rails] Re: warning: toplevel constant Configuration referenced by ActiveRecord::Base::Configuration

2016-04-25 Thread Naveed Alam
Greg Navis wrote in post #1183062: > The simplest way to trigger this warning (it's not Rails-related BTW) is > this: > > $ irb > irb(main):001:0> class Foo > irb(main):002:1> end > => nil > irb(main):003:0> Foo::Array.new > (irb):3: warning: toplevel constant Array referenced by Foo::Array > => []

[Rails] warning: toplevel constant Configuration referenced by ActiveRecord::Base::Configuration

2016-04-24 Thread Naveed Alam
Hi, I am facing the error msg mention in subject, and my theme doesn't change. *** init.rb require File.join(File.dirname(__FILE__), "lib", "fedena_theme") FedenaPlugin.register = { :name=>"fedena_theme", :description=>"Fedena Theme" } *** /// the line 52 in init.rb showing erro

[Rails] Re: Re: Find All records with associated records

2016-04-12 Thread Naveed Alam
Colin Law wrote in post #1182787: > On 12 April 2016 at 08:52, Naveed Alam wrote: >>> As a beginner I suggest you work right through a good tutorial in >>> order to get the basics or Rails. The one I suggest is >>> railstutorial.org (which is free to use online). &g

[Rails] Re: Find All records with associated records

2016-04-12 Thread Naveed Alam
> As a beginner I suggest you work right through a good tutorial in > order to get the basics or Rails. The one I suggest is > railstutorial.org (which is free to use online). > > Colin Thanks colin I already tried this but it give me the error: undefined method `company_name' for nil:NilClass

[Rails] Find All records with associated records

2016-04-12 Thread Naveed Alam
Hi, Using rails 4, I have two models Supplier and Category Category belongs_to Supplier and Supplier has_many categories now the suppliers table has fields, company_name, address, phone etc. and id and the categories has cat_name and supplier_id in the categories index view I want to display

[Rails] Re: Re: You have a nil object when you didn't expect it!

2016-04-08 Thread Naveed Alam
> > Colin I get the following error when I goto the privilege page. NoMethodError in Employee#edit_privilege Showing app/views/employee/edit_privilege.html.erb where line #82 raised: You have a nil object when you didn't expect it! You might have expected an instance of ActiveRecord::Base. The

[Rails] Re: You have a nil object when you didn't expect it!

2016-04-07 Thread Naveed Alam
Asvini Ramesh wrote in post #1182593: > On Saturday, March 26, 2016 at 3:00:46 PM UTC+5:30, Ruby-Forum.com User Well in Production mode it works fine but in Development mode it show the above error. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscri

[Rails] Re: Re: Re: Re: You have a nil object when you didn't expect it!

2016-03-31 Thread Naveed Alam
> It depends on whether that is ever supposed to be nil. If it is then > you just need to test for that in your code before using it. > > Colin In my controller's edit_privilege method I changed the below line from @user = User.active.first(:conditions => ["username LIKE BINARY(?)",params[:id]

[Rails] Re: Re: Re: You have a nil object when you didn't expect it!

2016-03-26 Thread Naveed Alam
> > So Authorization::Engine.instance.roles_plugin_hash is nil. > > Colin No idea what to do -- 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 em

[Rails] Re: Re: You have a nil object when you didn't expect it!

2016-03-26 Thread Naveed Alam
Colin Sorry below is line 24 role_plugin_hash = Authorization::Engine.instance.roles_plugin_hash[self.name.underscore.to_sym] -- 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

[Rails] Re: You have a nil object when you didn't expect it!

2016-03-26 Thread Naveed Alam
Colin Law wrote in post #1182464: > On 26 March 2016 at 09:30, Naveed Alam wrote: >> You might have expected an instance of ActiveRecord::Base. >> The error occurred while evaluating nil.[] >> >> app/models/privilege.rb:24:in `applicable?' > > The error

[Rails] You have a nil object when you didn't expect it!

2016-03-26 Thread Naveed Alam
Dear friends, I get the following error when I goto the privilege page. NoMethodError in Employee#edit_privilege Showing app/views/employee/edit_privilege.html.erb where line #82 raised: You have a nil object when you didn't expect it! You might have expected an instance of ActiveRecord::Base.

[Rails] Re: validation on phone number

2016-03-26 Thread Naveed Alam
Ramu Goud wrote in post #1182441: > Hi, > i have column name phone with integer datatype but when i enter phone > number it throws an error > "1325565488 is out of range for ActiveRecord::Type::Integer with limit > 4" goto your db folder and in the migration change the phone number field data typ

[Rails] Re: Re: Re: Re: Re: Find Weekdays range between two

2016-03-16 Thread Naveed Alam
> > Why are you not using Roster.Duty.where(...)? > > Colin Thanks dear it worked, I just changed @theday =Time.now.strftime('%A').downcase to this @theday =Time.now.strftime('%w') and the condition line as you suggested to this @rosterduties = RosterDuty.find(:all, :conditions => ["(duty_day1

[Rails] Re: Re: Re: Re: Find Weekdays range between two

2016-03-14 Thread Naveed Alam
>> Colin > Dear I changed the Days from names to numbers, in my Add_rosters its like below now: <%= a.select :duty_day1, [[ "Monday","1"], ["Tuesday","2"],["Wednesday","3"],["Thursday","4"],["Friday","5"],["Saturday","6"],["Sunday","0"]],:selected => ["Monday","1"] %> Change the controller

[Rails] Re: Re: Re: Re: Find Weekdays range between two

2016-03-13 Thread Naveed Alam
> "(duty_day1 <= duty_day2 and duty_day1 <= ? and duty_day2 >= ?) or > (duty_day1 > duty_day2 and (duty_day1 <= ? or duty_day2 >= ?))", > today, today, today, today > I have not tested that so convince yourself it is right before trying > it. Don't forget to provide automated tests to check all th

[Rails] Re: Re: Re: Find Weekdays range between two

2016-03-13 Thread Naveed Alam
Colin Law wrote in post #1182172: > On 13 Mar 2016 14:06, "Naveed Alam" wrote: >> Employee_id >> duty_name >> duty_day1 //start day >> duty_day2 //end day >> duty_time > > What is saved in duty_dayn? Day as string or as number (0..7)? Its,

[Rails] Re: Re: Find Weekdays range between two

2016-03-13 Thread Naveed Alam
> Also how do you record which RosterDuty records relate to a particular > person? > > Colin My field names are as below: id Employee_id duty_name duty_day1 //start day duty_day2 //end day duty_time -- Posted via http://www.ruby-forum.com/. -- You received this message because you are su

[Rails] Re: Find Weekdays range between two

2016-03-13 Thread Naveed Alam
> and so on to see what is not working and fix it. If you don't do that > then you will never know why the code is not doing what you want. > > After you have done that and either got it working or hit a brick wall > then come back and ask if there is a better way. > > Colin Sorry for not making

[Rails] Find Weekdays range between two

2016-03-13 Thread Naveed Alam
Dear Friends, I have values in table for duties assigned on certain days ranges, e.g Monday to Tuesday, Wednesday to Friday. Now I want to show the duties assigned to a person on main screen if the day of current date is in the range of weekdays assigned to him/her. I tried the below but no idea

[Rails] Re: Sorry, you are not allowed to access that page

2016-03-08 Thread Naveed Alam
> > 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

[Rails] Sorry, you are not allowed to access that page

2016-03-07 Thread Naveed Alam
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 a

[Rails] Re: Re: Re: Re: Re: Re: Re: Re: Calling method from model create error

2016-03-07 Thread Naveed Alam
>> Colin > > Thanks colin, > > I moved the method up in controller but now it gives me the error: > > NoMethodError in Employee#add_rosterduty > > Showing app/views/employee/add_rosterduty.html.erb where line #14 > raised: > > undefined method `roster_duties_path' for # > Extracted source (around l

[Rails] Re: Re: Re: Re: Re: Re: Re: Re: Calling method from model create error

2016-03-07 Thread Naveed Alam
> Finally, your controller is much too large and complex. I am not > going to wade through it trying to refactor it for you, but it is not > suitable for purpose as it is. Likely large amounts of the code can > be delegated to models, for example. > > Colin Thanks colin, I moved the method up i

[Rails] Re: Re: Re: Re: Re: Re: Re: Calling method from model create error

2016-03-07 Thread Naveed Alam
> If the controller is short then post it here, otherwise put is > somewhere like pastebin [1] so we can see it. > > Also put the results of the log since adding the logger.info line there. > > Colin I the link http://ansicollege.net/dummy/ there is, employee controller employee model roster_du

[Rails] Re: Re: Re: Re: Re: Re: Calling method from model create error

2016-03-07 Thread Naveed Alam
> You have not told us the outcome of your tests from my previous post. > If it is definitely not showing the logger.info output then it is not > executing that code. This would be consistent with the fact that it > does not seem to be querying the database for your Employee.find line. > You need

[Rails] Re: Re: Re: Re: Re: Calling method from model create error

2016-03-06 Thread Naveed Alam
> I suggest concentrating on one error at a time. Fix the other one > then move on to the next. > > Colin I just wanted to tell you this bcoz may it gives u any idea about the error. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Goog

[Rails] Re: Re: Re: Re: Calling method from model create error

2016-03-06 Thread Naveed Alam
> I don't see that it is related to this problem, but I notice from the > log that you are doing a GET on add_rosterduty when I think it should > be a post. Also it seems a bit odd that you make a new RosterDuty and > save it without setting any data in it. Again though, that is not the > cause o

[Rails] Re: Re: Re: Calling method from model create error

2016-03-06 Thread Naveed Alam
> > There is not much point putting the log line after the line that is > causing processing to stop due to the error. Also there is not much > point putting it anywhere in that bit of code as we already know (from > the error message) that it is nil. I expected that you would put it > in the are

[Rails] Re: Re: Calling method from model create error

2016-03-06 Thread Naveed Alam
Colin Law wrote in post #1181949: > On 6 March 2016 at 09:14, Naveed Alam wrote: >>>> model, method name is full_name which says full_name undefined. >> Extracted source (around line #5): >> Application Trace | Framework Trace | Full Trace >> {"id"=>&

[Rails] Re: Calling method from model create error

2016-03-06 Thread Naveed Alam
Colin Law wrote in post #1181947: > On 6 March 2016 at 08:00, Naveed Alam wrote: >>@employee = Employee.find(params[:id]) >> if request.post? and @rosterduty.save >> flash[:notice] = t('flash7') >> redirect_to :controller => "empl

[Rails] Calling method from model create error

2016-03-06 Thread Naveed Alam
Dear Experts/Friends I created a model for and moved it to a sub folder in my model's directory. Then wrote in the existing controller named employee the below code to add roster duty. def add_rosterduty() @rosterduty = RosterDuty.new() @employee = Employee.find(params[:id]) if request

[Rails] Re: Re: Re: Calculate Percentage using jquery

2016-02-03 Thread Naveed Alam
Colin Law wrote in post #1181132: > On 3 February 2016 at 07:46, Naveed Alam wrote: >> Checked with validator and it showed no error in this script. >> >> The alert is not working too. and showing no error, looks that the >> script is not running at all. >&

[Rails] Re: Re: Calculate Percentage using jquery

2016-02-02 Thread Naveed Alam
Checked with validator and it showed no error in this script. The alert is not working too. and showing no error, looks that the script is not running at all. below is the complete code. <%= show_header_icon %> <%= t('admission') %> | <%= t('previous_details') %> <% breadcrumb

[Rails] Re: Calculate Percentage using jquery

2016-02-02 Thread Naveed Alam
The alert is not working too. and showing no error, looks that the script is not running at all. -- 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 receivin

[Rails] Calculate Percentage using jquery

2016-02-02 Thread Naveed Alam
Hello, I want to calculate percentage marks of students using jquery, for this I tried the below code but its not working. I am very beginner in ruby on rails. <%= t('obtained_marks') %> <%= a.text_field :ob_marks, :id => "ob_marks" %> <%= t('total