ruby-on-rails-3.2

An error occurred while installing libv8 (3.11.8.13), and Bundler cannot continue

点点圈 提交于 2019-12-04 07:39:42
After run bundle install I get this error: Gem::Package::FormatError: no metadata found in /Users/jeanosorio/.rvm/gems/ruby-1.9.3-p286/cache/libv8-3.11.8.13-x86_64-darwin-12.gem An error occurred while installing libv8 (3.11.8.13), and Bundler cannot continue. Make sure that `gem install libv8 -v '3.11.8.13'` succeeds before bundling. I try with gem install libv8 -v '3.11.8.13' But I get ERROR: Error installing libv8: invalid gem format for /Users/jeanosorio/.rvm/gems/ruby-1.9.3-p286/cache/libv8-3.11.8.13-x86_64-darwin-12.gem What is the problem here. Please some help. Prakash Murthy The Gem:

PrivatePub is not defined error Rails 3.2 private pub

匆匆过客 提交于 2019-12-04 07:30:52
I want to use private pub gem in my rails application. I implement with railscast 316 After rails g private_pub:install my private_pub.yml file: development: server: "http://0.0.0.0:9292/faye" secret_token: "secret" test: server: "http://0.0.0.0:9292/faye" secret_token: "secret" production: server: "http://0.0.0.0/faye" secret_token: "98ec77eb7077c9899dc53f003abc4d6a0170512a57feab126ed5a32b114e3613" signature_expiration: 3600 # one hour my private_pub.ru file # Run with: rackup private_pub.ru -s thin -E production require "bundler/setup" require "yaml" require "faye" require "private_pub" Faye

Devise render sign => up/in form partials elsewhere in code

我只是一个虾纸丫 提交于 2019-12-04 07:20:27
I'm just starting with Devise and Rails3. I have the Authenetication down and working and understand the basics. As of now in my Home Controller that represents my Home/Front Page i have two links one that links to Register => sign_up and one that changes depending on login/logout => sign_in/sign_out. However i dont want to redirect my user to login page. Instead i want to display my login form on my front page. So i have seperated the devise/session/new template int to a view and a _form.html.erb partial. And now in my home view i render the login form as so: <% if user_signed_in? %> Welcome:

!! Unexpected error while processing request: failed to allocate memory

落爺英雄遲暮 提交于 2019-12-04 06:53:08
问题 Please help me in solving this error. I am getting this error while loading records from text files in to database using ruby scripts. It just works fine if I use small number of records to load in to the database.But fails if there are large number of records. CSV.foreach(fileName) do |line| completePath = line[0] num_of_bps = line[1] completePath = cluster_path+ '/' + completePath inode = FileOrFolder.find_by_fullpath(completePath, :select=>"id") metric_instance = MetricInstance.find(:first

What is `stringify_keys' in rails and how to solve it when this error comes

寵の児 提交于 2019-12-04 06:22:11
In a partial file of my application I have the following code snippet for displaying user navigation(through Devise):- <ul class="nav pull-right"> <% if user_signed_in? %> <li> <%= current_user.email do %> <i class=" icon-user icon-black"></i> <% end %> </li> <li> <%= link_to "Your Links", profiles_index_path do %> <i class=" icon-user icon-black"></i> <% end %> </li> <li> <%= link_to "Sign out", destroy_user_session_path, :method => 'delete' do %> <i class=" icon-user icon-black"></i> <% end %> </li> <% else %> <li> <%= link_to "Login", new_user_session_path do %> <i class=" icon-lock"></i> <

Strong parameters and multidimensional arrays

…衆ロ難τιáo~ 提交于 2019-12-04 06:21:24
I'm using Rails 3.2.6 with strong parameters gem. So, I' have a controller with the typical update action: # PUT /api/resources/:id def update @resource.update_attributes! permited_params respond_with_json @resource, action: :show end Then, I have the permited_params method def permited_params params.permit(:attr1, :attr2, :attr3) end The problem is that :attr3 is a multidimensional array like this: [[1, 2], [2, 5, 7]] Following the documentation, I need to specify :attr3 as an array. But... params.permit(:attr1, :attr2, :attr3 => []) #inspecting permited_params: {"attr1"=>"blah", "attr2"=>

SQL Like operator in ruby on rails

爷,独闯天下 提交于 2019-12-04 02:37:40
I had got a task to select search the students those name start with param value and city in the selected value.How can i set in ruby on rails? i did like this but this is not working controller def list studentcount=Student.count() puts studentcount @studentname = Student.where("name name1 AND city = :cityId1", {:name1 => params[:name], :cityId1 => params[:cityId]}) puts 'studentname' puts @studentname.inspect @students = Student.limit(params[:jtPageSize]).offset(params[:jtStartIndex]).order(params[:jtSorting]) @jtable = {'Result' => 'OK','Records' => @students.map(&:attributes),

Symbols in query-string for elasticsearch

雨燕双飞 提交于 2019-12-04 02:01:42
I have "documents" (activerecords) with an attribute called deviations. The attribute has values like "Bin X" "Bin $" "Bin q" "Bin %" etc. I am trying to use tire/elasticsearch to search the attribute. I am using the whitespace analyzer to index the deviation attribute. Here is my code for creating the indexes: settings :analysis => { :filter => { :ngram_filter => { :type => "nGram", :min_gram => 2, :max_gram => 255 }, :deviation_filter => { :type => "word_delimiter", :type_table => ['$ => ALPHA'] } }, :analyzer => { :ngram_analyzer => { :type => "custom", :tokenizer => "standard", :filter =>

rails activesupport notifications - wrong db runtime value

余生颓废 提交于 2019-12-04 01:44:33
I'm trying to log requests for my REST API application. I'm using rails notifications for this , like here http://railscasts.com/episodes/249-notifications-in-rails-3 I can't understand how to solve one problem with rails notifications. my initializer code ActiveSupport::Notifications.subscribe "process_action.action_controller" do |name, start, finish, id, payload| p name p start p finish p id p payload end Controller respond section class PostsController < ApplicationController # GET /posts # GET /posts.json respond_to :json, :html .... end Controller create action def create @post = Post

Rails 3.2.6 & database views creation through migrations

China☆狼群 提交于 2019-12-04 01:35:00
I'm using rails 3.2.6 and I need to create a database VIEW. As usual I created a migration and I tried to achieve the goal using the execute method. Unfortunately the migration generates a table, not a view. Why? Many thanks in advance, Mauro UPDATE: I would like to have something as follows: class CreateMyView < ActiveRecord::Migration def self.up execute <<-SQL CREATE VIEW my_view AS SELECT ... SQL end def self.down execute <<-SQL DROP VIEW my_view SQL end end Unfortunately this migration creates a table... UPDATE: the previous code works! I was executing rake db:reset instead of rake db