mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-10-29 10:18:29 -04:00
- Updated MemberLocationsController to use a hash for location updates, ensuring coordinates are not geocoded again. - Changed response status codes in member_locations_spec to use symbols for better readability. - Modified PlacesController to use parentheses for defining MEMBER_FIELDS. - Enhanced SuggestionsController to disable Rails/SkipsModelValidations for update_columns. - Updated SeasonsHelper to use compact_blank for cleaner output. - Refactored MemberDashboard service for improved readability and performance. - Adjusted migration files to use parentheses for index definitions. - Updated schema.rb to maintain consistency in index definitions. - Added SampleData class to generate sample data for development. - Cleaned up sample_data.rake task to utilize the new SampleData class. - Updated tests in member_dashboard_spec and place_suggester_spec for consistency and readability.
19 lines
634 B
Ruby
19 lines
634 B
Ruby
# frozen_string_literal: true
|
|
|
|
# Every crop gardeners at the member's latitude are sowing this month, and the
|
|
# switch for turning those suggestions off or on.
|
|
class SuggestionsController < ApplicationController
|
|
skip_authorize_resource
|
|
before_action :authenticate_member!
|
|
|
|
def index
|
|
@dashboard = MemberDashboard.new(current_member)
|
|
@crops = @dashboard.easy_to_sow(40)
|
|
end
|
|
|
|
def update
|
|
current_member.update_columns(suggest_crops: params[:suggest] == 'true') # rubocop:disable Rails/SkipsModelValidations
|
|
redirect_back_or_to suggestions_path, notice: t(current_member.suggest_crops ? '.on' : '.off')
|
|
end
|
|
end
|