Questions tagged [rails-5.1.6]
13 questions
2
votes
2 answers
How to get the last entered record field in rails with join and group by?
I am using rails 5.1 with ruby 2.4 and I am stuck in rails Active record query, which I have already made it in SQL but not able to replicate it in the rails way. Please suggest the right syntax, thanks in advance.
The Sql query is:
select jobs.id,…

vidur punj
- 5,019
- 4
- 46
- 65
2
votes
1 answer
Loading error:bcrypt
I have created a admin panel using ROR platform. Now whenever I try to login I'm getting this error :
Cannot load such file bcrypt_ext
I have come across this error in the past but used to rectify it by uninstalling and reinstalling it using the…
user9857635
2
votes
0 answers
FactoryGirl embed create_list into another create_list
I have the following code in my spec folder
let(:team_lead) { create(:user) }
let(:developers) { FactoryGirl.create_list(:user, 3) }
let(:project) { create(:project, team_lead: team_lead, users: [developers]) }
but it keep giving me this error
***…

Moses Liao GZ
- 1,556
- 5
- 20
- 45
2
votes
1 answer
ActionController::UnfilteredParameters - unable to convert unpermitted parameters to hash - Rails 5.1.6
I am getting this error in following code
link_to params.to_h.merge(query_hash), options do
raw("#{title} " + fa_icon(icon))
end
To fix it i tried following things which didn't work mentioned here
…

Salil
- 46,566
- 21
- 122
- 156
1
vote
0 answers
Incorrect syntax near '0'.: EXEC sp_executesql N'SELECT [users].* FROM [users] OFFSET 0 ROWS FETCH NEXT @0 ROWS ONLY', N'@0 int', @0 = 1
I'm using rails 5.1.6 with activerecord-sqlserver-adapter 5.1.6, tiny_tds 2.1.2. and SQL Server 2017.
Databaseaccess is OK,
SQL (1.1ms) USE [MIST_Test]
User Load (1.5ms) EXEC sp_executesql N'SELECT [users].* FROM
[users] OFFSET 0 ROWS FETCH…

user322958
- 23
- 4
1
vote
0 answers
rails to_json return single field
I'm using the method ".to_json" to render my result like this:
"this is a route in my controller"
def show_articles
render json: @company_repo.get_articles_by_company_id(params[:id])
.to_json(include: [{product_groups:…

Jonathan
- 51
- 7
1
vote
0 answers
Rails: random already initialized constant X + previous definition of X
Ruby: 2.5.1, Rails: 5.1.6
Occasionally, this error only appears in the development environment. And on multiple platforms. Whether ruby is installed on "rbenv" or "rvm".
Started GET "/notifications" for 127.0.0.1 at 2018-08-27 14:51:47…

Alexander Rühle
- 233
- 3
- 7
1
vote
0 answers
Rails 5.1 Multiple belongs_to associations with optional: true, rollback - 'required association'
I want to use belongs_to parent_model, optional: true assocation for 1 child - and 2 parents. Found this answer: Model belongs_to eiher/or more than one models. Tried that. But with 2 associated parent models one of them causes rollback when saving…

Mike
- 61
- 6
0
votes
0 answers
File not received when sent with send_file in rails
I am sending file to client when they click on download in my application, however, the file don't get downloaded, by the client but the console indicates file been sent.
show.html.erb
<%= form_for…
<%= form_for…

wokoro douye samuel
- 2,194
- 3
- 15
- 29
0
votes
1 answer
Wrong comment position using AJAX and JQUERY and Rails
I'm creating a "without refresh page comment" using Jquery and Ajax.
Inside posts/show.html.erb
<%= @post.title %>
<%= @post.body %>
<%= render 'comment %>
posts/_comment.html.erb
<%= link_to "Add Comment", new_post_comment_path(@post), id:…

Gaberich
- 1
- 4
0
votes
1 answer
Static PDF file on rails app not showing on website upon deploying
I've added this line
<%= link_to 'Download My Resume', "resume.pdf", { :class=>"btn btn-default btn-lg" } %>
to my html.erb, the link works perfectly on my local server but when I deploy it to my aws server, the webpage cannot be…
ttinggggg
- 157
- 1
- 1
- 14
0
votes
1 answer
Rails 5.1.6 params not saving
It's been a couple of years since I've done much with Rails and I've no experience with Rails 5.1.6. While I'm able to save data via a seed file and via the Rails Console, I'm unable to save from an HTML form. Instead of saving, on submit I see the…

seanot
- 13
- 1
- 5
-3
votes
2 answers
not show GUI proper on RAILS_ENV=production server
RAIL_ENV= testing or development server looks proper, but on production server not show proper GUI

ACHYUT KADAM
- 189
- 1
- 8