Upload static webpage to wordpress | Fixed issues |
- Upload static webpage to wordpress
- Save dynamic fields in Rails
- Rails - Temporarily update active record object's attribute
- Why does url_for([:new, User]) generate new_users_path (instead of new_user_path)?
- Rails create action: Forbidden Attributes Error
- adding scripts to spree - creating order
- Using Ember.$.ajax() to send data that has relationships
- How to declare custom attribute accessor with dynamic argument in Ruby?
- Accessing attr_accessor attributes with variable
- Test Ruby module
- how i can pass "var status = true" from my jquery script to the js.erb file or other solutions?
- Rails validation if association has value
- Fail to download a remote https svg file but embed inside <img> is good
- split I18n into sperate files
- Rails: parse weirdly-formatted JSON
- phone number rails js
- Run basic rspec file
- How does SymmetricDS convert Oracle RAW to Postgres BYTEA?
- Can't add session variable - ActiveModel::MissingAttributeError
- Minitest::UnexpectedError: ActiveRecord::RecordNotUnique: Mysql2::Error:
- Getting each i element of a ruby array in a javascript function (escaping and unescaping)?
- Namespacing within `app` directory
- Ruby ajax js view returns encoded html instead of valid html
- Reading YAML from ruby is printing incorrect values
- Writing a scope for multiple associations - Rails 4
- how to create a user interface that a user can signup and login using reactjs and rails backend
- Rails / Postgres: Get percentage of availability
- Why is my Rails App faster on Heroku than on my Localhost
- Create a JS component from remote call
- Can we use two different types of AWS EC2 instances with elastic beanstalk loadbalancer
Upload static webpage to wordpress Posted: 05 Jan 2017 07:40 AM PST I am building a reservations app and I would like an advice on how to design the models. I have Reservation and Table model currently designed like this: However, often the restaurant needs to make 1 reservation for several tables - for a group of 10 people 2 tables are joined together and both of them should not be available at the given time. In this case, I have 2 options:
Which choice do you think is better in the long-run(and if the second, is the design accurate?)? Thank you very much for any suggestions! |
Posted: 05 Jan 2017 07:34 AM PST In my Rails app I Pages, Blocks, BlockContents, Fields, and FieldContents. The associations are: Using this I am able to have dynamic fields for Page. However writing to the DB is currently done in the controller like so: While this does in work, it's quite dirty and it doesn't show my validations for my FieldContent in the view (the validations do work as they don't save the FieldContent if they are invalid, but it should prevent the whole page from saving and show it in the view). How can I make it so that I can show the validations for FieldContent? |
Rails - Temporarily update active record object's attribute Posted: 05 Jan 2017 07:40 AM PST Is there a way to transform model attributes temporarily in a different format but preserve the original value when requested again? Here's an example of the model: Basically I want to be able to run Better yet, is there a way to add this method to the emails model? Something like the above, so that I can run I feel like this should be simple and that I'm missing something obvious :/ |
Why does url_for([:new, User]) generate new_users_path (instead of new_user_path)? Posted: 05 Jan 2017 07:29 AM PST I want to use the same partial for many different resource types. In it, I create a link to create the resource. I pass the resource class as parameter: I find it interesting though that when doing this in the partial: Rails complains: So it makes a To solve the problem, I have to do this: Why is that? What's the reason that Rails pluralises a model's class name in this situation? Is there a more elegant solution for this? |
Rails create action: Forbidden Attributes Error Posted: 05 Jan 2017 07:36 AM PST I am new to rails and am in the process of entering in information in a form and saving it to a database. I am following a tutorial which may be out of date. I am getting an error on the second line. Am I passing the wrong parameter? |
adding scripts to spree - creating order Posted: 05 Jan 2017 07:14 AM PST i'm working on an app using Spree. In an admin panel, i need to add javascript file with a simple purpose of filling new order's billing address, with selected customers billing address. where do i put this script exactly? i understand that js for spree admin panel is here: https://github.com/spree/spree/tree/3-0-stable/backend/app/assets/javascripts/spree/backend yet i see nothing concerning new order or customer |
Using Ember.$.ajax() to send data that has relationships Posted: 05 Jan 2017 07:12 AM PST I'm running through a headache. I'm using Ember 2.0 (a bit old, I know...!). Due to the nature of the project (using ruby-on-rails) we have to use
Ember (controller): Model: Don't know what to do anymore :(... And we can't add the addon Many thanks |
How to declare custom attribute accessor with dynamic argument in Ruby? Posted: 05 Jan 2017 07:07 AM PST I want to declare a custom accessor in a Rails model like this: Then I want to access |
Accessing attr_accessor attributes with variable Posted: 05 Jan 2017 07:10 AM PST below question is about selecting the attributes enabled by "attr_accessor" for an object. Example: This allows me to My question: How can I select the attr_accessors by using a variable from a loop? In below case I would use This, however, would result in Thanks in advance! |
Posted: 05 Jan 2017 07:41 AM PST I'm very new to Ruby and and RSpec. I would like to create basic Spec file for this module: Small test I get: Do I need to import the directory path and module name? Can you give me some very basic example how I can test this module? |
how i can pass "var status = true" from my jquery script to the js.erb file or other solutions? Posted: 05 Jan 2017 07:24 AM PST I have a controller action that looks like this: And both of these objects are paginated in the view at the same time. And I want to paginate both of these objects through but whichever button is clicked, I guess it has to go through the same Or, if I can add |
Rails validation if association has value Posted: 05 Jan 2017 06:39 AM PST In my Rails app I have Content, Fields, and FieldContents. The associations are: Fields contain columns that describe the field, such as name, required, and validation. What I want to do is validate the FieldContent using the data from its Field. So for example: However I'm currently getting the error: It would seem |
Fail to download a remote https svg file but embed inside <img> is good Posted: 05 Jan 2017 06:45 AM PST I have a Due to this issue, I cannot check head by What's the magic behind it? Anyone could enlighten me? Thanks. |
Posted: 05 Jan 2017 06:54 AM PST one of the requirement is to split I18n. I have been looking into the link below in section organization of local files
If i look at the config/locales/en-US.yml in my project i dont see anything for model, view or controller. I see the data about the items of the webpage. en-US.yml looks like this
Am i looking at wrong file? How do i split i18n for model, views and controller that has translation? Thanks |
Rails: parse weirdly-formatted JSON Posted: 05 Jan 2017 06:27 AM PST My JSON response from an external service looks like this: How can I parse the |
Posted: 05 Jan 2017 06:28 AM PST Is is possible to do this in rails. I have read about turbolinks. and have tried to adapt it for rails but was unable. this code comes from: Mask US phone number string with JavaScript Thank you! |
Posted: 05 Jan 2017 06:38 AM PST I'm new to Ruby and RSpec. I want to create very simple RSpec test: But when I run the code this way Can you give me some idea where I'm wrong? |
How does SymmetricDS convert Oracle RAW to Postgres BYTEA? Posted: 05 Jan 2017 05:54 AM PST I'm using SymmetricDS to replicate data from an Oracle DB to a Postgres DB, and let it create the schema in the Postgres slave. A column with type RAW in Oracle was converted to BYTEA in Postgres. Values are converted as such I.e., somewhere in the process, the value gets prepended with Is this the format SymmetricDS should have used to input the data in the Postgres DB? Or is there a way to tweak the query string so I can get the results on the current format? |
Can't add session variable - ActiveModel::MissingAttributeError Posted: 05 Jan 2017 06:20 AM PST I am not very confident with Rails but have recently started adding custom session variables in order to store some data such as id's. I am trying to set a call id to a recently created value but keep getting an error. Code: This exact same thing works in other actions in the same controller, but here I get: I am simply calling this action with a POST call in order to manipulate some data and set this session variable to be used later. There must be something fundamental that I am missing about how session variables work. Is there anything obvious that could cause this error? |
Minitest::UnexpectedError: ActiveRecord::RecordNotUnique: Mysql2::Error: Posted: 05 Jan 2017 06:45 AM PST I got a error that I wrote in home_controller, Before,I got a error that user variable is nil. So,I debuted and I got a error like above. But in localhost:3000, I got a error that Therefore,I really cannot understand what is wrong. How can I fix this error? in routes.rb,I wrote in test_helper.rb in home_controller_test.rb |
Getting each i element of a ruby array in a javascript function (escaping and unescaping)? Posted: 05 Jan 2017 05:26 AM PST Say, in ruby I've got an array: In my javascript script, I want to be able to push every element from my The error message I get is:
Note: If I leave the [i] in
I've also tried |
Namespacing within `app` directory Posted: 05 Jan 2017 04:56 AM PST In our
Our This works fine in most cases, but sometimes in development mode and with Rails' autoreloading turned on, this leads to the wrong classes being loaded. For instance Is there a way to configure this behavior so that it works without any errors? If not, the only workaround I can think of is to create a second directory for "namespaced" classes, along the lines of |
Ruby ajax js view returns encoded html instead of valid html Posted: 05 Jan 2017 05:02 AM PST I've got a javascript view (add_to_garden.js.erb) that responds to an ajax action and tries to render a flash message telling the user about the updated info. This works: Of course as it's written above, the html for each flash message will replace the previous one so only the last message will be shown to the user. This does render all the messages... ...but the messages in How to fix? |
Reading YAML from ruby is printing incorrect values Posted: 05 Jan 2017 05:41 AM PST I have a YAML file with the following structure: I use the below ruby code to read data from this YAML file: When I see the value printed in the console i see this:
|
Writing a scope for multiple associations - Rails 4 Posted: 05 Jan 2017 05:03 AM PST I am having challenges writing a scope to display:
event.rb card.rb payment.rb user.rb i tried the below in the card.rb file but i am unsure but got the below error: or, am i to write the scope in event.rb file if i want to display all cards with events that have payments that have been made by a user? |
how to create a user interface that a user can signup and login using reactjs and rails backend Posted: 05 Jan 2017 04:58 AM PST I'm very new to react but i'm experience with rails, i want know how to create user signup and login using react, can please any suggests what are the steps needed create registration process using react and rails. |
Rails / Postgres: Get percentage of availability Posted: 05 Jan 2017 06:28 AM PST I am using a Postgres database ( Now I want to check if I am available for a certain timespan ( I want to change this behavior to get the percentage of availability. How could I count the available days instead of the entries themselves? |
Why is my Rails App faster on Heroku than on my Localhost Posted: 05 Jan 2017 04:25 AM PST When I was developing my Rails app I noticed that it got extremely slow as soon as I included some background File creation via Amazon S3. When I uploaded my site to Heroku the load time dropped a lot. On my local server a page load takes about ~12s, on Heroku just ~1s. Why does my app run that much slower on my local computer? Does the Heroku server have a faster connection to the Amazon S3 servers? |
Create a JS component from remote call Posted: 05 Jan 2017 03:31 AM PST In my Rails5 app I have the JS component below. I create the components when Turbolinks loads as such And everything works just fine. Now I need to create a component from within a My js.erb file looks like And However, the component is not created. Am I missing anything here? Thanks |
Can we use two different types of AWS EC2 instances with elastic beanstalk loadbalancer Posted: 05 Jan 2017 03:10 AM PST I'm using elastic beanstalk to host my rails application, I've configured load balancer and I know how to set maximum and minimum numbers of instances of same type(for example 2 instances of T2.micro or 2 instances of T2.medium). My question is can I use two different types of instance in elastic beanstalk load balancer. e.g. one t2.Micro and one T2.Medium in same environment. |
You are subscribed to email updates from Newest questions tagged ruby-on-rails - Stack Overflow. To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 1600 Amphitheatre Parkway, Mountain View, CA 94043, United States |
No comments:
Post a Comment