[Rails] Re: I Love Ruby Updated

2016-01-17 Thread Vivek Sampara
Isn't that what mailpile has started to do as well? On Saturday, 16 January 2016 13:07:57 UTC+5:30, Manish wrote: > > Hello People, > > I have updated my Ruby book I Love Ruby. Please get it here > https://cloud.openmailbox.org/index.php/s/u4sX065QRgjbJL2/download > > If possible, try

[Rails] Template management similar to Shopify - Architecture Recommendations

2015-05-21 Thread Vivek Sampara
templates on all application servers - IO operation 2. Store templates in database and cache those template queries 3. Store templates in REDIS as a HASH structure and retrieve accordingly . Would love to know your thoughts ? Thanks Vivek Sampara -- You received this message because you

Re: [Rails] (undefined method `each' for nil:NilClass) while doing Getting started tutorial

2015-03-26 Thread Vivek Sampara
2 Possibilities. 1. Did you run your migrations 2. Did you restart your server after that ? On Thu, Mar 26, 2015 at 3:42 AM, Med Potter medya...@gmail.com wrote: I followed every line of the tutorial but I get this error Showing /home/ubuntu/blog/app/views/articles/index.html.erb where line

Re: [Rails] Re: Re: Re: Re: which Gem To Used For Building A Site Like Mediafire

2015-03-22 Thread Vivek Sampara
There are some nice people (colin) who try to keep this community free from junk and help genuinely. And there are some ignorant people like you who doesn't give a rats ass to do your homework before asking a question here. I don't mean to say asking stupid questions is wrong but the least you

Re: [Rails] Localhost subdomains with Ubuntu, Vagrant and Webrick

2015-03-19 Thread Vivek Sampara
1. Did you save the hosts file ? 2. Did you restart your network ? On Thu, Mar 19, 2015 at 7:49 PM, Leandro França leandroayresfra...@gmail.com wrote: Hi there, I'm using act_as_tenant gem and I would like to test it on my local environment. I need to have entries like app1.localhost,

Re: [Rails] Problem with current_page? request.url.

2015-03-14 Thread Vivek Sampara
current_page?(controller: params[:controller], action: params[:action]) is not a recommended way to check as params[:controller] and params[:action] are created during the action dispatch flow. what is the output for this ? current_page?(controller: 'courses', action: 'index') On Sat, Mar 14,

Re: [Rails] Looking for input from skilled devs on the potential of this project

2015-03-13 Thread Vivek Sampara
*a system that automatically captures leads from all sources **including phone, -* *- A from that takes inputs - also has a parser which can analyze and create data. * *dumps them into one easy to use contact management system, * *The end structured data is moved to a contact management system

Re: [Rails] Rails Server gets killed without a error message

2015-03-13 Thread Vivek Sampara
What do you see in the logs ? On 13 Mar 2015 21:13, Roelof Wobben rwob...@hotmail.com wrote: Hello, I working on a new project and made all the templates ready. But as soon as I do rails s I see this output : Started GET / for 82.74.205.109 at 2015-03-13 15:25:30 + Killed Anyone a

Re: [Rails] Rails Server gets killed without a error message

2015-03-13 Thread Vivek Sampara
+ Started GET /assets/application.js?body=1 for 82.74.205.109 at 2015-03-13 13:16:53 + Started GET / for 82.74.205.109 at 2015-03-13 15:25:12 + Started GET / for 82.74.205.109 at 2015-03-13 15:25:30 + Roelof Op vrijdag 13 maart 2015 16:54:38 UTC+1 schreef Vivek Sampara

Re: [Rails] Re: ruby on rails first app creating problem

2015-03-09 Thread Vivek Sampara
Yes. you wont find any performance issues between a MAC and UBUNTU. But i personally like MAC :) On Mon, Mar 9, 2015 at 3:09 PM, moein rahimi melinaja...@gmail.com wrote: On Sunday, March 8, 2015 at 5:57:20 PM UTC+3:30, James Davis, PhD wrote: Please post the entire error message. While

Re: [Rails] job Mumbai or Pune or Goa

2015-02-14 Thread Vivek Sampara
compensation: approximately 55 What ? ( currency ? ) On Sat, Feb 14, 2015 at 10:34 PM, todd toddo...@gmail.com wrote: Ruby on Rails Developer (pune) compensation: approximately 55, negotiable Collaborator on Ruby on rails project (mumbai) compensation: approximately 55 I am a very junior

Re: [Rails] Now hiring - Senior Ruby on Rails Engineer

2015-02-13 Thread Vivek Sampara
Lol, Awesome reply Colin ! On Fri, Feb 13, 2015 at 7:01 PM, Colin Law clan...@gmail.com wrote: On 13 February 2015 at 12:48, GraceUltimate Ruhland 4ultimateski...@gmail.com wrote: Job Description We Are Looking For An Accomplished And Passionate Senior Ruby On Rails Engineer To Build A

Re: [Rails] Re: How to upgrade rails application on client server

2015-02-04 Thread Vivek Sampara
We went the route of ssh / access and failed horribly. We moved the code base to jruby and started releasing Warable files . This way, updates go in with a single click along with all the bundled latest gems. Try it out. On Wed, Feb 4, 2015 at 3:16 PM, Colin Law clan...@gmail.com wrote: On 4

Re: [Rails] Finish Ruby command BEFORE moving on to the next

2015-01-22 Thread Vivek Sampara
Correct me if im not wrong as long as its running on a single thread, there should be no confusion in terms of sequence. Just run them in sequence and they should work fine. long_command1 long_command2 long_command3 long_command4 The only cache is if all the commands are running in a single

Re: [Rails] What's happening to Rails engines?

2015-01-21 Thread Vivek Sampara
continue to be annoying. It forced my to use Zeus, but since Spring is in the core it should be fully supported, don't you think? El miércoles, 21 de enero de 2015, 10:17:25 (UTC+1), Vivek Sampara escribió: Apart from adding them on gemspec dependency , you need to also require

Re: [Rails] Re: OSV ON ROR

2015-01-21 Thread Vivek Sampara
Rajandeep, You need to be more specific about what problems you're facing. And is the problem related to rails or OpenStreetView. On Wed, Jan 21, 2015 at 4:21 PM, Rajandeep Singh rajanbajw...@gmail.com wrote: On Wednesday, January 21, 2015 at 3:13:48 PM UTC+5:30, Frederick Cheung wrote:

Re: [Rails] What's happening to Rails engines?

2015-01-21 Thread Vivek Sampara
Apart from adding them on gemspec dependency , you need to also require it explicitly inside the engine.rb or lib/your_engine_name.rb on top Eg: # lib/your_engine_name.rb require 'jquery-ui' module YourEngineName end OR module YourEngineName class Engine ::Rails::Engine

Re: [Rails] Gem is in gemlist but getting error: “Could not find gem”

2015-01-15 Thread Vivek Sampara
The jquery rails gem installed in your machine is not the that Gemfile needs. To confirm this, open Gemfile.lock. search for jquery-rails. you'll find the gem version. compare it with the one in your machine. Cheers On Fri, Jan 16, 2015 at 4:48 AM, Beckah Zz li...@ruby-forum.com wrote: When I

Re: [Rails] g controller is creating .css not .css.scss

2015-01-15 Thread Vivek Sampara
I think you're missing the gem 'sass-rails' . can you paste your Gemfile ? On Fri, Jan 16, 2015 at 12:21 PM, E. Allan Montes D. allan.mon...@gmail.com wrote: https://lh5.googleusercontent.com/-dt3btHcUcmA/VLi0z6X1CcI/AKw/gpE6RWkt8lo/s1600/image.png I am using rails g controller

Re: [Rails] Re: GAntt chart development tools

2015-01-15 Thread Vivek Sampara
Use highcharts.js refer - http://forum.highcharts.com/viewtopic.php?f=9t=19043 https://highcharts.uservoice.com/forums/55896-general/suggestions/804783-gantt-chart On Thu, Jan 15, 2015 at 12:49 PM, Kashif Umair Liaqat kulking...@gmail.com wrote: Is there anyone with the suggestion? I also

Re: [Rails] form_tag and link_to

2015-01-15 Thread Vivek Sampara
Like this . %= form_tag(result_path(:q = params[:q]), :method = :get) do % %text_field :term % div%= submit_tag 'Search' %/div % end % On Thursday, 15 January 2015 16:24:32 UTC+5:30, Melb01 wrote: thx, I'll try this but how can I fill the target form with the same term too in result

Re: [Rails] form_tag and link_to

2015-01-15 Thread Vivek Sampara
Hi, Change the form :method to :get %= form_tag(result_path(:q = :term), :method = :get) do % %text_field :term % div%= submit_tag 'Search' %/div % end % On Thu, Jan 15, 2015 at 3:00 PM, Melb01 melaggo...@gmail.com wrote: Hi I have a search box put in a form that I want when I submit I

Re: [Rails] Devise error - Reg

2015-01-14 Thread Vivek Sampara
Arun, Did you add the field for avatar for user model ? you need to do 2 steps. 1.https://github.com/thoughtbot/paperclip#migrations 2. run rake db:migrate Restart server and check again . Cheers Vivek On Wed, Jan 14, 2015 at 5:12 PM, Arun Kumar arunkumarm1...@gmail.com wrote: Hello.I have

Re: [Rails] Need a Ruby Developer

2015-01-09 Thread Vivek Sampara
Hey Joe, Can you provide more details? email : ravensnowb...@gmail.com Cheers Vivek On Fri, Jan 9, 2015 at 6:25 PM, Joe Asady osito...@gmail.com wrote: NYC based company needs a developer to update the product catalogue for an e-commerce site and maintain the site on an ongoing contractual

Re: [Rails] Re: Duplicate record including paperclip image

2015-01-08 Thread Vivek Sampara
Hi, Its because of the image column in the database is string probably and @image returns an object of URI::Generic . Can you show the schema of pin model and the gem you're using for attachments handling ? meanwhile try , @image.to_s on that line. On Fri, Jan 9, 2015 at 4:16 AM, Tony T.

Re: [Rails] Re: Restrict Access to Create Action to Particular User Model?

2015-01-08 Thread Vivek Sampara
David, Have a look at pundit gem as well. I'd recommend that for simplicity. Vivek On Fri, Jan 9, 2015 at 2:49 AM, David Williams li...@ruby-forum.com wrote: Colin Law wrote in post #1166335: On 8 January 2015 at 20:01, David Williams li...@ruby-forum.com wrote: I have two user models one

Re: [Rails] When do we need to use AASM

2015-01-08 Thread Vivek Sampara
Hi, Its a state management gem usually used in ecommerce . I've used them in healthcare products and social networking. Ecommerce - Cart status : new , order_placed, :shipped, feedback_provided Healthcare - Bed status : new, has_patient, :patiend_discharged, patient_billed Social networking -

Re: [Rails] Deprecated rails code?

2015-01-06 Thread Vivek Sampara
HI, What is the rails version you're using ? On Tue, Jan 6, 2015 at 4:57 AM, Timothy Wi li...@ruby-forum.com wrote: Hello, Is this code deprecated? map.connect ''., :controller = main, :action = welcome I am trying to get it to work in the routes.rb file but I don't have any luck.

Re: [Rails] has_many with model name as foreign key

2014-12-27 Thread Vivek Sampara
Hi, Fistly, dont create a model with the name Attribute. Some of the rails core methods uses attributes . Use something like custom_attributes . Next, to make a model belong_to different models on the same foreign_key, Make sure you use polymorphic-associations

Re: [Rails] Re: Has anyone gotten Zurb-Foundation JavaScript working?

2014-12-27 Thread Vivek Sampara
Hi, I've created a hobby project using zurb foundation framework. Its a bit old but i think it can help you. Pushed it to git https://github.com/ravensnowbird/unfollowjerks Cheers On Sun, Dec 28, 2014 at 9:37 AM, David Williams li...@ruby-forum.com wrote: Walter Davis wrote in post #1165528:

Re: [Rails] Application based on an api

2014-12-25 Thread Vivek Sampara
Hi, API is no different from your regular rails controller / actions. As both respond to a particular request but API doesn't use sessions. so your currrent_user is created from token, not sessions. for angular as the front end, you dont have to create an api. Your regular routes works fine . If

Re: [Rails] Errors treatment in a non ActiveRecord class

2014-12-24 Thread Vivek Sampara
Hi Anjos, Which is the class that is not ActiveRecord descendent ? Im assuming Taxes::Premisefinder define an errors class this way class Error attr_accessor :errors def initialize @errors = {} end def add(key, message) self.errors[key] = message end end class Car def

Re: [Rails] double authocetation : how can I do it the best ?

2014-12-23 Thread Vivek Sampara
dinsdag 23 december 2014 08:33:41 UTC+1 schreef Vivek Sampara: Hi , Instead of implementing it from scratch try to include any ror ecommerce gems and let it handle the cart and sessions. i personally like the simplicity of piggybak https://github.com/piggybak/piggybak . Cheers On Tue, Dec

Re: [Rails] CentOS 6.5 Mysql 5.5 RoR deploying issue

2014-12-22 Thread Vivek Sampara
Hey, Looks like someone had a similar problem here http://serverfault.com/questions/601162/cant-install-mysql-devel-on-centos-6-5 On Mon, Dec 22, 2014 at 4:56 PM, Diego Dillenburg Bueno diegodillenb...@gmail.com wrote: Hey all, have any of you ever had some trouble trying to deploy to a

Re: [Rails] wrong number of arguments (3 for 2) of stylesheet_link_tag

2014-12-22 Thread Vivek Sampara
Hi, Which version of rails are you using ? On Tue, Dec 23, 2014 at 11:18 AM, Cat Wild wildcat.n...@gmail.com wrote: %= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' = false % There seems to be no problem in my code but I do not know why -- You received

Re: [Rails] wrong number of arguments (3 for 2) of stylesheet_link_tag

2014-12-22 Thread Vivek Sampara
Also your sprockets version. On Tue, Dec 23, 2014 at 12:58 PM, Vivek Sampara ravensnowb...@gmail.com wrote: Hi, Which version of rails are you using ? On Tue, Dec 23, 2014 at 11:18 AM, Cat Wild wildcat.n...@gmail.com wrote: %= stylesheet_link_tag 'application', media: 'all', 'data

Re: [Rails] double authocetation : how can I do it the best ?

2014-12-22 Thread Vivek Sampara
Hi , Instead of implementing it from scratch try to include any ror ecommerce gems and let it handle the cart and sessions. i personally like the simplicity of piggybak https://github.com/piggybak/piggybak . Cheers On Tue, Dec 23, 2014 at 12:33 PM, Roelof Wobben rwob...@hotmail.com wrote:

Re: [Rails] ActiveRecord::StatementInvalid: Mysql2::Error: Incorrect datetime value:

2014-12-19 Thread Vivek Sampara
method `toLocaleFormat' for Fri, 19 Dec 2014 21:44:44 UTC +00:00:Time On Thu, Dec 18, 2014 at 9:27 PM, Vivek Sampara ravensnowb...@gmail.com wrote: Try toLocaleFormat() On Fri, Dec 19, 2014 at 6:24 AM, Michael Sutyak msut...@gmail.com wrote: am running a test with mailers within Ruby on Rails

Re: [Rails] Re: Re: Re: Unable to connect Devise User to ProfilesController

2014-12-19 Thread Vivek Sampara
David for the route to show up like twitter, you can use friendly_id https://github.com/norman/friendly_id gem. or write your own route like this get /:profile_id = profiles#show, :as = user_profile, :constraints = { :profile_id = /[^\/]+/ } On Fri, Dec 19, 2014 at 11:49 PM, Colin Law

Re: [Rails] ActiveRecord::StatementInvalid: Mysql2::Error: Incorrect datetime value:

2014-12-18 Thread Vivek Sampara
Try toLocaleFormat() On Fri, Dec 19, 2014 at 6:24 AM, Michael Sutyak msut...@gmail.com wrote: am running a test with mailers within Ruby on Rails, and I am getting the following errors: *-C02MGBVJFD57:myapp $ bundle exec rake test:mailers # Running: EE Finished in

Re: [Rails] rake db:create create also a phantom table

2014-12-18 Thread Vivek Sampara
Hi, This happens because of *Schema cache dump * . http://edgeguides.rubyonrails.org/4_0_release_notes.html#general. To avoid this you need to run rake db:schema:cache:clear Cheers Vivek On Thu, Dec 18, 2014 at 3:40 PM, apsr84 apeterne...@salesriver.net wrote: Hello guys, today happened a

Re: [Rails] Modules as closures

2014-12-17 Thread Vivek Sampara
This Homepage link on http://rubygems.org/gems/jackbox/ points to google.com . On Tue, Dec 16, 2014 at 11:44 PM, Lou Henry li...@ruby-forum.com wrote: Can closures be modules? Well, Ladies and Gents we would like to introduce you to our new library called Jackbox. It toys with the ideas of

Re: [Rails] advanced search

2014-12-17 Thread Vivek Sampara
I think you can use rolify https://github.com/RolifyCommunity/rolify as you have dynamic permissions. On Tue, Dec 16, 2014 at 11:43 PM, Artem T arttim...@gmail.com wrote: I have a problem with the implementation of the search in the project I have such models(bring a simplified version)

Re: [Rails] Using the Sync gem to make restful Rails app real-time

2014-12-17 Thread Vivek Sampara
You are not syncing, you are rendering. In practice, one simply only needs to replace: %= render partial: 'user_row', locals: {user: @user} % with: %= sync partial: 'user_row', resource: @user % Look at the sync documentation here https://github.com/chrismccord/sync On Mon, Dec 15, 2014 at

Re: [Rails] advanced search

2014-12-17 Thread Vivek Sampara
but author can denied access to some friends. this is why it has dynamic roles on individual obejct On Wed, Dec 17, 2014 at 6:53 PM, Artem T arttim...@gmail.com wrote: I can`t understand how it can help me? I do not have different roles. All users have one role. -- You received this

Re: [Rails] advanced search

2014-12-17 Thread Vivek Sampara
пользователь Vivek Sampara написал: but author can denied access to some friends. this is why it has dynamic roles on individual obejct On Wed, Dec 17, 2014 at 6:53 PM, Artem T artt...@gmail.com wrote: I can`t understand how it can help me? I do not have different roles. All users have

Re: [Rails] how to lock the destroy action?

2014-12-17 Thread Vivek Sampara
Validate the destroy action in the ticket model . More info Here http://stackoverflow.com/questions/123078/how-do-i-validate-on-destroy-in-rails On Wed, Dec 17, 2014 at 8:33 PM, Psycho Shine anndre...@gmail.com wrote: hi all. Bus and Tickets/has_one, belongs_to/ Users and Tickets/has_many,

Re: [Rails] how to lock the destroy action?

2014-12-17 Thread Vivek Sampara
You could also use rails callbacks before_destroy http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html before_destroy :check_bus_status private def check_bus_status return false if bus.tickets bus.places*0.9 end On Wed, Dec 17, 2014 at 8:41 PM, Vivek Sampara ravensnowb

Re: [Rails] advanced search

2014-12-17 Thread Vivek Sampara
to create a relationship with each user. Delayed_job gem will be good? 17 Дек 2014 г. 17:08 пользователь Vivek Sampara ravensnowb...@gmail.com написал: Dont worry about joins , you can use https://github.com/activerecord-hackery/squeel . I would probably do it this way Post name , content

Re: [Rails] advanced search

2014-12-17 Thread Vivek Sampara
need do 1000 or 1 or more insert queries. To set access for one post( access or denied). Or i not right underatand you? 17 Дек 2014 г. 18:29 пользователь Vivek Sampara ravensnowb...@gmail.com написал: Depends on the type of application. If you think the posts should be appear on the feed

Re: [Rails] Need help with Unpermitted Parameters for Devise | Rails 4

2014-12-12 Thread Vivek Sampara
Hi David, I think the parameters were not allowed into the registrations controller from the application controller in your case. Your application controller should look like this. class ApplicationController ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs,

Re: [Rails] Re: master failed to start, check stderr log for details

2014-12-10 Thread Vivek Sampara
There you go ! uninitialized constant User (NameError) Check if user.rb exists in /app/models/ it must have been renamed or removed On Wed, Dec 10, 2014 at 5:52 PM, Ezequias Farias ezequias.far...@gmail.com wrote: Anyone? Just little help? :( On Tuesday, December 9, 2014 11:32:07 AM UTC-3,

Re: [Rails] Re: master failed to start, check stderr log for details

2014-12-10 Thread Vivek Sampara
from the older server to the new one would work, but the user.rb file is also missing in the older server. 2014-12-10 9:32 GMT-03:00 Vivek Sampara ravensnowb...@gmail.com: There you go ! uninitialized constant User (NameError) Check if user.rb exists in /app/models/ it must have been

Re: [Rails] Rails Integrate with Webrtc

2014-12-08 Thread Vivek Sampara
I'd recommend you not to re-invent the wheel and use bbb or appear.in or talky On Mon, Dec 8, 2014 at 2:06 PM, Parth S parthisiva...@gmail.com wrote: Hi All, I need to implement video chat function in my rails application. Could anyone tell how will do that using Webrtc . -- You received

Re: [Rails] Strange behaviour with the create_xxx on has_one association

2014-12-08 Thread Vivek Sampara
This behavior is normal. When a record already exists for has_one, it deletes the previously existing record for database consistency ( has_many ) . It is a bit similar to has_and_belongs_to_many when you have User has_and_belongs_to_many categories. user.categories_ids = [4,5,6] #some array of

Re: [Rails] Re: Strange behaviour with the create_xxx on has_one association

2014-12-08 Thread Vivek Sampara
The new one is obviously failing a validation on the user or user_preference . Check the object for any validation errors. On Mon, Dec 8, 2014 at 3:31 PM, Frederick Cheung frederick.che...@gmail.com wrote: On Monday, December 8, 2014 8:48:37 AM UTC, Man Vuong Ha Thanh wrote: But, if I call

Re: [Rails] No route matches {:action=show, :controller=carts} missing required keys: [:id]

2014-12-08 Thread Vivek Sampara
What is the url you're using to show this on a separate page ? if its in the pattern of /cards/:id/something then you dont have to provide the card path as rails picks up @card object to build the path or you'll have to pass the card variable inside the path method. eg % @cards.each do |card| %

Re: [Rails] No route matches {:action=show, :controller=carts} missing required keys: [:id]

2014-12-08 Thread Vivek Sampara
(card) % /li but on both I see this message : undefined local variable or method `cart' undefined local variable or method `card' Roelof Op maandag 8 december 2014 14:23:33 UTC+1 schreef Vivek Sampara: What is the url you're using to show this on a separate page ? if its

Re: [Rails] errors in rails console

2014-12-03 Thread Vivek Sampara
http://stackoverflow.com/questions/9340497/cannot-load-such-file-readline-loaderror-when-running-heroku-create-stack On Thu, Dec 4, 2014 at 11:49 AM, rubynet farnaz.sadeghi...@gmail.com wrote: hi when i enter rails console this errors displays ,could you help me please ?

Re: [Rails] action for creating object through 3 models. rails 4

2014-12-01 Thread Vivek Sampara
., 11:47:19 UTC-8 пользователь Vivek Sampara написал: Could you show an example of what post_params contains ? On Sun, Nov 30, 2014 at 4:24 PM, Psycho Shine annd...@gmail.com wrote: Hi all! I have 3 models: user, post, comment User has_many :posts, :commentsPost belongs_to :user, has_many

Re: [Rails] Implement collection_select based upon an array.

2014-12-01 Thread Vivek Sampara
Each / Each with index returns the same array . You need to use map. http://stackoverflow.com/questions/11596879/why-does-arrayeach-return-an-array-with-the-same-elements Can you try this %= select obj, test, @timeslots.map.with_index{ |name, index| [name, index] } % On Mon, Dec 1, 2014 at

Re: [Rails] How to implement fragment caching with rails ajax call?

2014-12-01 Thread Vivek Sampara
You have to use fragment caching http://api.rubyonrails.org/classes/ActionController/Caching/Fragments.html and write a private method like def sample_from_cache @cache = read_fragment(:page = params[:page], :per_page = @per_page) return @cache unless @cache.blank? @cache =

Re: [Rails] Parsing useful subtext from text file, and saving it to Mysql.

2014-12-01 Thread Vivek Sampara
Hi George, Isolate the area with the text you want , example ? Ideally it looks like you have to grab a book of regular expressions. Cheers Vivek On Mon, Dec 1, 2014 at 4:42 PM, George Stoumpos stog...@gmail.com wrote: Hi there, I am trying to figure out how to do something in Rails.

Re: [Rails] action for creating object through 3 models. rails 4

2014-11-30 Thread Vivek Sampara
Could you show an example of what post_params contains ? On Sun, Nov 30, 2014 at 4:24 PM, Psycho Shine anndre...@gmail.com wrote: Hi all! I have 3 models: user, post, comment User has_many :posts, :commentsPost belongs_to :user, has_many :commentsComments belongs_to :user, post So for

Re: [Rails] select radio button in active admin

2014-11-30 Thread Vivek Sampara
For 1) Use enum default field in your migration for User like this t.column :role, :string, default: corporate or use https://github.com/FooBarWidget/default_value_for For 2) Roles were stored as string and your collection contains symbols . :corporate != corporate Try this f.input :role,

Re: [Rails] Too big classes

2014-11-27 Thread Vivek Sampara
AFAIK , On production mode, rails has a default configuration called eager_load ( config.eager_load ) . This loads all the classes into the RAM for faster access( cache ) . But for b1 = Book.new, b2 = Book.new , The class and methods are not loaded twice. The object is created and occupies RAM.

Re: [Rails] exclude certain json fields from rendering

2014-11-26 Thread Vivek Sampara
Your example has an error { id: abracadabra, data: good }*,(comma is missing)* { id: abracxxabra, data: goodsss } Solution render json: JSON.parse(obj).each{|k,v| v.each{|arr| arr.reject!{|x| x == id } } if v.class.to_s == Array}.to_json On Wed, Nov 26, 2014 at 1:33 PM, Zhao Difei

Re: [Rails] Local Storage

2014-11-24 Thread Vivek Sampara
Hey, Can you describe Data , you mean files or just variables ? If its just files then im not sure but if its variable, you can use javascript global variables or front end frameworks like angular or backbone. On Mon, Nov 24, 2014 at 4:12 PM, Praveen BK li...@ruby-forum.com wrote: Hello all,

Re: [Rails] Re: Local Storage

2014-11-24 Thread Vivek Sampara
Then use javascript hash tables http://www.mojavelinux.com/articles/javascript_hashes.html and when user clicks submit send the hash table as data field in ajax On Tue, Nov 25, 2014 at 11:17 AM, Praveen BK li...@ruby-forum.com wrote: Hello vivek, I need to store a variables (nested

Re: [Rails] Re: Advanced string comparison using active record

2014-11-18 Thread Vivek Sampara
Hey sorry for misunderstanding it. You will have to use native database specific regex or pure ruby based expressions and select im a bit bad at regular expressions but i should look something like this :) Post.all.select{|x| x.title ~= /[hello]*/ } On Tue, Nov 18, 2014 at 1:45 PM, Tal Sh

