ios CoreData relationship with attribute [closed] - ios

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I was wondering how to implement a relationship with an attribute using CoreData. XCode 5 with iOS 7.
In my ER model I've got a relationship "participation" with the attribute "confirmed".
In this case I'd like to know whether participation in an event of a specific profile has been confirmed.
In SQL the table for this relation would look like this:
Participation (EventID, ProfileID, confirmed)
Unfortunately I can't post images due to lack of reputation.
Thanks in advance!
Nelson

You can create a new entity (Participation) which has 2 relationships (one to the Event and one to the Profile) and 1 attribute (your BOOL).
It isn't clear whether you already have this or not, but it can be used (by creating an instance of the entity) to connect your selected objects and hold the confirmed status.

Related

Model student, subject, marks. Application logic [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have Student that has_many Subjects thas has_one Mark. Where should I write logic to sum all student marks from one subject ? Im beginner so any links to documentation or somewhere else are appreciated.
Almost any time I need to interact with multiple models, I use a plain old Ruby object (aka, a "PORO"). I personally call these 'managers', but I believe it's more common to call them 'service' objects (or some variation). Google 'Rails service objects' and that ought to get you started.

Rails: How do I keep different new/updated records before they're approved? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am now working on non-standart (for me at least) problem. I am to create system where any user profile change (or account creation) is to be approved as well as its child records.
For example -
User is crested/changes something >>
Status is changed to "Review" >>
Changes not applied yet >>
Admin reviews stuff >>
Approves >>
Changes applied.
When child object is created/updated - we get all the same process.
I was thinking of different ideas (as storing changes in serialized hash, using versions with paper_trail), but everything I come up with is very messy.
Just wondering if someone did similar stuff - what is the cleanest way to get this working?
I will use a mirror table 'UsersChanges' with 1 to 1 relationship to 'User' and the same id.
If any user have a relationship with 'UsersChanges' you know that the user has changes to be commited (only need a count).
And if you want to know their change you have to look by the same id to the other table ('UsersChanges').
And when changes are approved you only need to copy the data and remove 'UsersChanges' row.
Using hash with data can be more complex, you have to validate you hash and you will be using 'magical strings' for creating a model.
Hope it helps

Solution for voting without attachment to a model? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
My application is one page contract. I would like users to be able to sign the contract by clicking on a button. The contract is not a resource; it's plain HTML.
Every solution I have found so far relies on having a model that acts as votable. How can I implement a simple button that users may only click once, and display the number of users who have clicked it?
It's not possible to do this with static pages, at least not in a way that is clean and secure.
Think about it this way: every user is looking at a copy of the contract, which is being displayed to them on their browser (the client). If you want users to be able to cast votes that persist and be aware of votes cast by other users, then you need a server that keeps track of it centrally. That's why the solutions you have found so far rely on having a model, presumably backed with a table.

Add new column in user-database with controller of lecture [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
i have a little system with some users.
An user with admin-rights can create a new lecture.
Thats already working.
Now i want to solve the problem that users can sign up to lectures.
So i want to add a new column (boolean type) e.g. to lecture1 in my users database when i create a new lecture. So i can set the variable to true if an user sign up.
Is that a good idea or would it be better to have a database (e.g. signupstatus) with an exercise_id, an user_id. When there is an entry the user has already sign up to the lecture.
Or does anyone have an better idea?
Thanks :)
The table is always better. You will never want to create such columns(lecture1...) in User table, for each new lecture which to added in your system. Imagine the series of such columns [lecture1,lecture2,lecture3,lecturen...] => Totally unconventional and against the design principles.
What you want is a simple Many-to-Many relationship. A Lecture can be enrolled by many users; a User can subscribe to many lectures.
You should follow this guide to achieve it.
This will create a table - lectures_users and store lecture_id and user_id to maintain the relationship

What changes is necessary in Module.php and other files for add table in db [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm a beginner in zendframework2. I do example Album in zendframework website, and now I want to add a table in db and do same operations, but I don't know what changes are necessary in Module.php, AlbumController.php (and other files) and methods.
Please explain necessary changes completely.
Thanks
You should follow the Album tutorial and check out the page about database and models.
Simplified, the steps are:
Create your new model
Create a table class
Create two services in the service manager, one for the table class and one for the table gateway
Fetch the album table in the controller
Step #3 is a modification in the Module.php class and explained in this section. Step #4 is a change in the controller and explained here.

Resources