Stan Smith

Joined

3,200 Experience
27 Lessons Completed
0 Questions Solved

Activity

I installed the draftsman gem on a new install of jumpstart pro but it is conflicting with Activerecord.
Is their a workaround?

Bundler could not find compatible versions for gem "activerecord":
In Gemfile:
draftsman was resolved to 0.8.0.dev, which depends on
activerecord (>= 4.2, < 5.3)

rails (~> 6.0.0) was resolved to 6.0.1.rc1, which depends on
  activerecord (= 6.0.1.rc1)

Posted in Simple_form Chrome browser bug

I've finally resolved this problem by updating Chrome to the latest version.

Posted in Simple_form Chrome browser bug

Yes, the select menu items overflow outside the border of the box.

I agree it may be a css issue.

This is the css code for the select box shown in the image above.

          <div class="form-group">
            <%= f.association :categories, as: :select %>
          </div>

Posted in Simple_form Chrome browser bug

Yes, the bordered box doesn't contail all the items. It might be a css issue but the box shows correctly in firefox and safari

Posted in Simple_form Chrome browser bug

This is annoying.
The select menus are overlapping in Chrome.


Has anyone run across this? How did you fix.

Posted in IBM Watson

I just finished adding a feature to review a web page and extract names of people.
I used the alchemy-api-rb gem.
which allowed me to make an easy request to the AlchemyAPI - one of the API's fed by Watson.
The call to the API return a JSON file which I parsed for my app.

I'm not sure how cost effective will (you get charged per API call) but it's neat to use Watson for a feature!

Posted in How do I parse this JSON output?

Perfect. Thanks dude.

Posted in How do I parse this JSON output?

I'm trying to extract the "text" element if the "type" is "Person" from this JSON output.
I''ve been able to store the JSON in an instance variable @output and am using the following to begin iterating it
<% @output.each do |item| %>
<%= item %>
<% end %>

But - stuck there.

Here's a sample of the JSON output:

[{"type"=>"Person", "relevance"=>"0.896887", "count"=>"14", "text"=>"Gloria Etting"}, {"type"=>"City", "relevance"=>"0.35271", "count"=>"4", "text"=>"Los Angeles", "disambiguated"=>{"subType"=>["GovernmentalJurisdiction", "OlympicBiddingCity", "OlympicHostCity", "PlaceWithNeighborhoods", "FilmScreeningVenue"], "name"=>"Los Angeles", "geo"=>"34.05 -118.25", "website"=>"http://www.lacity.org/", "dbpedia"=>"http://dbpedia.org/resource/Los_Angeles", "freebase"=>"http://rdf.freebase.com/ns/m.030qb3t"}}, {"type"=>"City", "relevance"=>"0.347755", "count"=>"4", "text"=>"Philadelphia"}, {"type"=>"Person", "relevance"=>"0.32636", "count"=>"3", "text"=>"Betsey Cushing Roosevelt Whitney", "disambiguated"=>{"subType"=>["Collector"], "name"=>"Betsey Cushing Roosevelt Whitney", "dbpedia"=>"http://dbpedia.org/resource/Betsey_Cushing_Roosevelt_Whitney", "freebase"=>"http://rdf.freebase.com/ns/m.06czgg", "yago"=>"http://yago-knowledge.org/resource/Betsey_Cushing_Roosevelt_Whitney"}}, {"type"=>"Person", "relevance"=>"0.290267", "count"=>"2", "text"=>"Emlen Etting", "disambiguated"=>{"name"=>"Emlen Etting", "dbpedia"=>"http://dbpedia.org/resource/Emlen_Etting", "freebase"=>"http://rdf.freebase.com/ns/m.0b6hzqr"}},

Posted in Add paywall functionality to app

Thanks John for the thorough answer. I'm going to have a go at rolling this from scratch.

Posted in Add paywall functionality to app

I would like to offer people x views of certain pages then prompt them to pay for access.
I was looking ot use this gem acts_as_paywall - https://github.com/BarefootCoders/acts_as_paywall
but wanted to know if there was an easier way to do this.

Thanks?

I found the answer.
The date range parameter is handled by the groupbydate gem.
I needed to do this:
line_chart User.group_by_day(:created_at, range: 1.month.ago.midnight..Time.now).count

This is my helper:
def core7_by_month

line_chart User.group_by_day(:created_at).count, library: {
title: {text: 'Church members by month', x: -20},
chart: {
type: 'spline'
},
yAxis: {
crosshair: true,
allowDecimals: false,
title: {
text: 'Church Subscribers count'
}
},
xAxis: {
crosshair: true,
title: {
text: 'Year'
}
},
plotOptions: {
line: {
pointStart: 1.month.ago
}
}
}
end

This is in the view
<%= core7_by_month %>

Posted in Set a start date for Chartkick / Highcharts combination

This is driving me nuts.
I'm trying to set a dynamic start date of 1 month ago for a line chart using Chartkick / HighCharts.
But can't find the right syntax.

Posted in How do I publish an RSS feed from my rails app?

Thanks!

Posted in How do I publish an RSS feed from my rails app?

I have a simple blog setup with a posts model. Is there a gem that can publish a feed or should I create thus from scratch?

Posted in In-App Navbar Notifications - GoRails

Hey Chris, I've set up Notifications for 3 models. How do you configure the json.url to route to the right url?

I love this nifty bit of code. I'm wondering how would you go about using will_paginate to paginate the comments?

Posted in Comments With Polymorphic Associations Discussion

That works.
I overlooked that their is a comments model to pull from.
Thanks!

Posted in Comments With Polymorphic Associations Discussion

I should have mentioned that I'm showing the comments on an dashboard view that shows info from multiple models. So what you provided throws a 'undefined local variable or method `commentable' error.

For example I have a contacts model that is commentable and I would like to show the comments from that model on the dashboard(index)

Posted in Comments With Polymorphic Associations Discussion

Question Chris - I'm trying to show the last 5 comments in the show view. I can't get the query string right. Thanks for your help!

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

© 2024 GoRails, LLC. All rights reserved.