Re: [Rails] Advanced string comparison using

2014-11-17 Thread Vivek Sampara
try this arr = [XX,YY,AB, ] def self.custom_search(arr = []) query = [] arr.each do |term| query += title LIKE %#{term}% end where(query.join( OR )) end If you're using postgres DB def self.custom_search(arr = []) query = [] arr.each do |term| query += title ILIKE %#{term}%

Re: [Rails] Advanced string comparison using

2014-11-17 Thread Vivek Sampara
Then you can simply use Post.where(name ILIKE %?%, hello) or postgres ( can insensitive ) Post.where(name ILIKE %?%, hello) On Tue, Nov 18, 2014 at 12:12 PM, Vivek Sampara ravensnowb...@gmail.com wrote: try this arr = [XX,YY,AB, ] def self.custom_search(arr = []) query

Re: [Rails] Re: Refill a form when invalid data is submitted

2014-11-13 Thread Vivek Sampara
Such an excellent answer ! On Thu, Nov 13, 2014 at 1:55 PM, Colin Law clan...@gmail.com wrote: On 13 November 2014 01:10, Andrew Gimma li...@ruby-forum.com wrote: I don't know why people are generally so unhelpful on these message boards. I've been a professional programmer for years, and

Re: [Rails] Ruby - Iterating over a Nested Hash

