[Rails] Suggestions on how I should handle licensing in a session

2020-03-13 Thread John Sanderbeck
In an app I wrote I implemented licensing for the modules in the app. Right now, I query the database every time the license is checked which is a ton of SQL calls per user per session... How can I limit the lookup to once per session? Just store it in the session hash? John -- You received

Re: [Rails] Association to User using a key named approver_id

2020-01-26 Thread John Sanderbeck
ame“, not „class“ as option key. Also, from the Model that > *holds the ID* of the other Model, it’s always „belongs_to“. > > So in Event: > belongs_to :approver, class_name: „User“ > and you’re good to go. > > > Sent via iPhone. > > Am 26.01.2020 um 16:56 schrieb John Sande

[Rails] Association to User using a key named approver_id

2020-01-26 Thread John Sanderbeck
I KNOW this is probably very simple, but I am scratching my head trying to get it to work... I have a table with a key named approver_id What I want to do is associate this to the User class So I can do Event.approver.first_name, etc... in Event I have has_one :approver, class: 'User' So

Re: [Rails] Re: Deep Nesting Help

2019-09-26 Thread John Sanderbeck
.item_check, item_value: > subitem.item_value, item_note: subitem.item_note) > end > > could be a method on newitem like "add_subitem_from(subitem)" that does > that create but you'll have less clutter to simplify your logic to > understand it bett

[Rails] Re: Deep Nesting Help

2019-09-26 Thread John Sanderbeck
> Another thing to note is I am also only doing an Edit of the data as the > records already have been created and are not allowed to be destroyed. > John -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this

[Rails] Implemented Logster but only seeing FATAL errors...

2019-08-25 Thread John Sanderbeck
I recently implemented the Logster Gem to get a view of my errors in Production... It's working fine however no matter what the log level is in production.rb, it looks like it is only displaying Fatal Errors... I did look at the logs however and they are showing down to INFO level which is

[Rails] Re: has_many through: Question

2019-08-06 Thread John Sanderbeck
, August 4, 2019 at 9:29:08 AM UTC-4, John Sanderbeck wrote: > > I am building a Lunch Ordering Module for my app and I have these models > currently > > Menu > :menu_date > :menu_type > > Meal > :name > :mentree_id > :available_daily > > Mentree

[Rails] has_many through: Question

2019-08-04 Thread John Sanderbeck
I am building a Lunch Ordering Module for my app and I have these models currently Menu :menu_date :menu_type Meal :name :mentree_id :available_daily Mentree :name Msides :name Mdrink :name Right now I am using a has_and_belongs_to_many on meals_menus mdrinks_menus

[Rails] Re: Drag and Drop question

2019-08-04 Thread John Sanderbeck
On Friday, July 19, 2019 at 10:48:56 AM UTC-4, John Sanderbeck wrote: > > I have an app in production that I am adding a module to for Lunch Ordering > > What I have is a Menu, which has Meals, and the Meals have Meal Items in > Categories like Entree, Vegetable, Fruit, and Drink &

Re: [Rails] Drag and Drop question

2019-07-20 Thread John Sanderbeck
trying to get this going first, I would just save each meal > individually first, and then, once it's working at that level, try to > further complicate it by nesting forms. > > Walter > > > On Jul 20, 2019, at 12:25 PM, John Sanderbeck > wrote: > > > > Ok. Chan

[Rails] Re: Drag and Drop question

2019-07-20 Thread John Sanderbeck
a total newbie with this... :-) John On Friday, July 19, 2019 at 10:48:56 AM UTC-4, John Sanderbeck wrote: > > I have an app in production that I am adding a module to for Lunch Ordering > > What I have is a Menu, which has Meals, and the Meals have Meal Items in > Categories like En

[Rails] Re: Drag and Drop question

2019-07-19 Thread John Sanderbeck
Sorry, I should have elaborated a little more Walter... I implemented Interact.js and used an example from a Drifting Ruby Episode... https://www.youtube.com/watch?v=fhnHA7PWq0g Dragging is working but drop doesn't "look" to be firing... My form code currently is like this var

[Rails] Drag and Drop question

2019-07-19 Thread John Sanderbeck
for the Meal Items... Any suggestions or links I can look at to do this? John Sanderbeck [image: Untitled picture.png] -- 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, sen

Re: [Rails] Re: Having a problem figuring out how to structure this... Nesting issue

2018-10-24 Thread John Sanderbeck
: > > Certainly you only need to specify the associations you need to use. > > Colin > On Wed, 24 Oct 2018 at 14:44, John Sanderbeck > wrote: > > > > Hmmm... That may work... > > > > I would always be accessing assessment.data_entries for any l

[Rails] Re: Having a problem figuring out how to structure this... Nesting issue

