This is my first time launching a rails app in a production environment. I first ran rails server -e production then had to get the secret key. Afterwards I ran this line bundle exec rake assets:precompile db:migrate RAILS_ENV=production. Once I ran that line I ran rails server -e production one more time I got the following error in my terminal (See last 4 lines) along with the 404 error page in my browser:
krav#krav-Q534UXK:~/Desktop/cnd$ rails server -e production
=> Booting Puma
=> Rails 5.1.3 application starting in production on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.10.0 (ruby 2.3.3-p222), codename: Russell's Teapot
* Min threads: 5, max threads: 5
* Environment: production
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop
/home/krav/Desktop/cnd/app/views/creatives/index.html.erb:20: warning: key :data is duplicated and overwritten on line 20
/home/krav/Desktop/cnd/app/views/creatives/index.html.erb:20: warning: key :data is duplicated and overwritten on line 20
/home/krav/Desktop/cnd/app/views/creatives/index.html.erb:107: warning: key :data is duplicated and overwritten on line 107
/home/krav/Desktop/cnd/app/views/creatives/index.html.erb:107: warning: key :data is duplicated and overwritten on line 107
When I go to the lines that are giving an error here they are respectively:
Line 20
<%= image_tag "AdobeStock_95578405.jpeg" ,alt: "slidebg1", :data => {bgposition: "center bottom"} , :data => {bgrepeat: "no-repeat"} ,:data => {bgfit: "cover"} , :class => "rev-slidebg" %>
Line 107
<%= image_tag "AdobeStock_108067927.jpeg" ,alt: "slidebg1", :data => {bgposition: "center bottom"} , :data => {bgrepeat: "no-repeat"} ,:data => {bgfit: "cover"} , :class => "rev-slidebg" %>
In development this works fine. I cannot figure out why these lines are giving me an error and not allowing the web app to launch they look right and got me the look I needed when I was in development mode.
The lines have duplicate key of data in them and should only have one:
i.e. this:
<%= image_tag "AdobeStock_95578405.jpeg" ,alt: "slidebg1", :data => {bgposition: "center bottom"} , :data => {bgrepeat: "no-repeat"} ,:data => {bgfit: "cover"} , :class => "rev-slidebg" %>
should be this: <%= image_tag "AdobeStock_95578405.jpeg" ,alt: "slidebg1", :data => {bgposition: "center bottom",bgrepeat: "no-repeat", bgfit: "cover"} , :class => "rev-slidebg" %>
Related
I am running a rails application (rails: 4.2 and ruby 2.2.3). I am trying to update my ruby to 2.4.4 and have been able to successfully run bundle install. However, when I start the server and go to the home page of my application, I encounter a unexpected = in the application.html.haml file for this line:
= favicon_link_tag 'favicon.ico'
Has anyone here encountered an error like this?
P.S. if this question has been posted before can someone redirect me to it as I cannot find this problem.
%head
%base{:href => "/dashboard"}
%title Title Page
= favicon_link_tag 'favicon.ico'
= stylesheet_link_tag "application", :media => nil
= javascript_include_tag "application"
= csrf_meta_tags
%body{'ng-app'=>'thumper','ng-controller'=>'MainController'}
- if signed_in?
.navbar.navbar-inverse.navbar-fixed-top{:style => 'padding-top:0px;height: 30px;'}
.container
%button.navbar-toggle{"data-target" => ".navbar-collapse", "data-toggle" => "collapse"}
%a.navbar-brand{:href => "/", :target => "_self"}
= image_tag "main_image.png", :style => 'width:65px;', :alt => 'company_name'
.navbar-collapse.collapse
%ul.nav.navbar-nav
%li
%a{:href => "/faq", :target => "_self"}
%i.fa.fa-lightbulb-o
FAQ
%li
This is my initial part of my application.html.haml file. I get the following error:
DEPRECATED: Please use restforce (https://github.com/ejholmes/restforce) instead.
=> Booting Thin
=> Rails 4.2.11 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Thin web server (v1.7.2 codename Bachmanity)
Maximum connections set to 1024
Listening on localhost:3000, CTRL+C to stop
Started GET "/testpage" for 127.0.0.1 at 2019-03-12 09:32:47 -0500
ActiveRecord::SchemaMigration Load (44.9ms) SELECT `schema_migrations`.* FROM `schema_migrations`
Processing by TestController#foo as HTML
HERE
Rendered test/foo.html within layouts/application (2.9ms)
Completed 500 Internal Server Error in 1964ms (ActiveRecord: 0.0ms)
ExecJS::RuntimeError - SyntaxError: [stdin]:959:20: unexpected =:
app/views/layouts/application.html.haml:7:in `_app_views_layouts_application_html_haml___861496224579637971_70314333220700'
app/lib/cors.rb:12:in `call'
app/lib/cors.rb:12:in `call'
Started POST "/__better_errors/1f18681361fed4ae/variables" for 127.0.0.1 at 2019-03-12 09:32:50 -0500
The web browser looks like this:
Here the thing: I have multiples search fields in my form. But i got the error RequestURITooLarge when I tried to do a multiples searches...I'm wondering if it is exist a method to avoid this problem. Every time you fill the text box or date field increment the url and got the error. I also tried a reset button but just clean the text fields. Here the code for you to understand the method I use and perhaps will help you in some way. Tks!!
View_item
def self.search(s_codigo, s_den_cont, s_marca)
where("codigo ilike :s_c and den_cont ilike :s_d and marca ilike :s_m", s_c: "%#{s_codigo}%", s_d: "%#{s_den_cont}%", s_m: "%#{s_marca}%")
end
#Search section #2
def self.search_fec_min(s_codigo, s_den_cont, s_marca, s_fec_min)
where("codigo ilike :s_c and den_cont ilike :s_d and marca ilike :s_m and date_expired >= :s_fmin", s_c: "%#{s_codigo}%", s_d: "%#{s_den_cont}%", s_m: "%#{s_marca}%", s_fmin: "#{s_fec_min}")
end
index
<%= text_field_tag :s_codigo, params[:s_codigo], placeholder: "Search for cod" %>
<%= text_field_tag :s_den_cont, params[:s_den_cont], placeholder: "Search for Denominación" %>
<%= text_field_tag :s_marca, params[:s_marca], placeholder: "Search brand" %>
<%= date_select :s_fec_min, params[:s_fec_min], placeholder: "Search for date", :include_blank => true %>
Controller
if self.is_date(params[:s_fec_min])
#items = View_item.all.order("date_expired ASC").page(params[:page]).per(15).search_fec_min(params[:s_codigo], params[:s_den_cont], params[:s_marca], params[:s_fec_min])
elsif (params[:s_codigo] != "" or params[:s_den_cont] != "" or params[:s_marca] != "")
#items = View_item.all.order("date_expired ASC").page(params[:page]).per(15).search(params[:s_codigo], params[:s_den_cont], params[:s_marca])
else
#items = View_item.all.order("date_expired ASC").page(params[:page]).per(15)
end
MAX_URI_LENGTH is set to only 2083 characters for webrick server. On accessing url of length more than this limit throws WEBrick::HTTPStatus::RequestURITooLarge exception.
Try to switch to different server :
#Gemfile
gem 'thin'
$bundle install
$ rails s
=> Booting Thin
=> Rails 4.2.0 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Thin web server (v1.6.3 codename Protein Powder)
Maximum connections set to 1024
Listening on localhost:3000, CTRL+C to stop
I have installed openLDAP and using net-ldap to work with that in Ruby on Rails. The thing here is i am able to bind and serach with this gem, but qhen it comes to add an entry to directory:
#auth = {:method => :simple, :username => "cn=admin,dc=example,dc=test", :password => "password"}
PORT = 389
HOST = "127.0.1.1"
NET::LDAP.open(:host => HOST, :port => PORT, :auth => #auth) do |ldap|
#ldap.add(:dn => dn, :attributes => attr) .
this error stop everyhing: uninitialized constant LdapsController::NET,[point to open line]
net-ldap is installed
ruby 2
rails 4
os: Ubuntu 13.4
Have you tried:
Net::LDAP
Case matter!
My configuration:
Ruby implementation:
jruby 1.7.5 (1.9.3p392) 2013-10-07 74e9291 on Java HotSpot(TM) Client VM 1.7.0_25-b16 [Windows Server 2008 R2-x86]
Operating system:
Microsoft Windows Server 2008 R2 [Version 6.1.7601]
Database:
PostgreSQL 9.3
Server:
Webrick
Environment:
Redmine version 2.3.3.stable
Ruby version 1.9.3-p392 (2013-10-07) [java]
Rails version 3.2.13
Environment production
Database adapter PostgreSQL
Redmine plugins:
no plugin installed
When I try to access Admin->Settings with Russian translation, I'm get Internal Error:
ActionView::Template::Error (invalid byte sequence in UTF-8):
7:
8: <p><%= setting_select :start_of_week, [[day_name(1),'1'], [day_name(6),'6'], [day_name(7),'7']], :blank => :label_language_based ></p>
9: < locale = User.current.language.blank? ? ::I18n.locale : User.current.language %>
10: <p><%= setting_select :date_format, Setting::DATE_FORMATS.collect {|f| [::I18n.l(Date.today, :locale => locale, :format => f), f]}, :blank => :label_language_based %></p>
11:
12: <p><%= setting_select :time_format, Setting::TIME_FORMATS.collect {|f| [::I18n.l(Time.now, :locale => locale, :format => f), f]}, :blank => :label_language_based %></p>
13:
app/helpers/settings_helper.rb:38:in `setting_select'
app/views/settings/_display.html.erb:10:in `_app_views_settings__display_html_erb__912948922_14104'
app/views/settings/_display.html.erb:1:in `_app_views_settings__display_html_erb__912948922_14104'
app/views/common/_tabs.html.erb:24:in `_app_views_common__tabs_html_erb__398022901_13972'
app/views/common/_tabs.html.erb:23:in `_app_views_common__tabs_html_erb__398022901_13972'
app/helpers/application_helper.rb:271:in `render_tabs'
app/views/settings/edit.html.erb:3:in `_app_views_settings_edit_html_erb___540221663_13968'
app/controllers/settings_controller.rb:28:in `index'
If I replace in config/locales/ru.yml month_name 'октября' with 'October' and time:am 'утра' with 'am', then everything is going fine.
Please help me to fix this problem in the right way.
Thank for any help!
PS: Sorry for my bad english:)
Problem lies in jruby strftime: it breaks unicode characters in format string... Fixed with jruby 1.7.6 release.
I resolved it with chmod 0777 tmp/cache
I'm trying to switch the session store in Rails 3 by changing the
config/application.rb as following:
config/application.rb
#-----------------------------------
memcache_options = {
:compression => true,
:debug => false,
:namespace => "xx-cache",
:readonly => false,
:urlencode => false
}
CACHE = MemCache.new(memcache_options)
CACHE.servers = ['127.0.0.1:17898']
#check if CACHE is connected
#puts CACHE
config.action_dispatch.session = {
:session_key => '_xx_session',
:secret => 'xx',
:cache => CACHE,
:expires => 900
}
config.action_dispatch.session_store = :mem_cache_store
#-----------------------------------
Memcache server is running. However, when run rails s, i got this
message:
=> Booting WEBrick
=> Rails 3.0.0.beta3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.0.0.beta3/lib/
action_dispatch/middleware/session/mem_cache_store.rb:19:in
`initialize': #<ActionDispatch::Session::MemCacheStore:0xa302950>
unable to find server during initialization. (RuntimeError)
It seems the session options was not passed correctly. But i'm not
sure what's wrong here cause I'm new to Rails.
Any help will be appreciated.
Thanks
I'm not -entirely- sure, but I think you need to include "cached_model." Try adding
require 'cached_model' #(At the top)
Let me know if that worked.