2014-11-13 Thread Vivek Sampara
If you want to iterate over each nested hash - it totally depends on the depth of the hash and the kind of view you're trying to build using it. If you dont have knowledge about the other keys that come in the hash, use this pattern. h = { a = 100, b = 200 }h.each {|key, value| puts #{key} is

Re: [Rails] Re: Ruby - Iterating over a Nested Hash

2014-11-13 Thread Vivek Sampara
You will have to use nokogiri gem to parse it and iterate. More details here. http://www.nokogiri.org/tutorials/parsing_an_html_xml_document.html On Thu, Nov 13, 2014 at 8:12 PM, Scott Bradford li...@ruby-forum.com wrote: I am trying to build it nearly like the PHP example above. I'll build

Re: [Rails] Logout Does not working in Production Environment

2014-11-11 Thread Vivek Sampara
You're missing https://github.com/rails/jquery-rails or https://github.com/rails/jquery-ujs in your assets. As a result. The link to :method = :delete doesn't work and sends a request as :get . On Tue, Nov 11, 2014 at 3:15 PM, harry suren harrysu...@gmail.com wrote: Logout functionality does

Re: [Rails] Logout Does not working in Production Environment

2014-11-11 Thread Vivek Sampara
Sarcasm ? :) On Tue, Nov 11, 2014 at 10:05 PM, Vladimir Gordeev gordeev.vladimi...@gmail.com wrote: Telepathy skills, huh? I couldn't figure it out. On Tue, Nov 11, 2014 at 11:55 AM, Vivek Sampara ravensnowb...@gmail.com wrote: You're missing https://github.com/rails/jquery-rails