2018-10-24 Thread John Sanderbeck
: :assessment may work though... Let me give that a shot... Now to figure out how to structure it... :-) On Wednesday, October 24, 2018 at 7:12:45 AM UTC-4, John Sanderbeck wrote: > > I'm working on a project that has the following setup > > I have a table called Assessment > > f

[Rails] Having a problem figuring out how to structure this... Nesting issue

2018-10-24 Thread John Sanderbeck
I'm working on a project that has the following setup I have a table called Assessment for each assessment there can be different reasons and consequences defined for that assessment then for each assessment the teacher takes multiple data entries over a period of time each data entry can

[Rails] Re: Proper Coding Question

2018-10-04 Thread John Sanderbeck
Ok, that makes sense... Everything is working fine the way it is coded but I am fairly new to RoR and want to learn proper practices. One of the things I do with pundit is to filter the data by a particular School District, so in the "scope" of Pundit I look to see what role the user has and

[Rails] Re: Proper Coding Question

2018-10-03 Thread John Sanderbeck
selected: user.id == selected, > data: { role: user.role } > end.join.html_safe > end > > Then in the view I might have: > > <%= form.select :user_id, user_options form.object.user_id %> > > On Tuesday, October 2, 2018 at 7:20:48 AM UT

[Rails] Proper Coding Question

2018-10-02 Thread John Sanderbeck
Good Morning Everyone... I have a coding question just so I am clear on the proper way to do this... To start, I have an app that I use Pundit in to control access to data, so I have a lot of calls that are like policy_scope(User) What is the proper way to populate a select on a form with this

Re: [Rails] Adding records to a nested model through an association

2018-08-17 Thread John Sanderbeck
estroy: true end class Note < ActiveRecord::Base belongs_to :student end On Thursday, August 16, 2018 at 4:59:59 PM UTC-4, John Sanderbeck wrote: > > I figured it out... Didn't have a accepts_nested_attributes_for :notes > in my attendance model... Duh !!! > > Howev

Re: [Rails] Adding records to a nested model through an association

2018-08-16 Thread John Sanderbeck
. On Wednesday, August 15, 2018 at 6:42:38 AM UTC-4, John Sanderbeck wrote: > > The way the nests are working now is it should render the file > _note_fields.html.erb but it acts like it is not finding that file which > tells me the fields_for is looking for a different name due to the way it

Re: [Rails] Adding records to a nested model through an association

2018-08-15 Thread John Sanderbeck
The way the nests are working now is it should render the file _note_fields.html.erb but it acts like it is not finding that file which tells me the fields_for is looking for a different name due to the way it is nested On Wednesday, August 15, 2018 at 6:26:31 AM UTC-4, John Sanderbeck wrote

Re: [Rails] Adding records to a nested model through an association

2018-08-15 Thread John Sanderbeck
That's the way all my other nests are defined and they work fine... I think the problem is I am adding a nest from a different model than I am actually working on... On Tuesday, August 14, 2018 at 8:03:57 PM UTC-4, Walter Lee Davis wrote: > > > > On Aug 14, 2018, at 5:49 PM, Joh

Re: [Rails] Need guidance on an inline editing design

2018-08-14 Thread John Sanderbeck
Thank you everyone for the help... After I stepped back and looked at this again it was simple... Your guidance did help though... John On Tuesday, August 7, 2018 at 6:32:07 AM UTC-4, John Sanderbeck wrote: > > Got it but I think I want to do it with Ajax instead... :-) > > O

[Rails] Adding records to a nested model through an association

2018-08-14 Thread John Sanderbeck
Not sure if the subject is correct for what I am trying to do... I am working on a School application and I added an Attendance section There is an attendance record that is associated to a student record The student record has an associated model called notes... What I would like to be able

Re: [Rails] Need guidance on an inline editing design

2018-08-07 Thread John Sanderbeck
Got it but I think I want to do it with Ajax instead... :-) One Click = 1 update Would be cleaner for the teachers... John -- 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

[Rails] Re: Best OS for production self hosting

2018-08-06 Thread John Sanderbeck
I've always used CentOS for my deployments. Never had any issues with it and have found help on any install question I have had. Run NGINX web server with a Postgresql backend John On Saturday, August 4, 2018 at 9:15:28 PM UTC-4, fugee ohu wrote: > > I've been hosting my rails apps on freebsd

Re: [Rails] Need guidance on an inline editing design

2018-08-04 Thread John Sanderbeck
nequiz > > basically, it's a multiple choice database, add questions, and it > retrieves the questions in random order. > > It's still a work in progress. > > > On Thursday, August 2, 2018 at 2:09:01 PM UTC-4, John Sanderbeck wrote: >> >> It's part of a larger project so

Re: [Rails] Need guidance on an inline editing design

