[Solved] hashes — Seem like mutant potatoes [closed]

There’s a wealth of information out there, http://ruby-doc.org/core-2.3.0/Hash.html for example is pretty clear on what hashes are. You need to get your head around some of the basics, there are plenty of tutorials out there, https://www.railstutorial.org/ is one that comes up often, http://guides.rubyonrails.org/getting_started.html is the most obvious place to start. 2 solved hashes — Seem … Read more

[Solved] How to get rails_blob_url for the avatar attached to User Model from Userspublication?

Thank you for the help guys (specially @arieljuod) i figured out the answer it was pretty simple : return rails_blob_path(object.user.avatar, only_path: true) Here object is of Userspublication! (The guy who down voted this question if you cant answer and can’t even bother to help in understanding whats wrong with it “suck it”!!) solved How to … Read more

[Solved] Setting up Ruby on Rails [closed]

You need to Create Ruby on Rails app first then you can deploy it on Heroku. Here is very nice reference link from scratch.. https://devcenter.heroku.com/articles/getting-started-with-rails4 Hope this will help you..to create Rails Demo App and all steps of deploying on Heroku. 0 solved Setting up Ruby on Rails [closed]

[Solved] error parsing ‘Gemfile’, unexpected

Clean your Gemfile, removing the merge conflicts and try again. Also verify the Rails version you need: source ‘https://rubygems.org’ git_source(:github) do |repo_name| repo_name = “#{repo_name}/#{repo_name}” unless repo_name.include?(“https://stackoverflow.com/”) “https://github.com/#{repo_name}.git” end gem ‘rails’, ‘~> 5.1.3’ gem ‘sqlite3’ gem ‘puma’, ‘~> 3.7’ gem ‘sass-rails’, ‘~> 5.0’ gem ‘uglifier’, ‘>= 1.3.0’ gem ‘bootstrap-sass’, ‘~> 3.3.6’ gem ‘coffee-rails’, ‘~> 4.2’ … Read more

[Solved] How to use python-request to post a file on a Rails App

I figured it out: def add_photo(entry_id, image_path): return requests.post( url = URL, headers = HEADER, files = { ‘entry[entry_id]’: (None, entry_id, ‘text’), ‘entry[photo]’: (os.path.basename(image_path), open(image_path, ‘rb’), ‘image/jpg’, {‘Expires’: ‘0’}) } ) solved How to use python-request to post a file on a Rails App

[Solved] Rails, Heroku – configuring 123-reg domain for heroku

The first issue is that you have conflicting CNAME entries. Start by removing all CNAME entries where the hostname is “www”. Then create one new CNAME entry. The hostname field should be “www” and the Destination CNAME should be your Heroku app hostname “rainbow-mutiny-636.herokuapp.com”. Now go to your Rails app directory and run heroku domains … Read more

[Solved] How to access Jquery’s Ajax call in RoR?

Guys finally i found Solution as Follows and working Great!! Controller def stagemilestone @milestones=Milestone.find(:all, :conditions => [“status_id=? and project_id=?”,params[:stageid], params[:id]]) respond_to do |format| format.html # index.html.erb format.json { render :json => @milestones} end end and My char.js looks like this $.ajax({ type : ‘get’, url : “/projects/stagemilestone”, data : “stageid=” + $(this).attr(‘name’) + “&id=” + … Read more

[Solved] rails passing in id parameter ambiguous

Extract from Rails Routing from the Outside In 2.10.1 Adding Member Routes To add a member route, just add a member block into the resource block: resources :photos do member do get ‘preview’ end end This will recognize /photos/1/preview with GET, and route to the preview action of PhotosController, with the resource id value passed … Read more

[Solved] Edited… ActionView::Template::Error (No route matches… missing required keys: [:comment_id])

Change the form action to this, Updated: <% if @photo.comments.any? %> <% @photo.comments.each do |comment| %> # you do not have to use comment in form_for, because this form is for creating cflag <%= form_for(:cflag, url: photo_comment_cflags_path(@photo, comment), method: “post”) do |f| %> <%= f.hidden_field :user_id, value: current_user.id %> <%= f.submit “Report Inappropiate” %> <% … Read more

[Solved] How to do recurring deposit calculations accurately [closed]

If the first month calculation is correct and subsequent months are wrong, are you saying that you want a compound interest formula? (i.e. in month 2 you calculate interest on principle + previous months’ interest) toal = deposit_amount * (rate_of_interest*30/365)**month_number 1 solved How to do recurring deposit calculations accurately [closed]

[Solved] form_for [@parent, @child] causes undefined method `parent_child_path’ in Child#new

The thing about form_for is that its URL is based on the model that you passed in. In your case, it’s: <%= form_for [@user, @college] do |f| %> Rails automatically looks for user_college_profiles_path because you assigned User to @user, and current_user.college_profile to @college. Fortunately, Rails provides a way to override the default URL the form … Read more

[Solved] Parse of .txt on ruby

You can use CSV for parsing files with separators, e.g.: require ‘csv’ CSV.foreach(‘your_file.txt’, col_sep: “\t”, headers: true).map do |row| row.to_h end #=> [{“purchaser”=>”João”, “name”=>”St”, “item”=>”R$20”, “description”=>”off” …}, # {“purchaser”=>”Amy”, “name”=>”Rd”, “item”=>”awesome”, “description”=>”of”, ..}, …] It seems like this data is ready to process. A more common way is using comma-separated value for files like this, … Read more