Re: [Rails] Logout Does not working in Production Environment

2014-11-11 Thread Vivek Sampara
Sorry, just kidding. On Tue, Nov 11, 2014 at 10:20 PM, Colin Law clan...@gmail.com wrote: On 11 November 2014 16:39, Vivek Sampara ravensnowb...@gmail.com wrote: Sarcasm ? :) I assumed it was admiration Colin On Tue, Nov 11, 2014 at 10:05 PM, Vladimir Gordeev gordeev.vladimi

Re: [Rails] Creating multiple views for a database table .. routing not working

2014-10-28 Thread Vivek Sampara
You need to mention :on = :collection on the route. get '/foodsIlike/user_list' = 'foodsIlike#user_list', :as = 'user_list', :on = :collection On Tue, Oct 28, 2014 at 6:47 AM, Sonali Katara sonalikat...@gmail.com wrote: I have a single table in which I store favourite dishes of users. A user

Re: [Rails] Does anyone know how to use Net:HTTP make soap request?

2014-10-23 Thread Vivek Sampara
As long as the soap request has the right headers, it should be fine with simple request with text. But i'd recommend using savon, I've used it before. On Thu, Oct 23, 2014 at 10:46 AM, Fanglu Jiang jiangfan...@gmail.com wrote: Hi I am developing code to send XML to a SOAP WebService. There

