From 8c3d046cf4f9005452e7ebb4132b29056309554b Mon Sep 17 00:00:00 2001 From: benni Date: Sat, 25 Aug 2012 12:26:20 +0200 Subject: [PATCH 01/13] Recommend using rails3 branch for beginners. --- README | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README b/README index ca1cb320..2a0f3f95 100644 --- a/README +++ b/README @@ -6,6 +6,11 @@ Web-based software to manage a non-profit food coop (product catalog, ordering, Have a look on README_DEVEL. +Update, it is highly recommended to checkout the rails3 branch. As soon as possible I will merge this branch +into master. So for beginnners, better start with the new (I hope much easier) code. + +git checkout -b rails3 origin/rails3 + == License FoodSoft - a webbased foodcoop management software @@ -21,4 +26,4 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -(See file LICENSE for the full text of the GPL) \ No newline at end of file +(See file LICENSE for the full text of the GPL) From e9383e0d17dc758ae6fb708cf0f69ceb8bd0ec7d Mon Sep 17 00:00:00 2001 From: benni Date: Sat, 13 Oct 2012 22:19:01 +0200 Subject: [PATCH 02/13] Remove searching shared articles by list. This is necessary to go with newest fixes in sharedlists app. --- app/controllers/articles_controller.rb | 2 -- app/models/shared_supplier.rb | 3 --- app/views/articles/_import_search_results.haml | 2 +- app/views/articles/index.haml | 6 ------ 4 files changed, 1 insertion(+), 12 deletions(-) diff --git a/app/controllers/articles_controller.rb b/app/controllers/articles_controller.rb index 69da3b76..75b953a5 100644 --- a/app/controllers/articles_controller.rb +++ b/app/controllers/articles_controller.rb @@ -268,8 +268,6 @@ class ArticlesController < ApplicationController conditions << "supplier_id = #{@supplier.shared_supplier.id}" # check for keywords conditions << params[:import_query].split(' ').collect { |keyword| "name LIKE '%#{keyword}%'" }.join(' AND ') unless params[:import_query].blank? - # check for selected lists - conditions << "(" + params[:lists].collect {|list| "list = '#{list[0]}'"}.join(" OR ") + ")" if params[:lists] # check for regional articles conditions << "origin = 'REG'" if params[:regional] diff --git a/app/models/shared_supplier.rb b/app/models/shared_supplier.rb index 0a7837f8..af4f770f 100644 --- a/app/models/shared_supplier.rb +++ b/app/models/shared_supplier.rb @@ -9,9 +9,6 @@ class SharedSupplier < ActiveRecord::Base has_one :supplier has_many :shared_articles, :foreign_key => :supplier_id - # save the lists as an array - serialize :lists - end # == Schema Information diff --git a/app/views/articles/_import_search_results.haml b/app/views/articles/_import_search_results.haml index 180425ae..56a58ea5 100644 --- a/app/views/articles/_import_search_results.haml +++ b/app/views/articles/_import_search_results.haml @@ -1,5 +1,5 @@ %p= pagination_links_remote @articles, :per_page => 10, | - :params => {:import_query => params[:import_query], :lists => params[:lists], :regional => params[:regional]} | + :params => {:import_query => params[:import_query], :regional => params[:regional]} | %table.list %thead %tr diff --git a/app/views/articles/index.haml b/app/views/articles/index.haml index b368cd82..2f7bc5df 100644 --- a/app/views/articles/index.haml +++ b/app/views/articles/index.haml @@ -32,12 +32,6 @@ :method => :get do | = text_field_tag :import_query, params['import_query'], :size => 10 = submit_tag "Suchen" - - if @supplier.shared_supplier.lists - Suche in folgenden Listen: - - @supplier.shared_supplier.lists.each do |token, name| - = check_box_tag "lists[#{token}]", "1", true - = name - | Nur aus der Region: = check_box_tag "regional", "1", false #search_results From ee3da51ad32b4c358f81b414294d30eee203cfce Mon Sep 17 00:00:00 2001 From: benni Date: Wed, 24 Oct 2012 12:19:53 +0200 Subject: [PATCH 03/13] Fixed bug in new stockit article form. --- app/views/stockit/new.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/stockit/new.html.haml b/app/views/stockit/new.html.haml index 560ae635..28177182 100644 --- a/app/views/stockit/new.html.haml +++ b/app/views/stockit/new.html.haml @@ -2,7 +2,7 @@ :javascript function fillNewStockArticle(text, li) { - new Ajax.Updater('stock_article_form', '/stockit/fill_new_stock_article_form', { + new Ajax.Updater('stock_article_form', '#{url_for(:controller => "stockit", :action => "fill_new_stock_article_form")}', { parameters: {article_id: li.id} }); } From cecad7db135d16eaa595e48e845a0398d486eef1 Mon Sep 17 00:00:00 2001 From: Julius Date: Fri, 9 Nov 2012 23:54:45 +0100 Subject: [PATCH 04/13] make it run... --- .gitignore | 1 + Gemfile | 3 ++- config/environment.rb | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 69e73788..0b4b3134 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ config/environments/development.rb capfile config/environments/fcschinke09.rb *.swp +*~ public/**/*_cached.* config/initializers/session_store.rb .idea diff --git a/Gemfile b/Gemfile index 2bf05686..fec6f012 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,6 @@ # A sample Gemfile source "http://rubygems.org" +ruby "1.8.7" gem "rails", '2.3.11' @@ -13,4 +14,4 @@ gem 'sqlite3-ruby' group :development do gem 'annotate' gem 'hirb' -end \ No newline at end of file +end diff --git a/config/environment.rb b/config/environment.rb index b5d15ab0..0393e60d 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -67,4 +67,5 @@ Rails::Initializer.run do |config| config.i18n.default_locale = :de # See Rails::Configuration for more options + config.action_controller.session = { :key => "_myapp_session", :secret => "9195616576518931793179752176417923862176431279acfaedcbeafdcbeafdcbeafcbaefdcbaedcfadcf" } end From 69c4fc58171a23096a1be7b4e4cc667d55413e45 Mon Sep 17 00:00:00 2001 From: Julius Date: Mon, 12 Nov 2012 11:37:26 +0100 Subject: [PATCH 05/13] Add created_by_user_id to Order table --- .../20121112093327_add_created_by_user_id_to_orders.rb | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 db/migrate/20121112093327_add_created_by_user_id_to_orders.rb diff --git a/db/migrate/20121112093327_add_created_by_user_id_to_orders.rb b/db/migrate/20121112093327_add_created_by_user_id_to_orders.rb new file mode 100644 index 00000000..64614aa4 --- /dev/null +++ b/db/migrate/20121112093327_add_created_by_user_id_to_orders.rb @@ -0,0 +1,9 @@ +class AddCreatedByUserIdToOrders < ActiveRecord::Migration + def self.up + add_column :orders, :created_by_user_id, :integer + end + + def self.down + remove_column :orders, :created_by_user_id + end +end From c17ff281c322da9ddae3ec3f6b00a0081e8bbb52 Mon Sep 17 00:00:00 2001 From: Julius Date: Mon, 12 Nov 2012 14:24:49 +0100 Subject: [PATCH 06/13] Save and display creator of Order --- app/controllers/orders_controller.rb | 2 +- app/helpers/application_helper.rb | 6 ++++++ app/models/order.rb | 6 +++++- app/models/user.rb | 1 + app/views/ordering/_order_head.haml | 3 +++ app/views/ordering/my_order_result.haml | 3 +++ app/views/orders/show.haml | 5 ++++- db/schema.rb | 3 ++- 8 files changed, 25 insertions(+), 4 deletions(-) diff --git a/app/controllers/orders_controller.rb b/app/controllers/orders_controller.rb index c9bb0de7..053a0646 100644 --- a/app/controllers/orders_controller.rb +++ b/app/controllers/orders_controller.rb @@ -172,4 +172,4 @@ class OrdersController < ApplicationController end redirect_to order end -end \ No newline at end of file +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5ea4120c..fbf40827 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -154,5 +154,11 @@ module ApplicationHelper link_to h(address), "http://maps.google.de/?q=#{h(address)}", :title => "Show it on google maps", :target => "_blank" end + + # offers a link for writing message to user + # checks for nil (useful for relations) + def link_to_user_message_if_valid(user) + user.nil? ? '??' : ( link_to user.nick, user_message_path(user), :title => _('Nachricht schreiben') ) + end end diff --git a/app/models/order.rb b/app/models/order.rb index f154501f..2f49345a 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -11,13 +11,17 @@ class Order < ActiveRecord::Base has_many :comments, :class_name => "OrderComment", :order => "created_at" has_many :stock_changes belongs_to :supplier - belongs_to :updated_by, :class_name => "User", :foreign_key => "updated_by_user_id" + belongs_to :updated_by, :class_name => 'User', :foreign_key => 'updated_by_user_id' + belongs_to :created_by, :class_name => 'User', :foreign_key => 'created_by_user_id' # Validations validates_presence_of :starts validate :starts_before_ends, :include_articles # Callbacks + before_create do |order| + order.created_by = User.current_user + end after_update :update_price_of_group_orders # Finders diff --git a/app/models/user.rb b/app/models/user.rb index 81b80e9f..3011d2a4 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -11,6 +11,7 @@ class User < ActiveRecord::Base has_many :tasks, :through => :assignments has_many :send_messages, :class_name => "Message", :foreign_key => "sender_id" has_many :pages, :foreign_key => 'updated_by' + has_many :created_orders, :class_name => 'Order', :foreign_key => 'created_by_user_id', :dependent => :nullify attr_accessor :password, :setting_attributes diff --git a/app/views/ordering/_order_head.haml b/app/views/ordering/_order_head.haml index 126fe200..ada44597 100644 --- a/app/views/ordering/_order_head.haml +++ b/app/views/ordering/_order_head.haml @@ -10,6 +10,9 @@ %p %b Lieferantin: =h @order.name + %p + %b Erstellt von: + =h link_to_user_message_if_valid(@order.created_by) %p %b Ende: =h format_time(@order.ends) diff --git a/app/views/ordering/my_order_result.haml b/app/views/ordering/my_order_result.haml index 14d5b6c7..2177d73c 100644 --- a/app/views/ordering/my_order_result.haml +++ b/app/views/ordering/my_order_result.haml @@ -32,6 +32,9 @@ %p Notiz: =h @order.note + %p + Erstellt von: + =h link_to_user_message_if_valid(@order.created_by) %p Ende: %b=h format_time(@order.ends) diff --git a/app/views/orders/show.haml b/app/views/orders/show.haml index 7d16b185..77b3629e 100644 --- a/app/views/orders/show.haml +++ b/app/views/orders/show.haml @@ -21,6 +21,9 @@ %p Notiz: =h @order.note + %p + Erstellt von: + =h link_to_user_message_if_valid(@order.created_by) %p Beginn: %b=h format_time(@order.starts) @@ -90,4 +93,4 @@ %br/ = submit_tag "Kommentar hinzufügen" - = link_to_top \ No newline at end of file + = link_to_top diff --git a/db/schema.rb b/db/schema.rb index 0e034bbd..033e1ef6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -9,7 +9,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20120622094337) do +ActiveRecord::Schema.define(:version => 20121112093327) do create_table "article_categories", :force => true do |t| t.string "name", :default => "", :null => false @@ -234,6 +234,7 @@ ActiveRecord::Schema.define(:version => 20120622094337) do t.integer "lock_version", :default => 0, :null => false t.integer "updated_by_user_id" t.decimal "foodcoop_result", :precision => 8, :scale => 2 + t.integer "created_by_user_id" end add_index "orders", ["state"], :name => "index_orders_on_state" From 1e725872da97de8aa56f2627bdc4bfc47a43264d Mon Sep 17 00:00:00 2001 From: Julius Date: Mon, 12 Nov 2012 14:39:38 +0100 Subject: [PATCH 07/13] Add advise to modify secret token --- README_DEVEL | 18 +++++++-- config/environment.rb.SAMPLE | 71 ++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 config/environment.rb.SAMPLE diff --git a/README_DEVEL b/README_DEVEL index 060a4ed0..9e6af568 100644 --- a/README_DEVEL +++ b/README_DEVEL @@ -36,7 +36,17 @@ You need to create your own copy of the foodsoft configuration settings: Edit app_config.yml to suit your needs or just keep the defaults for now. -(4) Required ruby and gems +(4) Secret Token +------------------- +The user session are stored in cookies. Do avoid misusing the cookies and its sensitive information, rails +will encrypt it with a token. So copy the config file + + cp config/environment.rb.SAMPLE config/environment.rb + +and modify the token "config.action_controller.session"!!! + + +(5) Required ruby and gems ------------------- We reccomend the using of rvm (https://rvm.beginrescueend.com/). Install rvm and get the lates ruby (1.8.7). If installed you only need to install the gem bundler: @@ -48,7 +58,7 @@ After that you get the other gems easily with (from project root): bundle install -(5) Create database (schema) and load defaults +(6) Create database (schema) and load defaults -------------------------- rake db:create rake db:schema:load @@ -57,8 +67,8 @@ After that you get the other gems easily with (from project root): With this, you also get a ready to go user with username 'admin' and password 'secret'. -(6) Try it out! +(7) Try it out! --------------- Start the WEBrick server to try it out: - script/server \ No newline at end of file + script/server diff --git a/config/environment.rb.SAMPLE b/config/environment.rb.SAMPLE new file mode 100644 index 00000000..0393e60d --- /dev/null +++ b/config/environment.rb.SAMPLE @@ -0,0 +1,71 @@ +# Be sure to restart your web server when you modify this file. + +# Uncomment below to force Rails into production mode when +# you don't control web/app server and can't set it the proper way +# ENV['RAILS_ENV'] ||= 'production' + +# Specifies gem version of Rails to use when vendor/rails is not present +RAILS_GEM_VERSION = '2.3.11' unless defined? RAILS_GEM_VERSION + +# Bootstrap the Rails environment, frameworks, and default configuration +require File.join(File.dirname(__FILE__), 'boot') + +Rails::Initializer.run do |config| + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + # See Rails::Configuration for more options. + + # Skip frameworks you're not going to use (only works if using vendor/rails) + # config.frameworks -= [ :action_web_service, :action_mailer ] + + # Only load the plugins named here, by default all plugins in vendor/plugins are loaded + # config.plugins = [ :exception_notification, :ssl_requirement, :all ] + + # Add additional load paths for your own custom dirs + # config.load_paths += %W( #{RAILS_ROOT}/extras ) + + # Force all environments to use the same logger level + # (by default production uses :info, the others :debug) + # config.log_level = :debug + + # Disable colorized logging output for ActiveRecord: + config.active_record.colorize_logging = false + + # Use the database for sessions instead of the file system + # (create the session table with 'rake db:sessions:create') + # config.action_controller.session_store = :active_record_store + + # Use SQL instead of Active Record's schema dumper when creating the test database. + # This is necessary if your schema can't be completely dumped by the schema dumper, + # like if you have constraints or database-specific column types + # config.active_record.schema_format = :sql + + # Activate observers that should always be running + # config.active_record.observers = :cacher, :garbage_collector + + # Make Active Record use UTC-base instead of local time + config.time_zone = 'Berlin' + + # Specify gems that this application depends on. + # They can then be installed with "rake gems:install" on new installations. + # You have to specify the :lib option for libraries, where the Gem name (sqlite3-ruby) differs from the file itself (sqlite3) + # config.gem "bj" + # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net" + # config.gem "sqlite3-ruby", :lib => "sqlite3" + # config.gem "aws-s3", :lib => "aws/s3" + # + # config.gem "fastercsv" + # config.gem "prawn", :version => '<=0.6.3' + # config.gem "haml", :version => '>=2.0.6' + # config.gem "routing-filter", :lib => "routing_filter" + + # The internationalization framework can be changed to have another default locale (standard is :en) or more load paths. + # library for parsing/writing files from/to csv-file + # All files from config/locales/*.rb,yml are added automatically. + # config.i18n.load_path << Dir[File.join(RAILS_ROOT, 'my', 'locales', '*.{rb,yml}')] + config.i18n.default_locale = :de + + # See Rails::Configuration for more options + config.action_controller.session = { :key => "_myapp_session", :secret => "9195616576518931793179752176417923862176431279acfaedcbeafdcbeafdcbeafcbaefdcbaedcfadcf" } +end From 95efe554fcbb600442fa965fcd1ffa568ebbc6f7 Mon Sep 17 00:00:00 2001 From: Julius Date: Mon, 12 Nov 2012 18:08:47 +0100 Subject: [PATCH 08/13] Add another option for mailing list subscription tip --- app/views/messages/new.haml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/views/messages/new.haml b/app/views/messages/new.haml index 72939eea..d8e0edf9 100644 --- a/app/views/messages/new.haml +++ b/app/views/messages/new.haml @@ -17,8 +17,12 @@ %small{:style => "color:grey"} Eventuell musst Du Dich dem Verteiler erst bekannt machen. %br/ - z.b. mit einer Mail an - = mail_to Foodsoft.config[:mailing_list_subscribe] + - if Foodsoft.config[:mailing_list_unsubscribe].blank? + Erklärungen zum Verteiler findest Du im + = link_to 'Wiki (Abschnitt Mailing-Liste)', wiki_page_path('MailingListe') + - else + z.b. mit einer Mail an + = mail_to Foodsoft.config[:mailing_list_subscribe] %table#recipients %tr %td @@ -58,4 +62,4 @@ %br/ ~ f.text_area :body, :cols => '80', :rows => '20' - = submit_tag "Senden" \ No newline at end of file + = submit_tag "Senden" From e561ddb064476c44515a4db11a4cbd74350835a9 Mon Sep 17 00:00:00 2001 From: Julius Date: Mon, 12 Nov 2012 20:14:06 +0100 Subject: [PATCH 09/13] Fix task validation #16 --- app/controllers/tasks_controller.rb | 5 ++--- app/models/task.rb | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index ee11b6a8..d2012319 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -17,14 +17,13 @@ class TasksController < ApplicationController def create @task = Task.new(params[:task]) - if @task.errors.empty? - @task.save + if @task.save flash[:notice] = "Aufgabe wurde erstellt" if @task.workgroup redirect_to :action => "workgroup", :id => @task.workgroup else redirect_to :action => "index" - end + end else render :template => "tasks/new" end diff --git a/app/models/task.rb b/app/models/task.rb index 7a3dfacf..b1f9de3a 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -11,7 +11,7 @@ class Task < ActiveRecord::Base attr_protected :users validates_length_of :name, :minimum => 3 - validates_numericality_of :duration, :required_users, :only_integer => true, :greater_than => 1 + validates_numericality_of :duration, :required_users, :only_integer => true, :greater_than_or_equal_to => 1 after_save :update_ordergroup_stats From d086fe7cc7496383b9af735d17f8c587a7d530d1 Mon Sep 17 00:00:00 2001 From: Julius Date: Mon, 12 Nov 2012 21:31:04 +0100 Subject: [PATCH 10/13] Fix task validation again #16; mark assignment validation TODO --- app/controllers/tasks_controller.rb | 5 ++--- app/models/task.rb | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index d2012319..57bff129 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -17,7 +17,7 @@ class TasksController < ApplicationController def create @task = Task.new(params[:task]) - if @task.save + if @task.errors.empty? && @task.save flash[:notice] = "Aufgabe wurde erstellt" if @task.workgroup redirect_to :action => "workgroup", :id => @task.workgroup @@ -40,8 +40,7 @@ class TasksController < ApplicationController def update @task = Task.find(params[:id]) @task.attributes=(params[:task]) - if @task.errors.empty? - @task.save + if @task.errors.empty? && @task.save flash[:notice] = "Aufgabe wurde aktualisiert" if @task.workgroup redirect_to :action => "workgroup", :id => @task.workgroup diff --git a/app/models/task.rb b/app/models/task.rb index b1f9de3a..f32e6ebd 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -29,6 +29,8 @@ class Task < ActiveRecord::Base # extracts nicknames from a comma seperated string # and makes the users responsible for the task + # TODO: check for uniqueness + # TODO: check for maximal number of users def user_list=(string) @user_list = string.split(%r{,\s*}) new_users = @user_list - users.collect(&:nick) From a8d61d25916369281fd88a253ebb989704a24071 Mon Sep 17 00:00:00 2001 From: Robert Waltemath Date: Tue, 13 Nov 2012 10:12:06 +0100 Subject: [PATCH 11/13] Removed environment.rb to avoid overwriting it on update. --- README_DEVEL | 5 ++- config/environment.rb | 71 ------------------------------------------- 2 files changed, 2 insertions(+), 74 deletions(-) delete mode 100644 config/environment.rb diff --git a/README_DEVEL b/README_DEVEL index 9e6af568..b82d2225 100644 --- a/README_DEVEL +++ b/README_DEVEL @@ -38,12 +38,11 @@ Edit app_config.yml to suit your needs or just keep the defaults for now. (4) Secret Token ------------------- -The user session are stored in cookies. Do avoid misusing the cookies and its sensitive information, rails -will encrypt it with a token. So copy the config file +The user session is stored in a cookie. To avoid misusing the cookies and its sensitive information, rails will encrypt it with a token. So copy the config file cp config/environment.rb.SAMPLE config/environment.rb -and modify the token "config.action_controller.session"!!! +and modify the token "config.action_controller.session"! (5) Required ruby and gems diff --git a/config/environment.rb b/config/environment.rb deleted file mode 100644 index 0393e60d..00000000 --- a/config/environment.rb +++ /dev/null @@ -1,71 +0,0 @@ -# Be sure to restart your web server when you modify this file. - -# Uncomment below to force Rails into production mode when -# you don't control web/app server and can't set it the proper way -# ENV['RAILS_ENV'] ||= 'production' - -# Specifies gem version of Rails to use when vendor/rails is not present -RAILS_GEM_VERSION = '2.3.11' unless defined? RAILS_GEM_VERSION - -# Bootstrap the Rails environment, frameworks, and default configuration -require File.join(File.dirname(__FILE__), 'boot') - -Rails::Initializer.run do |config| - # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers - # -- all .rb files in that directory are automatically loaded. - # See Rails::Configuration for more options. - - # Skip frameworks you're not going to use (only works if using vendor/rails) - # config.frameworks -= [ :action_web_service, :action_mailer ] - - # Only load the plugins named here, by default all plugins in vendor/plugins are loaded - # config.plugins = [ :exception_notification, :ssl_requirement, :all ] - - # Add additional load paths for your own custom dirs - # config.load_paths += %W( #{RAILS_ROOT}/extras ) - - # Force all environments to use the same logger level - # (by default production uses :info, the others :debug) - # config.log_level = :debug - - # Disable colorized logging output for ActiveRecord: - config.active_record.colorize_logging = false - - # Use the database for sessions instead of the file system - # (create the session table with 'rake db:sessions:create') - # config.action_controller.session_store = :active_record_store - - # Use SQL instead of Active Record's schema dumper when creating the test database. - # This is necessary if your schema can't be completely dumped by the schema dumper, - # like if you have constraints or database-specific column types - # config.active_record.schema_format = :sql - - # Activate observers that should always be running - # config.active_record.observers = :cacher, :garbage_collector - - # Make Active Record use UTC-base instead of local time - config.time_zone = 'Berlin' - - # Specify gems that this application depends on. - # They can then be installed with "rake gems:install" on new installations. - # You have to specify the :lib option for libraries, where the Gem name (sqlite3-ruby) differs from the file itself (sqlite3) - # config.gem "bj" - # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net" - # config.gem "sqlite3-ruby", :lib => "sqlite3" - # config.gem "aws-s3", :lib => "aws/s3" - # - # config.gem "fastercsv" - # config.gem "prawn", :version => '<=0.6.3' - # config.gem "haml", :version => '>=2.0.6' - # config.gem "routing-filter", :lib => "routing_filter" - - # The internationalization framework can be changed to have another default locale (standard is :en) or more load paths. - # library for parsing/writing files from/to csv-file - # All files from config/locales/*.rb,yml are added automatically. - # config.i18n.load_path << Dir[File.join(RAILS_ROOT, 'my', 'locales', '*.{rb,yml}')] - config.i18n.default_locale = :de - - # See Rails::Configuration for more options - config.action_controller.session = { :key => "_myapp_session", :secret => "9195616576518931793179752176417923862176431279acfaedcbeafdcbeafdcbeafcbaefdcbaedcfadcf" } -end From 2bd52b9270949cbd970b66b4c633139859b729bf Mon Sep 17 00:00:00 2001 From: Robert Waltemath Date: Tue, 13 Nov 2012 10:18:40 +0100 Subject: [PATCH 12/13] Corrected config hash index to ':mailing_list_subscribe' --- app/views/messages/new.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/messages/new.haml b/app/views/messages/new.haml index d8e0edf9..ee119d96 100644 --- a/app/views/messages/new.haml +++ b/app/views/messages/new.haml @@ -17,7 +17,7 @@ %small{:style => "color:grey"} Eventuell musst Du Dich dem Verteiler erst bekannt machen. %br/ - - if Foodsoft.config[:mailing_list_unsubscribe].blank? + - if Foodsoft.config[:mailing_list_subscribe].blank? Erklärungen zum Verteiler findest Du im = link_to 'Wiki (Abschnitt Mailing-Liste)', wiki_page_path('MailingListe') - else From 8c0af4bd87d07dafe31e2d8ac67d71cb655c7b0b Mon Sep 17 00:00:00 2001 From: Robert Waltemath Date: Wed, 14 Nov 2012 09:52:32 +0100 Subject: [PATCH 13/13] Documented config/initializers/session_store.rb --- README_DEVEL | 2 +- config/{environment.rb.SAMPLE => environment.rb} | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) rename config/{environment.rb.SAMPLE => environment.rb} (95%) diff --git a/README_DEVEL b/README_DEVEL index b82d2225..53d20372 100644 --- a/README_DEVEL +++ b/README_DEVEL @@ -40,7 +40,7 @@ Edit app_config.yml to suit your needs or just keep the defaults for now. ------------------- The user session is stored in a cookie. To avoid misusing the cookies and its sensitive information, rails will encrypt it with a token. So copy the config file - cp config/environment.rb.SAMPLE config/environment.rb + cp config/initializers/session_store.rb.SAMPLE config/initializers/session_store.rb and modify the token "config.action_controller.session"! diff --git a/config/environment.rb.SAMPLE b/config/environment.rb similarity index 95% rename from config/environment.rb.SAMPLE rename to config/environment.rb index 0393e60d..b5d15ab0 100644 --- a/config/environment.rb.SAMPLE +++ b/config/environment.rb @@ -67,5 +67,4 @@ Rails::Initializer.run do |config| config.i18n.default_locale = :de # See Rails::Configuration for more options - config.action_controller.session = { :key => "_myapp_session", :secret => "9195616576518931793179752176417923862176431279acfaedcbeafdcbeafdcbeafcbaefdcbaedcfadcf" } end