2018-08-02 Thread John Sanderbeck
nd, I'm also learning rails, and run out of ideas / > projects to work on. > > > > On Thursday, August 2, 2018 at 6:38:39 AM UTC-4, John Sanderbeck wrote: >> >> Sorry... Only been doing RoR code for about a year... Still learning... >> >> John >> &g

Re: [Rails] Need guidance on an inline editing design

2018-08-02 Thread John Sanderbeck
Sorry... Only been doing RoR code for about a year... Still learning... John On Wednesday, August 1, 2018 at 1:23:45 PM UTC-4, Hassan Schroeder wrote: > > On Wed, Aug 1, 2018 at 9:06 AM, John Sanderbeck > wrote: > > > How do I define a set of radio buttons unique to each s

Re: [Rails] Need guidance on an inline editing design

2018-08-01 Thread John Sanderbeck
to show them as actual buttons with bootstrap if possible... John On Wednesday, August 1, 2018 at 11:07:41 AM UTC-4, Hassan Schroeder wrote: > > On Wed, Aug 1, 2018 at 7:16 AM, John Sanderbeck > wrote: > > It will typically be a single class however the main s

Re: [Rails] Need guidance on an inline editing design

2018-08-01 Thread John Sanderbeck
And if not, could I have a filter? We use Filterrific in most of the application... John On Wednesday, August 1, 2018 at 10:16:19 AM UTC-4, John Sanderbeck wrote: > > It will typically be a single class however the main secretary may go in > to check attendance and she will see t

Re: [Rails] Need guidance on an inline editing design

2018-08-01 Thread John Sanderbeck
ode or do you have > suggestions on how I can do this... > > I've been googling and watching videos and nothing does what I am looking > for... > > John Sanderbeck > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk&q

Re: [Rails] Need guidance on an inline editing design

2018-08-01 Thread John Sanderbeck
, Absent, Half-Day > District, Half-Day CTC, Full-Day District. > > 2nd row Submit button > > Once the submit button is clicked those details would entered into the > database > > and the next Student in the Database would be presented > > Cheers Dave > > >

[Rails] Need guidance on an inline editing design

2018-07-31 Thread John Sanderbeck
this... I've been googling and watching videos and nothing does what I am looking for... John Sanderbeck -- 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, sen

[Rails] Re: Javascript rendering partial improperly

2016-07-18 Thread John Sanderbeck
Actually, what it appears to be doing is not executing the javascript. The js file just shows as text. I assume this is due to the protection_from_forgery but can anyone point me in the right direction to fix this? John -- Posted via http://www.ruby-forum.com/. -- You received this message

[Rails] Javascript rendering text instead of HTML

2016-07-16 Thread John Sanderbeck
I have an app that I am working on and what I did was added a set of filters on the index page that allows me to use Ajax to filter the result set. The filters pass through to the controller index method. That works beautifully however I ran into a cross site scripting error with pagination. I

[Rails] Help with Joins (Users and Roles)

2016-05-29 Thread John Sanderbeck
What I am trying to do is setup a set of joins that do the following User has a global role such as :global_admin, :building_admin, etc I also have Organizations, Districts, and Buildings I would like a user to be able to be assigned a different role per Organization, District, or Building I

[Rails] How do I setup this odd join?

2016-04-30 Thread John Sanderbeck
What I am trying to do is the following: I have a Student table with some fields... I need to join the student in two different ways... 1. The student has a home district 2. The student can be in one or more reporting districts I understand the join table for the reporting districts, however

[Rails] Nested Resources missing route?

2016-04-10 Thread John Sanderbeck
I am working on an app that has the following setup. Districts District Profiles Days_Months Building Building Profiles Building Locations I have the resources nested like this -- resources :buildings do resources :bprofiles, :shallow =>

[Rails] Re: Re: Re: Re: Simple_Form has_many through question

2016-03-10 Thread John Sanderbeck
Colin Law wrote in post #1182080: > On 9 March 2016 at 23:19, John Sanderbeck <li...@ruby-forum.com> wrote: > attendance_count is not an attribute of organization, it is an > attribute of attendee so would need something like > Training.organizations.first.attendees.firs

[Rails] Re: Re: Re: Re: Simple_Form has_many through question

2016-03-10 Thread John Sanderbeck
Colin Law wrote in post #1182080: > On 9 March 2016 at 23:19, John Sanderbeck <li...@ruby-forum.com> wrote: > Perhaps you had better tell us exactly what associations you have > setup, in terms of has_many, belongs_to has_many_many through etc. > Tell us what you have decla

[Rails] Re: Re: Re: Simple_Form has_many through question

2016-03-09 Thread John Sanderbeck
Colin Law wrote in post #1182071: > OK, I did not realise that you wanted to input a numeric value. The > fact that it is an integer rather than, for example, a text string, is > irrelevant to the form. You just need to use f.input. What you do > with that in the controller, of course, is up to