Re: [Rails] One huge table or separate tables? design issue

2014-10-12 Thread Vivek Sampara
Hi, Creating multiple tables is not the key to solve this problem. If your rows are higher than 10 million records, then you have to make sure you archive the older ( Unused ) rows or solve it through MASTER - SLAVE db approach. Ideally when you're worry about performance issues with databases ,

Re: [Rails] Re: display ppt file in rails application

2014-10-10 Thread Vivek Sampara
http://www.slideshare.net/developers On Fri, Oct 10, 2014 at 11:30 AM, Sai Ch li...@ruby-forum.com wrote: I am really glad to know this slideshare app is also developed using ruby on rails. How can they achieve it..!! -- Posted via http://www.ruby-forum.com/. -- You received this

Re: [Rails] Re: DatabaseMigration

2014-10-10 Thread Vivek Sampara
DuplicateMigrationNameError Basically means that there is a class already defined with the same name db/migrate/sometimestamp_your_migration_name.rb class YourMigrationName ActiveRecord::Migration end So give the migration file a different name and change the class name as well along with it.

Re: [Rails] Why doesn't form_for default to 'create' action?

2014-10-08 Thread Vivek Sampara
It depends on the type of object you pass as a parameter to form_for. eg: @car = Car.new @car1 = Car.first form_for(@car) generates a url ( /cars ) method post #create action form_for(@car1) generates a url ( /cars/:id/ ) method put # update action. this happens when the object has been saved

