ruby-on-rails-3

Undefined method `stringify_keys' in Messages Controller

纵然是瞬间 提交于 2020-01-15 23:05:15
问题 I am getting the following error when I try to submit a form (the form shows up when 1 user wants to message another user) NoMethodError in MessagesController#create undefined method `stringify_keys' for "":String Rails.root: /Users/fkhalid2008/loand Application Trace | Framework Trace | Full Trace app/controllers/messages_controller.rb:31:in `new' app/controllers/messages_controller.rb:31:in `create' Here is the relevant code from Messages Controller: def new @message = Message.new if params

call jar file from ruby class

杀马特。学长 韩版系。学妹 提交于 2020-01-15 16:43:35
问题 How to call jar file (a java archive file) from ruby class. And access the functions/methods from it. I am refering the following link But I am getting the following error: 'require': cannot load such file -- /tmp/Test.jar (LoadError) How can I resolve this issue. 回答1: You can use a system call. You may have performance issues if you have lots of users, but for most this should work: # Create a directory (in this sample called "jars") inside public directory and move your jar file inside the

call jar file from ruby class

爷,独闯天下 提交于 2020-01-15 16:40:36
问题 How to call jar file (a java archive file) from ruby class. And access the functions/methods from it. I am refering the following link But I am getting the following error: 'require': cannot load such file -- /tmp/Test.jar (LoadError) How can I resolve this issue. 回答1: You can use a system call. You may have performance issues if you have lots of users, but for most this should work: # Create a directory (in this sample called "jars") inside public directory and move your jar file inside the

sphinxql: syntax error, unexpected IDENT

我与影子孤独终老i 提交于 2020-01-15 12:39:06
问题 Getting this error with sphinx 2 sphinxql: syntax error, unexpected IDENT, expecting CONST_INT or CONST_FLOAT or '-' near 'WI AND published = 1 AND sphinx_deleted = 0 LIMIT 0, 10; SHOW META' index.html.erb error is being thrown in the template at the line of a partial collection: @posts_by_state, but two other instances of the same partial are working great. The State sort is what is throwing it off. posts_controller.rb @posts_by_state = Post.search(params[:search], with: { state: current

Rails, Rake aborted! undefined method 'active_record'

人走茶凉 提交于 2020-01-15 11:46:06
问题 I'm sure I miss some basic thing. I had a correctly working app in dev environment. Than I had some modifications that I cant correctly explain (with the migrations and tried to insert seed_dump gem). Now every rake command drops an error: C:\Programozas\Rails Apps\sorsveto>rake about rake aborted! undefined method `active_record' for #<Rails::Application::Configuration:0x3e482 98> Tasks: TOP => about => environment (See full trace by running task with --trace) or C:\Programozas\Rails Apps

Rails, Rake aborted! undefined method 'active_record'

淺唱寂寞╮ 提交于 2020-01-15 11:46:03
问题 I'm sure I miss some basic thing. I had a correctly working app in dev environment. Than I had some modifications that I cant correctly explain (with the migrations and tried to insert seed_dump gem). Now every rake command drops an error: C:\Programozas\Rails Apps\sorsveto>rake about rake aborted! undefined method `active_record' for #<Rails::Application::Configuration:0x3e482 98> Tasks: TOP => about => environment (See full trace by running task with --trace) or C:\Programozas\Rails Apps

Thinking Sphinx after deployment - ThinkingSphinx::SphinxError (unknown local index 'user_core' in search request):

雨燕双飞 提交于 2020-01-15 10:48:04
问题 I check this topic: Sphinx error: unknown local index "INDEX_NAME" in search request , but it's closed and it's not resolve problem in my rails application. I update TS to 3.0.2, and include it to deploy.rb. I also change code in model. Now it works in development, and some examples work in test, and some not. But after successful deployment I get error: ThinkingSphinx::SphinxError (unknown local index 'user_core' in search request): I try rebuild, restart, and other things, but it doesn't

In gmaps4rails, how do I move the map so the marker is in view?

拟墨画扇 提交于 2020-01-15 10:42:55
问题 I have a set of locations that I want to bring up, individually through ajax calls, and some of them aren't within the current bounds of the map. Is there a way to move the map so the marker is in view? I don't need it to be in the center, just as long as it's in view. 回答1: I figured it out after some research. I'd still be curious to know how to NOT have to center if the marker is visible on the map. var centerpoint = new google.maps.LatLng(lat_value, long_value); Gmaps4Rails.map.setCenter

In an angular app, href in <a> doesn't reloads the page

此生再无相见时 提交于 2020-01-15 08:38:32
问题 I have an angular app <html ng-app='sampApp'> </html> I have an anchor link inside the app. <a href='/user/profile'>Redirect here</a> But the page is not getting reloaded on clicking the anchor tag. It just makes an ajax call to render the page. 回答1: Standard url used in angular start with #, unless you are using html5 model, so the anchor should be <a href='#/user/profile'>Redirect here</a> If you want to do full page refresh or page redirect, then you need to stop Angular from intercepting

Active record has_many association for one model having two types of values

那年仲夏 提交于 2020-01-15 08:17:34
问题 i am facing a new situation. I know someone definitely had faced these type of situation: I have an invoices table and an invoice_line_items table. Till now every thing is going well with has_many and belongs to association. Now i want to add tax accounts in invoice items, for that i don't want to create a separate table, hence i make below changes in my invoice model : invoice.rb: class Invoice < ActiveRecord::Base has_many :invoice_line_items has_many :tax_line_items, :class_name =>