[Rails] Re: Re: Simple_Form has_many through question

2016-03-09 Thread John Sanderbeck
Colin Law wrote in post #1182068: > On 9 March 2016 at 16:43, John Sanderbeck <li...@ruby-forum.com> wrote: > Firstly please quote the previous message when you reply, this is a > mailing list not a forum (though you may be accessing it via a forum > like interface) so i

[Rails] Re: Simple_Form has_many through question

2016-03-09 Thread John Sanderbeck
I have watched many tutorials through CodeSchool, Railscasts, and the site you mentioned. None touch on exactly what I am trying to do. I know it's something simple, I just can't find a reference to what I want to do anywhere. John -- Posted via http://www.ruby-forum.com/. -- You received

[Rails] Simple_Form has_many through question

2016-03-09 Thread John Sanderbeck
from the Attendee Table Needless to say I am new to Rails and am struggling with the syntax. John Sanderbeck Attachments: http://www.ruby-forum.com/attachment/11294/001_create_trainings.rb http://www.ruby-forum.com/attachment/11295/002_create_organizations.rb http://www.ruby-forum.com/attachment

[Rails] Re: Split check_box_tag into two or three columns

2016-03-05 Thread John Sanderbeck
I never thought about CSS3... Thank you!! -- 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

[Rails] Split checkbox_tag into two or three columns

2016-03-05 Thread John Sanderbeck
What I have is a list of audience types attending a training, and I would like to split the list of checked items into two or three columns instead of having one long list with checkboxes. Here is my current code which works fine however it is presented in one long list that you need to scroll

[Rails] Re: Dynamic Data in Highcharts

2016-02-25 Thread John Sanderbeck
Thank you. I assumed that was what you were saying... Let me play with that idea and see if I can get that to work. John -- 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

[Rails] Re: Dynamic Data in Highcharts

2016-02-25 Thread John Sanderbeck
I think I understand what you are saying to do, but an example would be helpful... I am far from a JQuery expert... :-) John -- 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] Dynamic Data in Highcharts

2016-02-15 Thread John Sanderbeck
I have a chart page with 12 charts on it. Each chart is in a self contained partial. Each chart is a different group of data however the common filter is a date range which I pass into the partial. I implemented a jQRangeSlider to select the date range and pass that to the controller which in

[Rails] Re: Highcharts/Rails/jQRangeSlider/Ajax

2016-02-12 Thread John Sanderbeck
Ok, so it appears that the data is refreshing underneath however the pages are not re-rendering. I have a primary page with the jQRangeSlider on it and 18 partials in a table format. I can see the data changing in the server window however the charts are not refreshing. John -- Posted via

[Rails] Highcharts/Rails/jQRangeSlider/Ajax

2016-02-11 Thread John Sanderbeck
Has anyone paired these together into a working example that you could share? I am trying to do a set of charts based on a date range selected by the jQRangeSlider and have them dynamically update with an Ajax call but I am having no luck. Just wondered if anyone had any examples on how I can do

[Rails] Percentage Calculation

2016-02-05 Thread John Sanderbeck
I am new to Ruby (and probably more Rails for this) and am trying to figure out how to do this calculation efficiently. What I have is a Training table In the training table, I have a HABTM relationship with trainers What I am trying to do is get the percentage of each training a trainer

[Rails] Re: Hash mapping

2016-02-04 Thread John Sanderbeck
I thought of a counter cache however one of the problems is I need to be able to query by a date range as well in some of my charts and a counter cache wouldn't work. I almost have it working however I am getting a returned around each string which I believe is a javascript problem. My code

[Rails] Re: Hash mapping

2016-02-04 Thread John Sanderbeck
Got it. Just needed to put raw in front of the ruby call... Woo Hoo -- 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

[Rails] Re: Hash mapping

2016-02-04 Thread John Sanderbeck
I am trying to make this as efficient as possible which is why I was trying to do the group call. I was doing it in the Highchart definition which worked however it does many queries depending on how many initiatives there are. series: [{ name: "Trainings", data: [ <% Initiative.all.each

[Rails] Hash mapping

2016-02-04 Thread John Sanderbeck
I am new to Rails and Ruby and am having a difficult time building the data needed for a Highchart. I am struggling with the syntax to map a pair of hashes to an array. Let me try and explain: I have a table of "initiatives" which contains basically an ID and a Name. Then I have a table

[Rails] Re: counter_cache for has_many through associations

2016-01-07 Thread John Sanderbeck
I am struggling with this as well. What appears to be happening is that the deletes from the join table do not fire the counter_cache update. >From what I have read, delete's do not fire events and that is the way it is designed in Rails 4. I have tried multiple workarounds from doing an