Re: [Rails] Hobo and other gems for rapid prototyping

2014-10-08 Thread Vivek Sampara
I'd recommend learning the core rails architecture before working on any of the rapid prototyping gems. I did the same mistake and i think its not worth it. Here is my story. I started learning hobo without any prior rails knowledge and after a certain period i hit the wall. its because i

Re: [Rails] Install ROR on Linux

2014-10-06 Thread Vivek Sampara
You can start with installing ruby . http://rvm.io/ On Mon, Oct 6, 2014 at 3:49 PM, Brano rtw.k...@gmail.com wrote: Excuse me I am a total beginer, but I want to learn programming in RoR. I have linux Ubuntu 14.04. How I can install it? Is there somewhere step by step instruction? Thanks.

Re: [Rails] Accessing and updating Devise current user in a different controller

2014-10-06 Thread Vivek Sampara
Joseph, Whats the association between a quiz and a user. If they are related , then you can write a callback in your quiz model after_create :increase_user_xp or after_update :increase_user_xp def increase_user_xp self.user.update(:xp = 50) end On Tue, Oct 7, 2014 at 6:44 AM, Joseph Wilks

Re: [Rails] Instant messaging/2 way Chat in Rails

2014-10-02 Thread Vivek Sampara
James learn how Faye works ( http://faye.jcoglan.com/ ) , it would be great start to understand the underlying concepts of private_pub. On Thu, Oct 2, 2014 at 7:01 PM, James Jelinek li...@ruby-forum.com wrote: I have a Rails 3.2.16 app which tracks calls, vehicles, and patient information.

Re: [Rails] New Project needs push notifications

2014-09-30 Thread Vivek Sampara
ActionController::Live all the way :) On Tue, Sep 30, 2014 at 10:23 PM, Perry Smith li...@ruby-forum.com wrote: I'm starting a new Rails project probably using 4.1 or 4.2. The project needs the ability for user's browsers to get updates via push notifications. I know that Rails 4 kinda

Re: [Rails] Re: New Project needs push notifications

2014-09-30 Thread Vivek Sampara
I'd recommend puma ( Application Server ) with Nginx ( Webserver) On Tue, Sep 30, 2014 at 11:37 PM, Jason Fleetwood-Boldt t...@datatravels.com wrote: Being old(er), I'm like you. The kids all use nginx these days, often with thin as the webserver. Your mileage may vary. Obviously, if

Re: [Rails] self-referential or other ways for same resource pair

2014-09-29 Thread Vivek Sampara
Glad to see it working. Happy Coding :) On Mon, Sep 29, 2014 at 12:51 PM, Paolo Wang paulwan...@gmail.com wrote: I finally got it working in ActiveAdmin without a custom form. I'll post how I did it for references if somebody need. First I set my custom attributes in the LineItem model:

Re: [Rails] self-referential or other ways for same resource pair

2014-09-28 Thread Vivek Sampara
Do you have any issues with the form currently ? On Mon, Sep 29, 2014 at 7:35 AM, Paolo Wang paulwan...@gmail.com wrote: Thank you very much. Using 'Language.all.permutation(2). to_a' I've got all the combinations (A-B and B-A) and seeded the LanguagePair model. For the cost I was thinking

Re: [Rails] self-referential or other ways for same resource pair

2014-09-27 Thread Vivek Sampara
Paolo, I think you've going in the right direction but i'd recommend a few changes based on my experience. Translation Agency has different rates for each language. and the rate per language for A - B Is not the same as B - A. So its better to maintain the cost details in Another model unique for

Re: [Rails] Re: how to asign strong perameters using radio button checked value in rails

2014-09-26 Thread Vivek Sampara
Is choice method defined anywhere ? if choice == 1 And keep your permitted params method outside create. def create end def webnairs_params if choice == 1 params.require(:webnair).permit(:user_id, :ppt, :choice, :title, :description) else

Re: [Rails] Re: Re: how to asign strong perameters using radio button checked value in rails

2014-09-26 Thread Vivek Sampara
if you should check it like if params[:choice].to_s == 1 #do something else #do something else end On Fri, Sep 26, 2014 at 6:37 PM, Sai Ch li...@ruby-forum.com wrote: Vivek Sampara wrote in post #1158513: Is choice method defined anywhere ? if choice == 1 And keep your permitted

Re: [Rails] Couldn't find 'migration' generator

2014-09-25 Thread Vivek Sampara
I dont remember the older rails syntax but isn't it rails script/generate​ instead of ruby script/generate ? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email

Re: [Rails] Please help to me handling special characters in rails-sql

2014-09-24 Thread Vivek Sampara
Which database are you using ? And what is the encoding set on the environment ? On Wed, Sep 24, 2014 at 10:37 AM, Lekkala Kondareddy lekka...@gmail.com wrote: i have faced problem in my database has special characters please suggest any solutions -- You received this message because you

Re: [Rails] Doubts on what association to choose

2014-09-23 Thread Vivek Sampara
Diego , Is the link working ? im getting a 404 error from github that repo does not exist. Regards Vivek On Tue, Sep 23, 2014 at 10:43 AM, Diego Dillenburg Bueno diegodillenb...@gmail.com wrote: Thank you very much for the attention, guys! I think I have nailed the association modelling.

Re: [Rails] ThinkingSphinx ConnectionError

2014-09-23 Thread Vivek Sampara
There must be some error in the thinking_sphinx.yml On Tue, Sep 23, 2014 at 3:01 PM, M,Gopi M.gopinath gopi170...@gmail.com wrote: Hi, I am using rails 2.3 and ruby 1.8.6 with radiant cms Here for searching i am using thinking sphinx, this is been working fine for me, But suddenly this

Re: [Rails] ThinkingSphinx ConnectionError

2014-09-23 Thread Vivek Sampara
/ pid_file: /etc/service/searchd/supervise/pid : *dev On Tue, Sep 23, 2014 at 3:31 PM, Vivek Sampara ravensnowb...@gmail.com wrote: There must be some error in the thinking_sphinx.yml On Tue, Sep 23, 2014 at 3:01 PM, M,Gopi M.gopinath gopi170...@gmail.com wrote: Hi, I am using rails

  1   2   >